agentleFS
Global-Software-ConsultingGlobal-Software-Consulting/project-scaffolding-skills/skills/generate-claude-md/SKILL.md

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.

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
  1. Distinctive:

    Run this: after scaffolding a new project, OR on any existing project to create/refresh it.

    line 12
  2. Distinctive:

    Check the project root:

    line 19
  3. Distinctive:

    If running standalone, check for clues:

    line 90
  4. Very specific:

    Read ~/.claude/project-scaffolding/reference/templates/CLAUDE.md.template to understand all possible sections and their inclusion …

    line 99
  5. Distinctive:

    Write the generated content to CLAUDE.md in the project root.

    line 140
  6. Distinctive:

    If a CLAUDE.md already exists, read it first and check:

    line 142
  7. Very specific:

    If it was manually edited with custom notes, preserve those notes under a ## Project Notes section at the bottom

    line 143
  8. Distinctive:

    If the file already existed:

    line 155
  9. Very specific:

    Always use the real project name from package.json — never "my-project" or "your-project"

    line 177
  10. Very specific:

    Use yarn or npm consistently throughout — match what's detected, don't mix

    line 178
  11. Distinctive:

    Keep it under ~150 lines — it's loaded into every conversation, concise wins

    line 180

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.js
  • vite.config.* → React (Vite)
  • app.json with "expo" key → React Native (Expo)
  • android/ + ios/ without expo → React Native (CLI)
  • src/main.ts with @nestjs/core in package.json → NestJS
  • src/app.ts + express in package.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 | none

Detection map (check dependencies + devDependencies):

PackageProfile flag
@heroui/reactUI_LIBRARY: heroui
@radix-ui/react-* OR components.json file existsUI_LIBRARY: shadcn
tailwindcss (without above)UI_LIBRARY: tailwind-only
@reduxjs/toolkitSTATE: redux
zustandSTATE: zustand
react-router-domROUTER: react-router
@tanstack/react-routerROUTER: tanstack-router
expo-routerROUTER: expo-router
@react-navigation/nativeROUTER: react-navigation
@tanstack/react-queryHTTP: tanstack-query+axios (if axios also present)
@reduxjs/toolkit + createApi detectedHTTP: rtk-query
@apollo/clientHTTP: apollo
axios (without tanstack-query)HTTP: axios
next-authAUTH: nextauth
jsonwebtoken (in non-nest)AUTH: jwt-custom
react-hook-form + zodFORMS: rhf+zod
react-hook-form + yupFORMS: rhf+yup
formikFORMS: formik+yup
next-intlI18N: next-intl
react-i18nextI18N: react-i18next
expo-localization + i18nextI18N: expo-i18n
motionANIMATIONS: motion
huskyTOOLING: husky+commitlint
@prisma/clientDATABASE: prisma
drizzle-ormDATABASE: drizzle
mongooseDATABASE: mongoose
bullmqQUEUES: bullmq
@nestjs/swagger OR swagger-ui-expressDOCS: swagger
class-validatorVALIDATION: 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-app or setup-project flow
  • If running standalone, check for clues:
    • src/features/dashboard* or admin → dashboard
    • src/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 name from package.json
  • Exact commands — use yarn or npm based on detected package manager

Section inclusion guide

SectionInclude when
Stack tableAlways
Installed Packages tableAlways
Folder LayoutAlways — use the correct variant for framework
Critical Rules → next-intlI18N: next-intl
Critical Rules → HeroUIUI_LIBRARY: heroui
Critical Rules → MotionANIMATIONS: motion
Critical Rules → ReduxSTATE: redux
Critical Rules → NextAuthAUTH: nextauth
Critical Rules → PrismaDATABASE: prisma
Code Patterns → API callsHTTP is anything other than native-fetch
Code Patterns → FormsFORMS is not none
Code Patterns → TranslationsI18N is not none
Commands → docker + prismaDATABASE: prisma or drizzle
Commands → swaggerDOCS: swagger
Dev Skills → /add-translationI18N is not none
Dev Skills blockAlways (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 Notes section 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.md in 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-md after adding new packages."


Rules

  • Always use the real project name from package.json — never "my-project" or "your-project"
  • Use yarn or npm consistently 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 ## Apps section listing each app and its type. The folder layout section describes the monorepo structure. Per-app rules go under their own ### <app-name> subsection.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.