Verified against Claude Code · 2026-07-21
Write a CLAUDE.md file that still holds up after fifty sessions
A structured CLAUDE.md authoring prompt that separates durable project facts from session-specific noise, so the file Claude Code auto-loads every session stays accurate instead of silently rotting into stale advice.
The prompt
Ready to copy — highlighted parts are example details you can swap.
Write this as CLAUDE.md at the repository root. Claude Code loads this file into context automatically at the start of every future session in this repo, so every line here must be true across many sessions, not only the one in which it is written. Anything only true today, such as this week's open bug or a decision still under debate, does not belong in this file. PROJECT tools.scult.in — A Next.js tools directory site serving free browser-based utilities plus an AI prompt library. STACK AND ENVIRONMENT Next.js 16 App Router, TypeScript strict mode, Biome for lint and format, Vitest for tests. COMMANDS, EXACT AND RUNNABLE - Install dependencies using the existing lockfile only. Never switch package managers or add a second one alongside it. - Run tests: npm run test - Lint and typecheck must both be run and shown clean before any task is declared done. A change that looks correct is not the same as a change that is verified correct — run the commands and report the actual output, not an assumption about what it would show. - Add any other project-specific command, such as starting a local dev server or running a database migration, following this same exact-and-runnable rule rather than a paraphrase. ARCHITECTURE NOTES A FRESH SESSION WOULD OTHERWISE HAVE TO RE-DISCOVER lib/tools/ and lib/prompts/ are deliberately parallel sibling registries with separate type unions — never merge them into one shared type, see docs/PLAN.md. HARD RULES - Never commit directly to the default branch. Always work on a branch and open a pull request, even for a one-line change. - Never add a dependency, including a devDependency, without naming it and asking first. - Never delete, skip, or rewrite a test to make a suite pass. If a test looks wrong, say so and stop rather than editing it until it agrees with the code. - Never assume a missing file, config value, or environment variable is safe to invent a plausible default for — ask, or search the codebase for how it is set elsewhere first. - Never introduce a new npm dependency under 500 weekly downloads without flagging it first; never use any in TypeScript without a justifying comment. - If a task would touch more than five files or change a public interface, stop and describe a plan before writing any code — the same discipline Plan Mode enforces when toggled on manually, applied here by default instead. WHEN UNSURE Ask one specific, answerable question instead of guessing and proceeding on an assumption. State the assumption that would otherwise be made, so a one-word confirmation from a human is enough to unblock the task rather than a full explanation. DEFINITION OF DONE Tests pass locally with the exact command above, lint and typecheck are clean, no unrelated file changed, and the change is explained in plain language in the final message, not just left as a diff. WHAT DOES NOT BELONG IN THIS FILE The current sprint, an open bug still being triaged, or a technical decision still under active debate. Those belong in an issue tracker or a task-scoped PLAN.md, not here — a fact that stops being true and is never removed from CLAUDE.md is more dangerous than no fact at all, because every future session trusts it by default without re-verifying it. MAINTENANCE If a session surfaces something that should have been written here from the start — a gotcha, a naming convention, a rule a human had to correct in the moment — say so explicitly in the final message of that session, naming the exact sentence to add and where, rather than letting the identical correction happen again in a future session that has no memory of this one.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
CLAUDE.md is not a suggestion Claude Code might read — it is loaded into context automatically at the start of every session in that repository, which is exactly why the maintenance section matters more than it would in a one-off prompt: a fact written here is trusted by every future session without re-verification, so a stale claim about, say, which package manager is standard does not just mislead one conversation, it silently misleads every session for as long as it stays uncorrected. Separating durable architecture notes and hard rules from a dedicated 'what does not belong here' section targets the actual way these files decay in practice — a rules file is edited most often mid-task, under time pressure, by someone adding the fact they need right now, and without an explicit boundary that ephemeral state does not belong, a CLAUDE.md accumulates exactly the kind of decision-still-under-debate or bug-being-triaged entries that go stale within a sprint and then get trusted as ground truth for months. The instruction to ask one specific, answerable question and state the assumption that would otherwise be made is calibrated to how a terminal-based coding session actually proceeds turn by turn: a vague clarifying question forces a human to context-switch back into a full explanation, while a stated assumption needs only a one-word confirmation to unblock the agent, which is the difference between a five-second reply and a five-minute one across the life of a project with many sessions. Naming a concrete threshold — more than five files, or a changed public interface — as the trigger for stopping to plan gives the same discipline Plan Mode's read-only toggle provides, but makes it the file's own default rather than something a human has to remember to switch on for every session; a number is also checkable in a way 'significant changes' is not, so there is no ambiguity about whether a four-file change needed a plan first or not.
Verified against
Claude Code Sonnet 4.6 · 2026-07-21
Changelog
- 2026-07-21 — Initial publish, verified against Claude Code running Sonnet 4.6.
Building this for real?
This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.
EXPLORE CUSTOM SOFTWARE
