Smetti di rispiegare il tuo progetto a Claude
Un prompt che scrive il CLAUDE.md del tuo repo: stack, comandi, regole e trappole, letto all'inizio di ogni sessione.
Claude Code parte da zero a ogni sessione. CLAUDE.md è il primo file che legge. Questo prompt fa studiare il codice all'agente, ti chiede solo ciò che il codice non dice, e scrive un file breve e specifico — con ogni comando testato.
Arrivi da Instagram? Commenta MEMORY e te lo mando in DM
Un esempio realistico di cosa produce il prompt: breve, specifico, ogni comando testato. Il tuo descriverà il tuo 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
Con il prompt
Per Claude Code, Cursor, Codex. Alla fine possiedi codice che capisci.
- 1
Copia il prompt
È qui sotto — un clic per copiarlo, oppure scaricalo come file.
- 2
Incollalo nel tuo progetto
Apri Claude Code nella root del repo e incollalo. Prima esplora, poi ti fa qualche domanda.
- 3
Tienilo aggiornato
Ogni volta che correggi Claude due volte sulla stessa cosa, aggiungi una riga a CLAUDE.md. Fai commit insieme al codice.
Obbliga l'agente a esplorare prima di scrivere, chiedere prima di indovinare, e lanciare ogni comando prima di metterlo nel 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).Corto batte completo
CLAUDE.md viene letto all'inizio di ogni sessione, quindi ogni riga costa attenzione. Tieni le regole che faresti davvero rispettare, cancella ciò che vale per qualsiasi progetto, e aggiungi una riga solo quando hai corretto lo stesso errore due volte.
Vuoi qualcosa del genere per il tuo prodotto?
Costruiamolo insieme