self-audit
Skill2 starsChanged 6 months agoApache-2.0View on GitHub
Pre-review self-audit of a PR branch: dead struct fields, rotting comments, duplicate types, scope drift — what a human catches but a compiler won't — then dispatches an adversarial agent for deeper design flaws. Use before tagging a reviewer, or after a self-directed refactor.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- helmut-hoffer-von-ankershoffen/heinzeltheir own version, first seen Nov 8, 2026
- 0xUrsanomics/utopia-ostheir own version, first seen Nov 1, 2026
- daichi-0818/claude-code-ops-kittheir own version, first seen Oct 15, 2026
- poa-box/poa-clitheir own version, first seen Jul 31, 2026
- faizkhairi/claude-code-blueprinttheir own version, first seen Jul 3, 2026
- Xxt-XN/agent-self-audittheir own version, first seen Jun 15, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- faizkhairi/claude-code-blueprint★ 73same name
- 0xUrsanomics/utopia-os★ 2same name
- helmut-hoffer-von-ankershoffen/heinzel★ 2same name
- poa-box/poa-cli★ 2same name
- Xxt-XN/agent-self-audit★ 1same name
- daichi-0818/claude-code-ops-kit★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- break-glassSkill
- claim-ledgerSkill
- contract-parity-auditSkill
- counterfactual-auditSkill
- design-doc-reviewSkill
- diagram-gen-emergentSkill
- diagram-gen-specSkill
- doc-triageSkill
- explain-workSkill
- feature-implSkill
- finding-triageSkill
- first-party-auditSkill
- gh-token-rotateSkill
- handoffSkill
- implementSkill
- jj-stackSkill
- linear-escalation-triageSkill
- mache-usageSkill
- park-workSkill
- pr-boardSkill
- pr-bucketsSkill
- prior-art-cartographerSkill
- problem-decomposerSkill
- pr-review-kitSkill
- pr-reviewSkill
- pr-suggestionSkill
- readme-restructureSkill
- repo-description-polishSkill
- repo-homepage-setSkill
- repo-social-previewSkill
- repo-topic-taggerSkill
- review-prepSkill
- review-queueSkill
- reviewSkill
- structural-pr-reviewSkill
- surveySkill
- taskfile-ci-paritySkill
- test-fidelitySkill
- workflow-auditSkill
- work-scopeSkill
- writing-pr-descriptionsSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 10 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Check your own PR like a grumpy reviewer would, before one sees it.
- Distinctive: line 21
After addressing review feedback, before asking a reviewer to look again.
- Distinctive: line 22
After a significant self-directed refactor, before creating the PR.
- Distinctive: line 37
Read the list. For every file, ask: *did I intend to change this?* If anything looks surprising — generated files, unrelated packages, …
- Distinctive: line 56
Delete the field, its extractor, and that test.
- Distinctive: line 139
Subtests vs table-driven: test preferences.
- Distinctive: line 141
If your org runs a policy bot in CI that checks project-specific rules, the CLAUDE.md / convention docs are the local source of truth the …
- Distinctive: line 179
Running the audit, finding nothing, and declaring victory: If the adversarial agent in step 7 also says clean, that's fine.
- Very specific: line 197
If ~/.claude/skills/self-audit/extensions.md exists, read and follow it at the start of Step 6 (project convention check).
- Distinctive: line 205
Never at risk of being committed to a public skills repo.
- Distinctive: line 210
If the extensions file is absent, step 6 is just the generic convention review — the skill degrades gracefully.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
self-audit — Pre-review quality pass
Check your own PR like a grumpy reviewer would, before one sees it.
Your compiler or type-checker and your linter catch the easy stuff. This skill catches the grown-up stuff that slips past both of them.
When to use
- After addressing review feedback, before asking a reviewer to look again.
- After a significant self-directed refactor, before creating the PR.
- Any time you feel "done" but want a second opinion that isn't a human.
Arguments
$ARGUMENTS — optional base branch name. Defaults to main.
Step 1 — Scope sanity
git diff --stat <base>...HEADRead the list. For every file, ask: did I intend to change this? If anything looks surprising — generated files, unrelated packages, formatter drift — stop and investigate before continuing. The rest of this audit is wasted effort if scope is wrong.
Step 2 — Dead struct fields
A field that is written but never read is dead code, and unused-symbol linters
do not catch it — golangci-lint unused counts a field as used as long as
it appears on either side of an =, and most other languages' equivalents
behave the same way.
For every struct field you added, confirm there is a read site outside the place it is written. If the only references are:
- the extractor/constructor that populates it, and
- a test that asserts "this field is non-empty",
...that is circular — the test verifies the field exists, and nothing else cares. Delete the field, its extractor, and that test.
# Rough heuristic — greps for every .FieldName use:
rg '\.FieldName\b' --statsA real non-test, non-self reader is required.
Step 3 — Comments that rot
Comments die when they reference context that fades. Scan for patterns that will be meaningless in six months:
rg -n '@\w+|comment #|round \d+|per the review|commit [0-9a-f]{7,}|\.\w+:\d+|renamed from|formerly|was previously|intentionally|rather than' <changed-files>For each hit ask: will this comment make sense to someone who never saw the PR thread? If no, rewrite. State what the code does, not how it got this way.
Worst offenders, in order of how badly they age:
- Reviewer names in comments ("added per X's suggestion"). People rotate; comments survive.
- Cross-file line numbers ("covers foo.go:123"). Rot the moment anything moves.
- Historical framings ("renamed from X", "formerly Y", "not Z anymore"). Description by negation tells a future reader about a past they don't have.
- "Intentionally" / "deliberately" as defensive filler. If the reason is worth saying, say the reason without the hedge.
- "X rather than Y" where Y never existed in the repo. Compare to alternatives that were actually considered, not to everything you didn't do.
Step 4 — Duplicate or parallel types
# Types with identical field sets (Go shown — swap in your language's
# declaration syntax: class/interface/dataclass/type):
rg -U 'type \w+ struct \{[^}]+\}' <pkg> | sort | uniq -c | awk '$1 > 1'Weaker heuristic that catches more: any time you have an exported and an unexported type with the same shape in the same package, ask "what does exporting buy me that an accessor method wouldn't?" If the answer is nothing, merge them.
Step 5 — Test-only exports
Exported API that only has test callers is either dead or wishful.
For each exported function/method/type added:
# Callers outside test files AND outside the defining file
# (adjust the test-file pattern to your language's convention):
rg -l '\bFunctionName\b' | rg -v '(_test\.go|_test\.py|test_.*\.py|\.(test|spec)\.[jt]sx?)$' | rg -v '<defining-file>'Zero results → it's exported for future use that may never come. Make it unexported unless the future use is imminent.
Step 6 — Project convention check
Most repos state conventions outside the linter config — CLAUDE.md,
AGENTS.md, CONTRIBUTING.md, .cursorrules, team memory files. Generic
linters catch what's universal; these files catch what's local. Read them
and check your diff against them.
# Skim project conventions before checking:
head -200 CLAUDE.md AGENTS.md CONTRIBUTING.md .cursorrules 2>/dev/nullClasses of convention that generic linters miss:
- Test idioms tied to the Go/language version (e.g.
t.Context()overcontext.Background()in Go 1.24+ repos). - Error wrapping conventions (
%wvs%v; when to wrap). - Log framework preferences (project-specific choice of slog / zerolog / internal logger).
- Import-grouping rules beyond what
goimportsenforces. - Private-type + exported-interface return patterns.
- Subtests vs table-driven test preferences.
If your org runs a policy bot in CI that checks project-specific rules, the CLAUDE.md / convention docs are the local source of truth the bot is mirroring. A hit here saves a CI round-trip.
Step 7 — Adversarial agent pass
This is the highest-leverage step and the one you will most want to skip. Don't skip it.
Dispatch an adversarial agent on the diff. A prompt that works:
Here is the diff for branch
<branch>against<base>. Find the fatal disconnect between what the commits claim and what the code actually does. Be mean. Do not give me a sandwich review. If you find nothing, say "clean" — do not manufacture concerns.
Agents worth using for this:
paradigm-assessor— pure adversarial greybeard. Best default.production-readiness-reviewer— framed around ship-blockers.- A general-purpose subagent with the prompt above.
The agent will either:
- Find something you missed → fix it.
- Say clean → push with confidence.
- Raise something wrong → defend your position clearly in writing. That rehearsal is worth more than the finding itself, because you will use it verbatim when the real reviewer asks the same question.
Outputs
This skill produces no artifacts. Findings go straight into commits that fix them, or are explicitly waived (with reasoning) before pushing. Do not write a "self-audit report" file — the commits are the report.
Anti-patterns to avoid
- Running the audit, finding nothing, and declaring victory. If the adversarial agent in step 7 also says clean, that's fine. If you skipped step 7 because steps 1-6 looked good, you have not actually audited.
- Amending previous commits to fold findings in. The stack should still be readable as a sequence of decisions. New commit per finding.
- Hiding the audit in a side branch and squashing away the evidence. The fact that you caught and fixed something is information for the next person (including future you).
Project-specific extensions (optional)
The steps above are deliberately generic so this skill works in any repo.
For invocations tied to a specific work environment — internal style
bots, generated-code verifiers, API-compatibility checkers, policy gates
— keep them out of this SKILL.md and in a private extension file.
Convention
If ~/.claude/skills/self-audit/extensions.md exists, read and follow it
at the start of Step 6 (project convention check). The extensions
file layers environment-specific checks on top of the generic convention
review.
Why this path:
- Lives in the user's personal Claude config, not in any git repo.
- Never at risk of being committed to a public skills repo.
- Survives re-clones and migrations of the agents repo.
- Mirrors the
skills/<name>/structure so multiple skills can each have their own extensions file without collision.
If the extensions file is absent, step 6 is just the generic convention review — the skill degrades gracefully.
Example extension hooks worth adding
- A local runner for a CI-side policy bot (so you catch issues before push).
- A diff-vs-memory comparison (check your diff against rules stated in
repo-level
CLAUDE.mdor team memory files). - Repo-specific dead-code detectors (e.g. proto field usage scanners, Terraform variable reachability checks).
- Credential/secret sweeps specific to the org's token shapes.
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
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.

