generate-claude-md
Skill8 starsChanged 8 months agoMITView on GitHub
Generate a CLAUDE.md file for the current project. Claude Code reads this automatically at the start of every session — it captures the full stack, folder conventions, critical rules, and commands so Claude never needs to re-discover the project setup.
In this repository6 other files it gives its agents.
- create-frontend-projectSkill
- create-monorepoSkill
- create-node-apiSkill
- create-projectSkill
- scaffold-appSkill
- setup-projectSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Run this: after scaffolding a new project, OR on any existing project to create/refresh it.
- Distinctive: line 19
Check the project root:
- Distinctive: line 90
If running standalone, check for clues:
- Very specific: line 99
Read ~/.claude/project-scaffolding/reference/templates/CLAUDE.md.template to understand all possible sections and their inclusion …
- Distinctive: line 140
Write the generated content to CLAUDE.md in the project root.
- Distinctive: line 142
If a CLAUDE.md already exists, read it first and check:
- Very specific: line 143
If it was manually edited with custom notes, preserve those notes under a ## Project Notes section at the bottom
- Distinctive: line 155
If the file already existed:
- Very specific: line 177
Always use the real project name from package.json — never "my-project" or "your-project"
- Very specific: line 178
Use yarn or npm consistently throughout — match what's detected, don't mix
- Distinctive: line 180
Keep it under ~150 lines — it's loaded into every conversation, concise wins
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generate CLAUDE.md
You are generating a CLAUDE.md file for this project. Claude Code reads this file automatically
at the start of every conversation in this directory. The goal is a concise, accurate,
always-current context file so Claude understands the stack without reading source files.
Run this: after scaffolding a new project, OR on any existing project to create/refresh it.
Step 1 — Detect Project Type and Stack
1a. Framework
Check the project root:
next.config.*→ Next.jsvite.config.*→ React (Vite)app.jsonwith"expo"key → React Native (Expo)android/+ios/without expo → React Native (CLI)src/main.tswith@nestjs/coreinpackage.json→ NestJSsrc/app.ts+expressinpackage.json(no nest) → Express
1b. Read package.json and build the full stack profile
FRAMEWORK: next | vite | expo | rn-cli | express | nestjs
APP_TYPE: dashboard | landing | consumer | general | api
PKG_MANAGER: yarn | npm (yarn.lock present → yarn)
NODE_VERSION: from engines.node, default "20"
UI_LIBRARY: heroui | shadcn | tailwind-only | none
STATE: redux | zustand | none
ROUTER: built-in(next) | react-router | tanstack-router | expo-router | react-navigation | none
HTTP: tanstack-query+axios | rtk-query | apollo | axios | native-fetch | none
AUTH: nextauth | jwt-custom | jwt-api | none
FORMS: rhf+zod | rhf+yup | formik+yup | none
I18N: next-intl | react-i18next | expo-i18n | none
ANIMATIONS: motion | none
TOOLING: husky+commitlint | none
[Node API only]
DATABASE: prisma | drizzle | mongoose | none
QUEUES: bullmq | none
DOCS: swagger | none
VALIDATION: zod | class-validator | noneDetection map (check dependencies + devDependencies):
| Package | Profile flag |
@heroui/react | UI_LIBRARY: heroui |
@radix-ui/react-* OR components.json file exists | UI_LIBRARY: shadcn |
tailwindcss (without above) | UI_LIBRARY: tailwind-only |
@reduxjs/toolkit | STATE: redux |
zustand | STATE: zustand |
react-router-dom | ROUTER: react-router |
@tanstack/react-router | ROUTER: tanstack-router |
expo-router | ROUTER: expo-router |
@react-navigation/native | ROUTER: react-navigation |
@tanstack/react-query | HTTP: tanstack-query+axios (if axios also present) |
@reduxjs/toolkit + createApi detected | HTTP: rtk-query |
@apollo/client | HTTP: apollo |
axios (without tanstack-query) | HTTP: axios |
next-auth | AUTH: nextauth |
jsonwebtoken (in non-nest) | AUTH: jwt-custom |
react-hook-form + zod | FORMS: rhf+zod |
react-hook-form + yup | FORMS: rhf+yup |
formik | FORMS: formik+yup |
next-intl | I18N: next-intl |
react-i18next | I18N: react-i18next |
expo-localization + i18next | I18N: expo-i18n |
motion | ANIMATIONS: motion |
husky | TOOLING: husky+commitlint |
@prisma/client | DATABASE: prisma |
drizzle-orm | DATABASE: drizzle |
mongoose | DATABASE: mongoose |
bullmq | QUEUES: bullmq |
@nestjs/swagger OR swagger-ui-express | DOCS: swagger |
class-validator | VALIDATION: class-validator |
1c. Read name from package.json — use as the project name in CLAUDE.md
1d. App type
- Already known if coming from
scaffold-apporsetup-projectflow - If running standalone, check for clues:
src/features/dashboard*oradmin→ dashboardsrc/app/(marketing)or landing-style pages → landing- Otherwise: ask "What kind of app is this? A) Dashboard B) Landing C) Consumer D) General / API"
Step 2 — Read the Template
Read ~/.claude/project-scaffolding/reference/templates/CLAUDE.md.template to understand all
possible sections and their inclusion conditions.
Step 3 — Generate CLAUDE.md Content
Using the detected stack profile and the template as a blueprint, write a clean CLAUDE.md
that includes only the sections relevant to this project. Rules:
- No placeholder text — if a package isn't installed, omit its section entirely
- No blank rows in tables — only list packages that are actually installed
- No redundant rules — only include Critical Rules for packages that need special import/usage guidance
- Exact project name in the heading — use the
namefrompackage.json - Exact commands — use
yarnornpmbased on detected package manager
Section inclusion guide
| Section | Include when |
| Stack table | Always |
| Installed Packages table | Always |
| Folder Layout | Always — use the correct variant for framework |
| Critical Rules → next-intl | I18N: next-intl |
| Critical Rules → HeroUI | UI_LIBRARY: heroui |
| Critical Rules → Motion | ANIMATIONS: motion |
| Critical Rules → Redux | STATE: redux |
| Critical Rules → NextAuth | AUTH: nextauth |
| Critical Rules → Prisma | DATABASE: prisma |
| Code Patterns → API calls | HTTP is anything other than native-fetch |
| Code Patterns → Forms | FORMS is not none |
| Code Patterns → Translations | I18N is not none |
| Commands → docker + prisma | DATABASE: prisma or drizzle |
| Commands → swagger | DOCS: swagger |
| Dev Skills → /add-translation | I18N is not none |
| Dev Skills block | Always (all projects benefit) |
Step 4 — Write the File
Write the generated content to CLAUDE.md in the project root.
If a CLAUDE.md already exists, read it first and check:
- If it was manually edited with custom notes, preserve those notes under a
## Project Notessection at the bottom - Regenerate all the auto-detected sections above it
Step 5 — Commit
git add CLAUDE.md
git commit -m "chore: generate CLAUDE.md — project context for Claude Code"If the file already existed:
git commit -m "chore: update CLAUDE.md — refresh stack context"Step 6 — Confirm
Tell the user:
"Generated
CLAUDE.mdin the project root.Claude Code reads this automatically at the start of every session in this directory — no need to explain the stack each time.
To keep it current: re-run
/generate-claude-mdafter adding new packages."
Rules
- Always use the real project name from
package.json— never "my-project" or "your-project" - Use
yarnornpmconsistently throughout — match what's detected, don't mix - The CLAUDE.md must be human-readable too — use clean markdown, no tool output noise
- Keep it under ~150 lines — it's loaded into every conversation, concise wins
- For monorepos: generate one CLAUDE.md at the root. Add a
## Appssection listing each app and its type. The folder layout section describes the monorepo structure. Per-app rules go under their own### <app-name>subsection.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

