跳到主要内容

claude-md 精选

Create or update CLAUDE.md files following best practices for optimal AI agent onboarding

在 GitHub 打开

安装方式

cp -r 03-skills/claude-md ~/.claude/skills/claude-md

把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/

整仓一次性获取:git clone --depth 1 https://github.com/luongnv89/claude-howto.git

依赖与权限

  • 无需 API Key
  • 需要联网访问外部服务
  • 依赖外部命令:node bun pip uv cargo
  • 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。

SKILL.md 正文

来源 luongnv89/claude-howto@065ab37 · 许可 MIT · 内容未修改

User Input

$ARGUMENTS

You MUST consider the user input before proceeding (if not empty). User may specify:

  • create - Create new CLAUDE.md from scratch
  • update - Improve existing CLAUDE.md
  • audit - Analyze and report on current CLAUDE.md quality
  • A specific path to create/update (e.g., src/api/CLAUDE.md for directory-specific instructions)

Core Principles

LLMs are stateless: CLAUDE.md is the only file automatically included in every conversation. It serves as the primary onboarding document for AI agents into your codebase.

The Golden Rules

  1. Less is More: Frontier LLMs can follow ~150-200 instructions. Claude Code's system prompt already uses ~50. Keep your CLAUDE.md focused and concise.
  1. Universal Applicability: Only include information relevant to EVERY session. Task-specific instructions belong in separate files.
  1. Don't Use Claude as a Linter: Style guidelines bloat context and degrade instruction-following. Use deterministic tools (prettier, eslint, etc.) instead.
  1. Never Auto-Generate: CLAUDE.md is the highest leverage point of the AI harness. Craft it manually with careful consideration.

Execution Flow

1. Project Analysis

First, analyze the current project state:

  1. Check for existing CLAUDE.md files:
  • Root level: ./CLAUDE.md or .claude/CLAUDE.md
  • Directory-specific: **/CLAUDE.md
  • Global user config: ~/.claude/CLAUDE.md
  1. Identify the project structure:
  • Technology stack (languages, frameworks)
  • Project type (monorepo, single app, library)
  • Development tools (package manager, build system, test runner)
  1. Review existing documentation:
  • README.md
  • CONTRIBUTING.md
  • package.json, pyproject.toml, Cargo.toml, etc.

2. Content Strategy (WHAT, WHY, HOW)

Structure CLAUDE.md around three dimensions:

WHAT - Technology & Structure

  • Technology stack overview
  • Project organization (especially important for monorepos)
  • Key directories and their purposes

WHY - Purpose & Context

  • What the project does
  • Why certain architectural decisions were made
  • What each major component is responsible for

HOW - Workflow & Conventions

  • Development workflow (bun vs node, pip vs uv, etc.)
  • Testing procedures and commands
  • Verification and build methods
  • Critical "gotchas" or non-obvious requirements

3. Progressive Disclosure Strategy

For larger projects, recommend creating an agent_docs/ folder:

agent_docs/
  |- building_the_project.md
  |- running_tests.md
  |- code_conventions.md
  |- architecture_decisions.md

In CLAUDE.md, reference these files with instructions like:

For detailed build instructions, refer to `agent_docs/building_the_project.md`

Important: Use file:line references instead of code snippets to avoid outdated context.

4. Quality Constraints

When creating or updating CLAUDE.md:

  1. Target Length: Keep it under a few hundred lines; shorter is better
  2. No Style Rules: Remove any linting/formatting instructions
  3. No Task-Specific Instructions: Move to separate files
  4. No Code Snippets: Use file references instead
  5. No Redundant Information: Don't repeat what's in package.json or README

5. Essential Sections

A well-structured CLAUDE.md should include:

# Project Name

Brief one-line description.

## Tech Stack
- Primary language and version
- Key frameworks/libraries
- Database/storage (if any)

## Project Structure
[Only for monorepos or complex structures]
- `apps/` - Application entry points
- `packages/` - Shared libraries

## Development Commands
- Install: `command`
- Test: `command`
- Build: `command`

## Critical Conventions
[Only non-obvious, high-impact conventions]
- Convention 1 with brief explanation
- Convention 2 with brief explanation

## Known Issues / Gotchas
[Things that consistently trip up developers]
- Issue 1
- Issue 2

6. Anti-Patterns to Avoid

DO NOT include:

  • Code style guidelines (use linters)
  • Documentation on how to use Claude
  • Long explanations of obvious patterns
  • Copy-pasted code examples
  • Generic best practices ("write clean code")
  • Instructions for specific tasks
  • Auto-generated content
  • Extensive TODO lists

7. Validation Checklist

Before finalizing, verify:

  • [ ] Kept under a few hundred lines; shorter is better
  • [ ] Every line applies to ALL sessions
  • [ ] No style/formatting rules
  • [ ] No code snippets (use file references)
  • [ ] Commands are verified to work
  • [ ] Progressive disclosure used for complex projects
  • [ ] Critical gotchas are documented
  • [ ] No redundancy with README.md

