From utils
Analyze changes and propose CLAUDE.md updates. Accepts an optional argument describing what changed (e.g., `/claude-md we switched from Jest to Vitest`). Use when the user says "update claude.md", "sync claude.md", "document this in claude.md", after finishing a task that introduced new patterns or conventions, when new tools/commands/dependencies were added, or when project architecture changed. Do NOT trigger for simple questions about CLAUDE.md content, reading CLAUDE.md, or general project questions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/utils:claude-mdThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze session changes and propose targeted CLAUDE.md updates following Anthropic's best practices.
Analyze session changes and propose targeted CLAUDE.md updates following Anthropic's best practices.
npm test" not "Tests are run with npm test"Gather information from three sources, in priority order:
A. User-provided description — If $ARGUMENTS is non-empty, treat it as the primary input describing what changed. Use it to frame the update. You may still run selective git commands from (B) to corroborate details, but the user's framing takes precedence.
B. Git session changes — When $ARGUMENTS is empty, or as a supplement to (A), run these commands (skip if not a git repo):
git branch --show-current — current branchgit diff HEAD — unstaged changesgit diff --staged — staged changesgit log --oneline -10 — recent commitsgit merge-base HEAD main (or the default branch) — find where the branch divergedgit diff <merge-base>..HEAD — all committed changes in this sessionC. Conversation context — Always review the conversation for discussed decisions, patterns, tooling choices, or conventions that may not appear in diffs (e.g., "we decided to use Zod for validation", "prefer named exports").
Merge all sources. When the user description (A) conflicts with git (B), prefer the user's framing.
Look for CLAUDE.md at the project root. If found:
If no CLAUDE.md exists, note that a new file needs to be created.
Evaluate the session diff against the trigger categories in the table below. For each category, determine if the changes warrant a CLAUDE.md entry.
If no triggers fire — tell the user "No CLAUDE.md update needed — these changes don't introduce anything that would surprise a future agent." and stop.
If creating a new CLAUDE.md, use this section template (omit sections that have no content):
If updating an existing CLAUDE.md, draft only targeted additions or edits to existing sections. Do not rewrite sections that are unchanged.
Writing rules for all entries:
Show the complete draft to the user, then use AskUserQuestion with these options:
Apply the approved changes to CLAUDE.md at the project root. After writing, confirm the action and report the final line count.
| Category | Fires when | Does NOT fire when |
|---|---|---|
| Commands | New build/test/lint/deploy commands added, existing commands changed, new scripts in package.json | Existing commands used without changes |
| Tech Stack | New language, framework, or major dependency added; runtime version changed | Minor dependency updates, patch bumps |
| Architecture | New top-level directories, new module boundaries, new API patterns, significant structural refactors | Moving files within existing structure, renaming |
| Code Style | New lint rules enforced, new naming conventions established, new formatting config | One-off style fixes, auto-formatter runs |
| Environment | New env vars required, new services to run locally, new setup steps | Config value changes, port number tweaks |
| Gotchas | Non-obvious workarounds discovered, surprising behavior documented, platform-specific quirks | Obvious bugs that were fixed, temporary hacks removed |
| Testing | New test framework, new test commands, new coverage requirements, testing patterns established | Adding individual test files, fixing tests |
| Project Overview | Project purpose or scope changed significantly, new major feature area | README updates, minor scope adjustments |
Before presenting the draft in Step 5, verify:
npx claudepluginhub mrstroz/claude-code-plugins --plugin utilsUpdates CLAUDE.md files with non-obvious conventions and gotchas from staged git changes. Activates on user requests like 'update CLAUDE.md' or significant code modifications.
Creates or updates CLAUDE.md following best practices: WHAT/WHY/HOW structure, 30-300 line limits, progressive disclosure with doc references, pointers over copies, verified commands.
Updates, refreshes, optimizes, and cleans up CLAUDE.md by exploring codebase, removing stale content, and restructuring for scannability. Use when docs are out of sync.