Claude Code CLAUDE.md Generator: Set It Up Once, Not Every Session
Has Claude Code scan your repo and produce a tight, verifiable CLAUDE.md project memory file under 200 lines—covering build/test/lint commands, directory structure, conventions, and prohibitions—while routing anything that doesn't belong there into skills or path-scoped rules instead.
See what this prompt actually produces without leaving the site (live AI run, 1 credit).
Don't just copy-paste — download and drop it at ~/.claude/skills/claude-md-architect/SKILL.md and every future session can use it automatically.
mkdir -p ~/.claude/skills/claude-md-architect && mv ~/Downloads/SKILL.md ~/.claude/skills/claude-md-architect/SKILL.mdNew-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\skills\claude-md-architect" | Out-Null; Move-Item "$env:USERPROFILE\Downloads\SKILL.md" "$env:USERPROFILE\.claude\skills\claude-md-architect\SKILL.md"[When to use] The first thing to do when adopting Claude Code on an existing repo, or once you notice you're re-explaining the same build commands/directory layout/off-limits areas every new session. [Why it works] (1) It forces the model to 'scan the repo for the real commands' before writing anything, instead of writing `npm test` from memory when your project actually uses pnpm; (2) the three-stage DISCOVER→TRIAGE→WRITE process cleanly separates 'belongs in CLAUDE.md vs. belongs in rules/ vs. belongs in a skill'—which matches official guidance: CLAUDE.md should hold only facts needed every single time, multi-step workflows belong in a skill, and rules that apply only to certain file types go in `.claude/rules/` scoped with a `paths` frontmatter; (3) it enforces a 200-line cap and requires 'every line must be verifiable,' because the longer CLAUDE.md gets, the worse adherence becomes. [Tip] Don't use the output right away—first skim the Do NOT section to confirm it didn't hallucinate restrictions that don't actually exist; afterward you can run `/init` anytime for an interactive refresh, or `/memory` to confirm the file is being loaded. If an AGENTS.md already exists, the prompt automatically switches to a `@AGENTS.md` import instead of duplicating content.
# CLAUDE.md — LUVAI 股票分析後端 ## Commands - Install: `pnpm install` - Dev: `pnpm dev` - Typecheck (run before declaring done): `pnpm tsc --noEmit` - Test: `pnpm vitest run` # CI uses this exact command - Deploy: `pnpm run deploy` # wrangler; ask before running ## Project layout - `src/routes/` — API route handlers - `src/lib/` — shared logic (credits, entitlements) - `migrations/` — D1 SQL, append-only, numbered ## Do NOT - Never edit files under `.open-next/` (generated) - Never run a migration without confirming with the user first - Never use `POWER()` in D1 SQL — use `EXP(LN(x)*y)` ## Workflow 1. Make the change 2. `pnpm tsc --noEmit` must pass 3. Summarize what changed before committing --- not placed in CLAUDE.md --- - Multi-step deploy verification → move to .claude/skills/deploy/ - API input-validation rules → .claude/rules/api.md (paths: src/routes/**)
[PROJECT_NAME]專案名稱,例如「LUVAI 股票分析後端」或「行銷官網」
[STACK]主要技術棧,例如「Next.js 15 + TypeScript + Cloudflare Workers」或「Python FastAPI」
[PACKAGE_MANAGER]套件管理器/執行器,例如 pnpm、npm、uv、poetry、cargo、go
[KNOWN_PITFALLS](可選)你已知 Claude 在這專案常踩的雷,例如「會用 npm 但專案是 pnpm」「會亂改 migrations」;沒有就留白
填下面的欄位,上方 prompt 會即時替換 [方括號] 內容。填好後按「複製組好的 prompt」直接丟進工具。
You are setting up the project memory file (CLAUDE.md) for this repository so that every future Claude Code session starts already knowing how to work here. CLAUDE.md is loaded into context at the start of every session, so it is a behavioral contract, not documentation — every line must change how the agent acts.
Project: {{PROJECT_NAME}}
Primary language / stack: {{STACK}}
Package manager / runtime: {{PACKAGE_MANAGER}}
Things you already know Claude tends to get wrong here (optional): {{KNOWN_PITFALLS}}
Work in these phases. Do NOT write the file until Phase 3.
PHASE 1 — DISCOVER (read-only, no edits)
1. Detect the real build/test/lint/format/typecheck commands. Read package.json scripts, Makefile, justfile, pyproject.toml, Cargo.toml, go.mod, composer.json, or CI config — whichever exist. Record the EXACT command string (e.g. `pnpm vitest run`, not `npm test`). If multiple are plausible, note which one CI actually runs.
2. Map the directory layout: where source, tests, config, and entry points live. Note any non-obvious folders (generated code, vendored deps).
3. Detect conventions that are decisions, not defaults: indentation, import style, error-handling pattern, naming, how new modules/endpoints/components are added.
4. Detect an existing AGENTS.md, .cursorrules, .windsurfrules, or CLAUDE.md. If a CLAUDE.md already exists, you will IMPROVE it, not overwrite it.
PHASE 2 — TRIAGE (decide what belongs where)
For each candidate instruction, classify it:
- BELONGS IN CLAUDE.md: a fact true in every session — build commands, layout, "always do X" rules, hard prohibitions.
- BELONGS IN A path-scoped rule (.claude/rules/<topic>.md with a `paths:` frontmatter glob): only matters for one file type or subtree (e.g. API-handler rules, test rules).
- BELONGS IN A SKILL (.claude/skills/): a multi-step procedure (deploy, release, migration), not a fact.
State the triage table before writing anything. Reject anything that could be copy-pasted into any random repo unchanged — generic advice wastes context and lowers adherence.
PHASE 3 — WRITE
Write (or, if one exists, propose a diff to) `./CLAUDE.md` with this structure and these rules:
- Target UNDER 200 lines. Shorter = better adherence. If it grows past that, push detail into rules/ or skills/ and reference them.
- Use markdown headers + bullets, not paragraphs.
- Every instruction must be concrete and verifiable: "Run `{{PACKAGE_MANAGER}} test` before committing" not "test your changes"; "API handlers live in src/api/handlers/" not "keep files organized".
- Sections to include (drop any that don't apply, don't pad):
## Commands — the exact build / test / lint / typecheck / dev / format commands. This is the single most valuable section.
## Project layout — where things live, one line each.
## Conventions — only real team decisions (style, patterns, naming).
## Do NOT — explicit prohibitions (e.g. never edit generated files, never commit to main, never bump deps without asking). Be specific about paths.
## Workflow — required steps Claude must follow (e.g. run typecheck before declaring done).
- If an AGENTS.md exists, do not duplicate it: start CLAUDE.md with `@AGENTS.md` to import it, then add only Claude-specific lines below.
- Do not invent commands, paths, or conventions. If you cannot verify a command actually works, mark it `# unverified — confirm` rather than guessing.
- Use a block-level HTML comment `<!-- ... -->` for any note meant for human maintainers (it is stripped from Claude's context).
AFTER WRITING
- List which items you deliberately did NOT put in CLAUDE.md and where they should go instead (rules/ or skills/), so the human can follow up.
- Note that they can run `/memory` to confirm the file is being loaded, and `/init` for an interactive re-pass later.
- Remind them: CLAUDE.md is guidance the model tries to follow, not hard enforcement. Anything that MUST happen at a fixed moment (e.g. lint on every save) should be a hook instead.Suno Engineer's Mindset: 4 Steps to a Song That Doesn't Sound Like AI
A studio engineer's breakdown of Suno's fatal weaknesses (fried vocals, high-frequency artifacts), plus a 4-step DAW workflow and a Suno Studio cleanup prompt.
5 Claude Weekly Workflows That Stuck After 6 Months
Proposal generator / meeting processor / content repurposer / Friday review / shutdown reset — out of 40 I tried, only these 5 survived, each saving 30+ minutes per run.