Output Format

For create or default:

  1. Analyze the project
  2. Draft a CLAUDE.md following the structure above
  3. Present the draft for review
  4. Write to the appropriate location after approval

For update:

  1. Read existing CLAUDE.md
  2. Audit against best practices
  3. Identify:
  • Content to remove (style rules, code snippets, task-specific)
  • Content to condense
  • Missing essential information
  1. Present changes for review
  2. Apply changes after approval

For audit:

  1. Read existing CLAUDE.md
  2. Generate a report with:
  • Current line count vs target
  • Percentage of universally-applicable content
  • List of anti-patterns found
  • Recommendations for improvement
  1. Do NOT modify the file, only report

AGENTS.md Handling

If the user requests AGENTS.md creation/update:

Since v2.1.277, Claude Code reads AGENTS.md directly as project instructions — but only when the working directory and every directory above it contain no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md. ~/.claude/CLAUDE.md, managed CLAUDE.md, and .claude/rules/ do not count for that check and keep loading alongside. Which files are read is controlled by Project instructions in /config: claude-md-or-agents-md (default), claude-md-and-agents-md, claude-md, or managed-only. Where direct reading is unavailable — versions before v2.1.277 (before v2.1.281 on Bedrock/Vertex/Foundry, LLM gateways, or with telemetry disabled), or the first session after upgrading — fall back to importing it from CLAUDE.md with @AGENTS.md, or symlinking CLAUDE.md to it.

AGENTS.md is a cross-tool project-context file — the same category of document as CLAUDE.md, not an agent-definition format. It exists so several coding agents can share one set of project conventions:

  • Build, test, and lint commands
  • Code style and architectural conventions
  • Repository layout and where things live

