Audit and improve AGENTS.md project instructions (and legacy CLAUDE.md). Use when the user asks to check, audit, update, improve, fix, restructure, or clean up AGENTS.md / CLAUDE.md, or mentions "agent memory", "project memory", "project instructions", "instruction file", "instruction maintenance", "instruction structure", or filenames like AGENTS.md, agents.md, CLAUDE.md. Scans the repo, evaluates quality against a rubric, prints a report, and proposes targeted edits. When the repo still uses CLAUDE.md only, also proposes migrating to AGENTS.md. Arguments: none (full audit), "recent" (scope to the last 5 commits), "last <N> commits", or "since <ref>" — scoped runs skip rubric scoring and propose only updates surfaced by that commit range (e.g. "audit recent changes", "update AGENTS.md for the last 3 commits").
Ships in instructions-audit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Goal: keep instruction files complete enough that agents rarely need Explore subagents or ad-hoc Glob/Grep/Read searches to find what's already documented.
Audit, evaluate, and improve project instruction files (AGENTS.md by default; legacy CLAUDE.md is recognized) so any agent reading the repo has accurate, useful project context.
AGENTS.md (the agents.md convention) is portable across agent CLIs — Claude Code, Codex, Cursor, and others. CLAUDE.md is Claude Code's legacy filename; this skill keeps it working through migration.
This skill writes to instruction files. It always prints a quality report and proposes diffs before editing, and waits for user approval.
Parse the argument first:
recent → scoped mode, last 5 commits.last <N> commits → scoped mode, last N commits.since <ref> → scoped mode, <ref>..HEAD.Fold only what a specific commit range surfaced into the instruction files — no rubric, no full-repo assessment. Use full audit for periodic maintenance; use scoped mode right after landing a batch of commits.
Resolve the range. BASE=HEAD~5 for recent, HEAD~N, or the given
<ref>. If the repo has fewer commits than requested, clamp BASE to the
root commit (git rev-list --max-parents=0 HEAD). Collect:
git log --oneline $BASE..HEAD
git diff --name-status $BASE..HEAD
If the range is empty, say so and offer the full audit — never silently fall back to one.
Discover instruction files exactly as in Phase 1 below. Still flag a
legacy-CLAUDE.md-only setup (that's currency of the setup, not of
content), but only propose migration — never bundle it into the scoped
edits.
Derive candidate updates from the range only. Read the diffs and commit messages for:
Print a Scoped Audit report — the range audited, per-file proposed diffs (Phase 4 diff format) each with a one-line why citing the commit that surfaced it, and an explicit note that nothing outside the range was checked.
Skip the sub-skills. instructions-revise and
instructions-restructure are full-audit concerns; scoped mode proposes
its own diffs directly.
Apply only after approval, as in Phase 5.
Find every project instruction file under the working tree, ignoring noise dirs:
find . \( -name "AGENTS.md" -o -name "CLAUDE.md" -o -name ".claude.local.md" \) \
-not -path '*/node_modules/*' -not -path '*/.git/*' \
-not -path '*/.venv/*' -not -path '*/dist/*' -not -path '*/build/*' \
2>/dev/null | sort
Group results by directory and classify each directory's state:
| State | Meaning | Action |
|---|---|---|
| AGENTS.md only | Canonical setup | Audit normally (Phase 2+) |
| CLAUDE.md only | Legacy setup | Audit, then run Phase 1.5 — Migration |
| Both, CLAUDE.md is a stub | Already migrated (CLAUDE.md contains only @AGENTS.md + header) | Audit AGENTS.md only |
| Both, both have content | Drift — two sources of truth | Audit both, flag drift, propose consolidation |
| Neither | No agent memory yet | Optionally offer to scaffold AGENTS.md |
File types & locations:
| Type | Location | Purpose |
|---|---|---|
| Project root | ./AGENTS.md | Primary project context (checked into git) |
| Local overrides | ./.claude.local.md | Personal/local settings (gitignored) |
| Global defaults | ~/.claude/CLAUDE.md or ~/.codex/AGENTS.md | User-wide defaults |
| Package-specific | ./packages/*/AGENTS.md | Module-level context in monorepos |
| Subdirectory | Any nested location | Feature/domain-specific context |
Most agents auto-discover instruction files in parent directories, so monorepo nesting works automatically.
CLAUDE.md is present)See references/migration.md for full recipes and rationale.
You must present both options every time — even if one feels obviously better for this repo. The trade-off depends on whether the user is still using Claude Code, which only they know. Picking unilaterally robs them of that decision.
When a directory has CLAUDE.md but no AGENTS.md:
AGENTS.md, then replace CLAUDE.md with a @AGENTS.md stub so Claude Code keeps auto-loading the same content. One source of truth, both worlds happy.git mv CLAUDE.md AGENTS.md. Single file. Use when the user is moving off Claude Code or doesn't rely on Claude Code's auto-load of CLAUDE.md.Show both. Explain the trade-off. End with an explicit "Option A or B?" question before doing anything.
Apply the user's choice across all legacy CLAUDE.md files in the repo consistently — do not mix strategies.
For each instruction file, score against the rubric. See references/quality-criteria.md for the full rubric.
Quick checklist:
| Criterion | Weight | Check |
|---|---|---|
| Commands/workflows | High | Build / test / deploy / dev commands present? |
| Architecture clarity | High | Can a fresh agent grasp the codebase shape? |
| Non-obvious patterns | Medium | Gotchas and quirks documented? |
| Conciseness | Medium | No filler, no restating-the-obvious? |
| Currency | High | Matches current codebase state? |
| Actionability | High | Instructions executable, paths real? |
Grades: A (90–100), B (70–89), C (50–69), D (30–49), F (0–29).
Always print the report before proposing edits.
## Agent Memory Quality Report
### Summary
- Files found: X (AGENTS.md: N, CLAUDE.md: M)
- Average score: X/100
- Files needing update: X
- Legacy CLAUDE.md files needing migration: X
### File-by-File Assessment
#### 1. ./AGENTS.md (Project Root)
**Score: XX/100 (Grade: X)**
| Criterion | Score | Notes |
|---|---|---|
| Commands/workflows | X/20 | ... |
| Architecture clarity | X/20 | ... |
| Non-obvious patterns | X/15 | ... |
| Conciseness | X/15 | ... |
| Currency | X/15 | ... |
| Actionability | X/15 | ... |
**Issues:** ...
**Recommended additions:** ...
#### 2. ./packages/api/CLAUDE.md (Legacy — migration proposed)
...
Default: run both sub-skills before proposing inline edits.
After the report in Phase 3, invoke each sub-skill via the Skill tool (in order):
instructions-revise — capture anything new discovered this session.instructions-restructure — move any misplaced content to its correct depth.Then handle any residual updates inline as described below.
Honor user skip phrases — if the user's original prompt or a follow-up says "skip revise" / "no revision" / "don't capture learnings" (or the equivalent for restructure), omit that sub-skill and note the skip in the report. If the user says "audit only" or similar, skip both.
After the report, propose edits and ask for confirmation. Two kinds of changes:
git mv CLAUDE.md AGENTS.md and (option A only) writing the stub.See references/update-guidelines.md for what to add and what to skip.
Diff format (content update):
### Update: ./AGENTS.md
**Why:** Build command was missing — fresh sessions had to inspect `package.json` to find it.
```diff
+ ## Commands
+
+ | Command | Description |
+ |---|---|
+ | `npm install` | Install deps |
+ | `npm run dev` | Dev server on port 3000 |
+ | `npm test` | Vitest suite |
```
Diff format (migration — always present both options):
### Migrate: ./CLAUDE.md → ./AGENTS.md
**Why:** Switch to the cross-agent standard. Pick one strategy and apply it repo-wide.
**Option A — Migrate + stub** *(recommended)*
```bash
git mv CLAUDE.md AGENTS.md
```
Then write `CLAUDE.md`:
```markdown
<!-- DO NOT EDIT — see AGENTS.md -->
@AGENTS.md
```
Claude Code auto-loads the stub → `@`-references inline `AGENTS.md` → same content. Other agents read `AGENTS.md` directly.
**Option B — Rename only**
```bash
git mv CLAUDE.md AGENTS.md
```
Trade-off: Claude Code no longer auto-loads the file. Fine if you're moving off Claude Code; a foot-gun otherwise.
**Which option do you want?** (A or B)
After user approval, apply edits with Edit / Write / Bash (for git mv). Preserve existing content structure; do not reorder sections gratuitously.
See references/templates.md for AGENTS.md templates by project type.
CLAUDE.md without AGENTS.md — migration candidateCLAUDE.md and AGENTS.md — two sources of truthmcp/, packages/api/), it belongs in that directory's own AGENTS.md, not root. Root detail bloats every session regardless of task. Handled by the instructions-restructure sub-skill in Phase 4.@subdir/AGENTS.md references — when a subdirectory has its own AGENTS.md, root should reference it with @subdir/AGENTS.md so agents know where to look without loading the content until they're in that directory. Handled by the instructions-restructure sub-skill in Phase 4.## Memory vs. State section, suggest adding the standard snippet (AGENTS.md = north star for stable decisions, docs/STATE.md = session bookmarks updated frequently).When presenting recommendations, remind the user:
# shortcut (Claude Code): press # mid-session to have the agent auto-incorporate learnings into the instruction file..claude.local.md for personal preferences not shared with the team (gitignored).~/.claude/CLAUDE.md or ~/.codex/AGENTS.md.Key principles:
<subdir>/AGENTS.md. Root references subdirectories with @subdir/AGENTS.md — this defers loading until an agent actually works in that area.Recommended sections (use only what's relevant):
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/instructions-audit:instructions-auditfrom instructions-audit
npx claudepluginhub dotknewt/awesome-agency --plugin instructions-audit2 plugins in one repository ship this exact skill · first indexed Aug 30, 2026