audit-rules
Audits CLAUDE.md and .claude/rules/*.md for stale, contradictory, or over-prompting rules. Surfaces rules untouched for 6+ months and rules that constrain rather than help on current model capability. Outputs a review report and never modifies governance files directly. Use when the user wants to prune, review, or de-bloat rules, or after a model upgrade.
- License 许可
- MIT
- 最近更新
- 2026-10-23
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- audit-rules
- description
- Audits CLAUDE.md and .claude/rules/*.md for stale, contradictory, or over-prompting rules. Surfaces rules untouched for 6+ months and rules that constrain rather than help on current model capability. Outputs a review report and never modifies governance files directly. Use when the user wants to prune, review, or de-bloat rules, or after a model upgrade.
- allowed-tools
- Read, Glob, Grep, Bash, Write, TodoWrite
03 SKILL.md 正文
audit-rules Workflow
Surfaces rules that are stale, redundant, or constrain rather than help the current model. Reads root CLAUDE.md plus every .claude/rules/*.md; writes memories/rules-audit-{YYYY-MM-DD}.md with categorized findings and recommendations. Mutates nothing — the user applies findings manually. Flow: inventory → score → categorize → write report.
Index
| File or section | Read when… |
|---|---|
| When to use / When NOT to use | Deciding whether an audit is due |
| Invocation | Choosing scope and flags (--stale-months, --include-skills, --output) |
| Steps 1–3 | Inventorying files, the five-question score, the KEEP/SHARPEN/MERGE/CUT/MOVE verdicts |
| Step 4: Surface contradictions | The cross-file pass |
| Step 5: Write the report | The report format |
| Step 6: Surface and stop | Ending the run without editing any governance file |
When to use
- Quarterly governance review — Anthropic's large-codebase post recommends every 3–6 months. Rules that helped older models can constrain newer ones.
- After a major model upgrade — old prompts often become dead weight when the underlying model gets smarter.
- When CLAUDE.md feels bloated — slow sessions, ignored rules, contradictory guidance.
- Before a refresh-v3 / framework upgrade — clear the dead weight first so the refresh doesn't preserve obsolete instructions.
Invocation
/audit-rules # Default scope: CLAUDE.md + .claude/rules/*.md
/audit-rules --stale-months 6 # Rules with no git activity in N months get flagged (default 6)
/audit-rules --include-skills # Also audit .claude/skills/*/SKILL.md frontmatter descriptions
/audit-rules --output PATH # Custom output path (default: memories/rules-audit-{date}.md)
Step 1: Inventory
List every governance file:
ls CLAUDE.md .claude/rules/*.md 2>/dev/null
For each file, record:
- Path
- Size (lines, characters)
- Last git activity (
git log -1 --format='%ai' -- <file>) - Whether it was last touched manually or by a refresh/install script
Build the inventory table — used downstream as the audit's working set.
Step 2: Score each rule file
For each rule file, evaluate against the five-question test (the same one BitterPillEngineering applies in PAI):
- Does the model already do this without being told? Example: "Always use proper variable names" — modern Claude does this by default; the rule is dead weight.
- Does this rule contradict another rule in the same file or elsewhere? Example: a CLAUDE.md that says "be concise" and a rule file saying "explain every step verbosely". Pick one.
- Is this rule redundant — same instruction stated twice in different words? Example: "Use Read tool for files" and "Don't use cat for files" — same rule, two surfaces.
- Was this rule written for a specific incident that's now resolved? Example: a rule that says "never use library X" because of a 2024 CVE that was patched in 2025.
- Is this rule vague enough that the model can't act on it? Example: "Write clean code" — no action surface; cut or sharpen with a specific DO/DON'T pair.
A YES to any question is a hit. Multiple hits = stronger recommendation to cut/rewrite.
Step 3: Categorize
Each rule lands in one of these buckets:
| Verdict | Meaning |
|---|---|
| KEEP | Rule is specific, current, non-redundant, and reflects a real constraint or learning the model wouldn't infer. |
| SHARPEN | The intent is good but the wording is vague. Rewrite with concrete DO/DON'T or a worked example. |
| MERGE | Rule overlaps with another rule. Combine into one canonical statement; delete the others. |
| CUT | Rule fails three or more of the five questions, or covers behavior current models do without being told. |
| MOVE | Rule is in the wrong file (e.g., a per-skill convention sitting in root CLAUDE.md). Relocate. |
Step 4: Surface contradictions
Beyond per-rule scoring, run a global pass:
- Does any rule in
.claude/rules/A.mdcontradict a rule in.claude/rules/B.md? - Does any rule contradict the project's
ISA.mdconstraints? - Does any rule reference deprecated tooling, retired model IDs, or removed dependencies?
These cross-file findings go in their own report section — they often produce the highest-value edits.
Step 5: Write the report
Output path: memories/rules-audit-{YYYY-MM-DD}.md (or --output).
Format:
# Rules Audit — {ISO date}
## Inventory
| File | Lines | Last touched | Verdict count |
|---|--:|---|---|
| CLAUDE.md | 312 | 2025-11-12 (6+ months stale) | KEEP: 4 / SHARPEN: 2 / CUT: 1 |
| rules/testing.md | 87 | 2026-04-10 | KEEP: 6 / SHARPEN: 1 |
| ...
## High-priority findings
### CUT
- **CLAUDE.md L42-L46**: rule about manually escaping shell arguments — modern Claude does this by default.
> Quote the rule verbatim.
- ...
### SHARPEN
- **rules/security.md L18**: "always be careful with secrets" — too vague. Rewrite as DO/DON'T:
> DO: read secrets from env vars at session start.
> DON'T: paste a secret value into chat or commit it.
- ...
### MERGE
- **rules/git-workflow.md L9** and **CLAUDE.md L88** both say "create a PR per task". Consolidate in git-workflow.md; cite from CLAUDE.md.
### MOVE
- ...
## Contradictions detected
- **CLAUDE.md L120** says "prefer Bash for git ops" but **rules/git-workflow.md L24** says "use forge.py for all git state changes". Pick one.
## Stale-but-keep notes
Rules that haven't been touched in 6+ months but still pass the five-question test. Listed for awareness, not action.
## Recommended next steps
1. Apply CUT findings (lowest risk, highest token savings)
2. Resolve contradictions (one decision per contradiction)
3. SHARPEN flagged rules in order of how often the session references them
4. MERGE round to consolidate the surface
Estimated rule reduction: N lines (~M tokens per session).
Step 6: Surface and stop
Print a one-paragraph summary to the session: how many findings of each kind, where the report lives, what the user should do next. Then exit. Never edit CLAUDE.md or rules/ files directly — the user reviews and applies recommendations on their own schedule.
When NOT to use
- Right after a
refresh-v3upgrade. Refresh re-installs framework rules; let them settle for a few sessions before auditing. - During an active feature or bug session. The audit is a focused activity; don't interleave with implementation work.
- When
.claude/rules/is empty. The audit needs material; it has nothing to say about a clean install.
See also
/refresh-project-context— refresh the content of CLAUDE.md; this skill audits the quality of its rules./audit-code-map— pairs naturally: audit the rules, then regenerate the code map so the rules and codebase reality are both fresh.- Anthropic, "How Claude Code works in large codebases" — the source advice for the 3–6 month config refresh cadence.
Project-specific overrides: if SKILL.local.md exists in this directory, read it — it is consumer-owned, survives framework refresh, and wins on conflict. A sidecar that relaxes a gate defined above must state how to prove the gate is wrong in that case. Doctrine: rules/framework-vs-project-root.md.
04 同仓库更多 Skills
wizard
Generates an interactive bash wizard that walks a human through steps only they can perform — opens each URL, says what to click and copy, captures values (hidden entry for secrets), writes .env and GitHub secrets, confirms before irreversible actions. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
vet-idea
Vets an idea, decision, or plan BEFORE it is built. Runs a single model through five fixed adversarial advisor roles, a peer-review pass, and a chairman synthesis that emits a halt-capable GO / NO-GO / RECONSIDER verdict. Advisory and non-mutating — outputs a report, never writes task state. Use when an idea, feature, or costly hard-to-reverse decision is of uncertain worth and the question is whether to build it at all. NOT FOR settled work (bug fixes, approved features) or for shaping how to build it (the ISA Interview workflow).
triage-incident
Production incident triage — from "something is broken for users" to fixed, verified, and learned-from. Pulls the error signal (Sentry/logs/user report), reproduces before touching code, routes the fix through /fix-bug's prod fast path, and closes with a postmortem entry. Use when something is broken for users in production — an outage, data corruption, a Sentry spike, or a crash-rate alert. NOT FOR bugs found in development (use /fix-bug directly) or CI failures (use /diagnose-ci).
setup-review-bot
Configures a repo's AI code reviewers — the post-PR mention bot and the pre-push local reviewer — and writes the AGENTS.md the reviewers read. Interviews the user for what the reviewer should weight, then sets git config forge.reviewBot / forge.localReview and populates AGENTS.md at the project root. Use when a repo has no reviewer configured, when review findings are consistently off-target, or when onboarding a new project.
security-review
Portable security review for a feature, endpoint, or change before it ships. Orchestrates the existing OWASP review (@security-boss) and secrets scan (security_secrets validator), then adds the pass they miss — an explicit business-logic-flaw walkthrough (IDOR, race/TOCTOU, state-machine bypass, privilege escalation, price/quantity tampering). Advisory and non-mutating — produces a findings report; real findings are filed as tasks. Use when a change touching money, access control, or multi-step state is about to ship, or when the auth looks fine but the flow could be abused. NOT FOR SAST or dependency-CVE scanning (consumer CI owns those).
run-epic
Autonomously drains every open task in a single epic. Pulls ready tasks via the forge CLI, executes the work in-context using the matching discipline (fix-bug / new-feature / refactor), files newly-discovered work as follow-up tasks without stopping to ask, opens a PR per completed task via /create-pr, and repeats until the epic has zero ready/in-progress/pending tasks. Use when the user says `/run-epic E##`, "run epic autonomously", "finish all remaining tasks for epic X", or "drive epic X to completion".