Subagents are defined separately, in .claude/agents/*.md — not in AGENTS.md.

Apply similar principles:

  • Keep focused and concise
  • Use progressive disclosure
  • Reference external docs instead of embedding content

Notes

  • Always verify commands work before including them
  • When in doubt, leave it out - less is more
  • The system reminder tells Claude that CLAUDE.md "may or may not be relevant" - the more noise, the more it gets ignored
  • Monorepos benefit most from clear WHAT/WHY/HOW structure
  • Directory-specific CLAUDE.md files should be even more focused

Last Updated: September 26, 2026

Claude Code Version: 2.1.283

Sources:

  • https://code.claude.com/docs/en/skills
  • https://code.claude.com/docs/en/memory#agents-md
  • https://code.claude.com/docs/en/memory#when-agents-md-support-is-unavailable

Compatible Models: Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5

质量与来源

所属仓库
luongnv89/claude-howto
仓库星标
4.2 万
最近更新
昨天
采集时间
今天
commit
065ab3734f64
内容指纹
sha256:a6f248ca47c5fc4
文件路径
03-skills/claude-md/SKILL.md

同仓库其它 Skill

查看全部 25 个
lesson-quiz
Test a learner on a single Claude Code tutorial lesson (01-10) with 10 questions, scoring answers and flagging weak spots. Use before, during, or after a lesson. Don't use for whole-tutorial assessment or explaining a topic instead of testing it.
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端
self-assessment
Comprehensive Claude Code self-assessment and learning path advisor. Runs a multi-category quiz covering 10 feature areas, produces a detailed skill profile with per-topic scores, identifies specific gaps, and generates a personalized learning path with prioritized next steps. Use when asked to "assess my level", "take the quiz", "find my level", "where should I start", "what should I learn next", "check my skills", "skill check", or "level up".
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端
blog-draft
Draft a blog post from ideas and resources. Use when users want to write a blog post, create content from research, or draft articles. Guides through research, brainstorming, outlining, and iterative drafting with version control.
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端
brand-voice
Ensure all communication matches brand voice and tone guidelines. Use when creating marketing copy, customer communications, public-facing content, or when users mention brand voice, tone, or writing style.
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端
code-review-specialist
Comprehensive code review with security, performance, and quality analysis. Use when users ask to review code, analyze code quality, evaluate pull requests, or mention code review, security analysis, or performance optimization.
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端
doc-generator
Generate comprehensive, accurate API documentation from source code. Use when creating or updating API documentation, generating OpenAPI specs, or when users mention API docs, endpoints, or documentation.
精选 luongnv89/claude-howto 4.2 万 原文
Claude CodeMCP 客户端

相似 Skill

更多「写作」
interview-prep
Prepares the user for a specific interview from their real experience. Builds a story bank in Situation/Task/Action/Result/Reflection form mapped to the competencies the role and company test (such as Amazon's Leadership Principles), writes a cited company and role brief from public sources, predicts questions per round, drafts opener, why-us, weakness and salary answers, prepares questions to ask and a logistics checklist, and runs a post-interview debrief. Use when the user says "help me prepare for my interview", "I have an interview tomorrow" or "in 2 hours", "build my story bank", "STAR stories", "interviewing as a career changer", "what will they ask me", "how do I answer tell me about yourself", "questions to ask the interviewer", "research the company" or "debrief my interview". Uses Reactive Resume MCP tools when connected. For scored role-play practice, mock-interview; for thank-you notes and tracking, job-application-manager; for a salary number, offers or negotiation, offer-negotiation.
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI
job-application-manager
Runs the job-search pipeline. Adds jobs from a link or pasted posting, keeps stages and dates accurate, sets follow-ups, runs a weekly review (stale applications, next actions, funnel stats), records the exact resume version sent, and drafts networking, LinkedIn, referral, recruiter-reply, follow-up, thank-you, status-check, expedite and withdrawal messages without sending them. Use when the user says "add this job to my tracker", "I applied", "log my interview", "I got rejected", "I was ghosted", "log my offer", "track my applications", "do my weekly review", "what should I follow up on", "write a thank-you note", "message this recruiter", "ask for a referral", "withdraw my application", or wants a job-search spreadsheet. Works with a Markdown/CSV tracker or Reactive Resume MCP tools. Not for resume work (resume-tailor, resume-bullet-writer, resume-content-guide), interview prep or practice (interview-prep, mock-interview), or judging, negotiating, accepting or declining an offer (offer-negotiation).
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI
mock-interview
Runs a mock interview for a specific job description. Plays the interviewer in a chosen round (recruiter screen, hiring manager, behavioral, coding, system design, case, product sense, panel), persona and difficulty; asks one question at a time, probes vague answers, and gives quote-backed rubric scores after each answer (coach mode) or at the end (realistic). Model answers use only the user's real experience. Use when the user says "mock interview me", "interview me for this job", "practice interview", "pretend you're the interviewer", "grill me for this role", "run a behavioral round", "quick recruiter screen", "hiring-manager mock", "system design mock" or "case interview practice". With Reactive Resume MCP it reads the application and stories and logs the session. For a story bank, company brief, questions to ask or a real-interview debrief, interview-prep; for scheduling or thank-you notes, job-application-manager; for fixing the resume, resume-tailor; for negotiation practice, offer-negotiation.
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI
offer-negotiation
Evaluates and negotiates job offers. Decodes base, bonus, equity, sign-on, level and terms with unknowns kept unknown and each offer in its own currency, benchmarks against checkable pay data, finds true leverage, drafts one counter as email and call script, role-plays the recruiter, and handles the salary-expectations number, deadlines and extensions, "best and final", competing offers, counteroffers and written acceptance or decline. Country-aware (India CTC, 13th-month pay, public-sector scales). Use when the user says "I got an offer of...", "is this offer good", "should I negotiate", "how do I counter", "compare my offers", "what is my equity worth", "they asked my salary expectations", "they want an answer by Friday", "can I ask for more time", "should I accept" or "practice the negotiation call". Uses Reactive Resume MCP tools when connected. For logging the offer, its deadline and withdrawal notes, job-application-manager; for other interview answers, interview-prep.
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI
resume-builder
Builds a complete resume from scratch as Reactive Resume JSON that conforms to the schema and imports at https://rxresu.me. Asks for each missing detail instead of inventing it, then produces valid JSON (UUIDs, HTML descriptions, template and layout). Use when the user wants to create, build or generate a new resume, turn their work history into Reactive Resume JSON, or asks about the Reactive Resume schema, sections, templates or layout. For what belongs on a resume or a resume audit use resume-content-guide; for rewriting bullets, resume-bullet-writer; for fitting one job posting, resume-tailor; for tracking applications, job-application-manager; for interviews, interview-prep or mock-interview.
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI
resume-bullet-writer
Turns resume duties into truthful impact bullets. Questions the user role by role to dig out achievements, asks for real numbers or honest ranges (never invents them), and writes concise bullets in XYZ, CAR, scope or qualitative form. Use when the user says "rewrite my bullets", "make this bullet stronger", "quantify my resume", "turn my duties into achievements", "improve my experience section", "my resume sounds boring", "I don't have any numbers", pastes resume lines for feedback, or works in a low-number job (nursing, teaching, care, trades, admin, creative). With the Reactive Resume MCP server connected, it edits experience, project, volunteer and education descriptions with apply_resume_patch after the user approves. Use resume-content-guide instead for which sections or details belong and for summaries or headlines, resume-tailor to fit one job posting, interview-prep or mock-interview for interview stories and practice, and resume-builder to build a resume from scratch.
精选 reactive-resume/reactive-resume 4.4 万 原文
Claude CodeCodex CLIGemini CLI