Stop re-explaining your project to Claude
One prompt that writes the CLAUDE.md for your repo: stack, commands, rules and traps, read at the start of every session.
Claude Code starts every session from zero. CLAUDE.md is the file it reads first. This prompt makes the agent study your codebase, ask you only what the code can't say, and write a short, specific file — with every command tested.
On Instagram? Comment MEMORY to get it in your DMs
A real-shaped example of what the prompt produces: short, specific, every command tested. Yours will describe your repo.
# Acme Bookings Booking app for independent barbers: clients book, barbers manage their week. ## Stack Next.js 15 (App Router) · TypeScript strict · Supabase (Postgres + Auth) · Tailwind · Stripe · Vercel ## Commands - dev: `npm run dev` (port 3000) - test: `npm test` · single file: `npx vitest run path/to/file.test.ts` - lint + types: `npm run lint && npx tsc --noEmit` - db: `npx supabase db push` (never edit applied migrations) ## Map - `app/` routes and pages — no business logic here - `lib/` data access + domain logic, one file per entity - `components/ui/` shared primitives, `components/<feature>/` feature UI - `supabase/migrations/` append-only SQL ## Conventions - Server components by default; `"use client"` only for interactivity - Data fetching through `lib/*.ts`, never Supabase calls inside components - Zod schemas next to the form that uses them (see `components/booking/schema.ts`) ## Rules - ALWAYS run lint + types before saying a task is done - NEVER use `any`, never add a dependency without asking - NEVER touch `lib/stripe.ts` or webhooks without explicit approval ## Workflow Plan in 3–5 bullets first, then code. Small PRs. Commits: `feat(scope): …` ## Gotchas - Needs `.env.local` with SUPABASE_URL / SUPABASE_ANON_KEY (see `.env.example`) - Times are stored in UTC, displayed in the barber's timezone
With the prompt
For Claude Code, Cursor, Codex. You end up owning code you understand.
- 1
Copy the prompt
It's right below — one click copies it, or download it as a file.
- 2
Paste it in your project
Open Claude Code in the repo root and paste it. It explores first, then asks you a few questions.
- 3
Keep it alive
Every time you correct Claude twice on the same thing, add one line to CLAUDE.md. Commit it with the code.
It makes the agent explore before writing, ask before guessing, and run every command before putting it in the file.
1Write a CLAUDE.md for this project — the file Claude Code reads at the start of2every session, so I never have to re-explain my stack, my rules or my folders3again.4 5Don't write it from guesses. Explore the repo first, then ask me only what the6code can't tell you, then write the file and prove the commands in it work.7 8## Step 1 — Explore (read, don't edit)9 10Look at, at minimum:11- the package manifest(s) and lockfile (package.json, pyproject.toml, go.mod, …)12- framework and tool configs (next.config, vite.config, tsconfig, eslint,13 prettier, tailwind, docker, CI workflows)14- the top two levels of the folder tree, and one or two typical files in each15 main folder, to learn the real naming and code style16- README, any existing CLAUDE.md / AGENTS.md / .cursorrules, and .env.example17- the last ~20 commit messages, to learn the commit style18 19## Step 2 — Ask me (one short message, max 6 questions)20 21Only ask what you could not infer, for example:22- what the product does, in one sentence, and who it's for23- rules you must never break (e.g. "never touch the payments folder",24 "no new dependencies without asking")25- how I like to work (small PRs? tests first? explain before coding?)26- anything that regularly goes wrong in this repo27 28## Step 3 — Write CLAUDE.md at the repo root29 30Use exactly these sections, in this order. Be specific and short: bullet31points, real paths, real commands. Aim for 60–120 lines total — every line32is read every session, so cut anything generic.33 34```35# <Project name>36One sentence: what it is and who it's for.37 38## Stack39Languages, framework + version, database, auth, hosting, key libraries.40 41## Commands42dev, build, test (all + single file), lint, typecheck, format, db migrate.43Only commands you have actually run successfully in Step 4.44 45## Map46The folders that matter, one line each: what lives there and what doesn't.47 48## Conventions49Naming, file structure, state, styling, error handling, imports —50as they ARE in this codebase, with one example path each.51 52## Rules53- ALWAYS: …54- NEVER: …55(the hard rules from my answers, plus anything dangerous you found:56secrets, generated files, migrations, protected folders)57 58## Workflow59How to work with me: plan first or just do it, test expectations,60commit message style, when to ask before acting.61 62## Gotchas63Non-obvious traps you noticed: env vars needed, ports, flaky tests,64order-of-operations, legacy code not to copy.65```66 67## Step 4 — Verify68 69- Run every command you put under "Commands". If one fails, fix the line or70 remove it — never leave an untested command in the file.71- Re-read the file and delete anything that would be true of *any* project.72- If a folder has its own very different rules (e.g. a separate backend or73 mobile app), create a short CLAUDE.md inside that folder too, and say so.74 75## Step 5 — Hand over76 77Show me the final file, list what you inferred vs. what I told you, and78suggest 2–3 rules I might want to add after a week of using it.79 80Do not change any code in this task — only create CLAUDE.md file(s).Shorter beats complete
CLAUDE.md is read at the start of every session, so every line costs attention. Keep rules you'd actually enforce, delete anything true of any project, and add a line only when you've corrected the same mistake twice.
Want something like this built for your product?
Build with me