From code-doc-audit
Audit documentation and inline comments against the current code for **concept, design, and implementation accuracy**. Verifies that the behaviors, business rules, file/test inventories, and CLI flags described in markdown and source comments still match what the code does — and surfaces key concepts present in the code but missing from the docs. Use when the user asks for a "thorough code base analysis against documentation", a "doc audit", to "make sure docs align with the code conceptually", or after a feature/refactor that changes behavior. For pure file:line / code-snippet drift, use **doc-sync** instead (this skill explicitly does NOT re-check line numbers). Repeat rounds until a full pass finds no further changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-doc-audit:code-doc-auditThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Verify that every markdown file and every inline source comment describes the codebase **accurately and comprehensively** at the level of **concepts, design, and behavior** — and add documentation for key behaviors that exist in code but aren't documented.
Verify that every markdown file and every inline source comment describes the codebase accurately and comprehensively at the level of concepts, design, and behavior — and add documentation for key behaviors that exist in code but aren't documented.
Scope boundary. This skill deliberately does not check file:line references or whether quoted code snippets match the current source character-for-character. Those checks belong to doc-sync. If a stale line number is the only problem, this skill should leave it alone and (optionally) note that doc-sync should be re-run. Conversely, if a code snippet's meaning has drifted from current behavior (inverted condition, removed branch, renamed concept), that is in scope here — fix the description regardless of whether the line number is right.
Pair with doc-sync afterward for the file:line / snippet check.
# Production source
find . -name "*.go" -not -path "*/.git/*" -not -name "*_test.go" | sort
# Test source
find . -name "*_test.go" -not -path "*/.git/*" | sort
# All markdown
find . -name "*.md" -not -path "*/.git/*" -not -path "*/.claude/*" | sort
Map the result. You should know: every package, every test file, every markdown file, and which exported symbols exist in each.
If the user implies "since the last audit", inspect recent commits and git status for modified files. Pay special attention to changes that move semantics:
Run git log --since="2 weeks ago" --oneline and skim recent commits for "fix", "refactor", "replace", "rename", "remove" — those are the high-signal signals for doc drift.
Many docs include directory trees or test-file tables. For each tree/table entry, confirm the file exists and the description still matches.
# Find inventory-style mentions (directory trees and test tables)
grep -rn "├──\s*[a-z_.-]*\.go\|^\s*-\s*\`[a-z_-]*\.go\`" docs/ README.md QUICKSTART.md
# For each claimed file, verify
ls path/to/claimed/file
Common drifts:
├──) drifted because the file's role changed.Fix by removing stale rows, updating descriptions, or adding new rows for new files. If coverage moved to a different file, add a one-sentence pointer rather than just removing.
For each markdown paragraph that describes program behavior — caching policy, rate-limit handling, error fallbacks, timezone rules, query types, etc. — open the source and confirm the claim is still true. Watch for:
MarkAPICall) cited where the code now uses the new name (RecordAPICall).last_api_call file holds the timestamp" when the marker has been replaced by a sliding-window log.Be skeptical of behavioral examples in docs. Trace at least one execution path through the code for each behavior the docs claim. If the meaning has drifted, rewrite the description — even if the line number reference happens to still be correct.
grep -n "BoolVar\|StringVar\|IntVar\|Float64Var" internal/cli/flags.go
For each flag, confirm:
--debug, --continuous, --true-up) has a dedicated subsection in README or ARCHITECTURE showing what it does and when to use it.A concept counts as "key" if at least one of these is true:
cacheMaxAge, QueryCost, RemainingBudget).For each key concept, check if it appears in:
README.md (user-facing)docs/ARCHITECTURE.md (designer-facing)If the concept is undocumented or only mentioned in passing, add a section in the most appropriate doc explaining:
Prefer adding to the doc that already discusses adjacent concepts (e.g. add a new throttle rule to the existing "Rate Limiting" section, not to a fresh section). Don't create new top-level files unless absolutely necessary.
# Find inline comments that describe behavior, magnitudes, or cross-references
grep -rn "// .*[0-9]\+ lines\|// .*TODO\|// .*FIXME\|// .*\.go" internal/ main.go
# Find package doc comments (// Package foo …) and skim for stale claims
grep -rn "^// Package " internal/ main.go
Spot-check comments that:
Comments that simply restate the code below (// Set x to 5 above x = 5) are not in scope — flag those for removal separately if egregious, but the focus here is meaning drift, not redundancy.
Edit in priority order, smallest blast radius first:
| Issue | Action |
|---|---|
| Stale file in inventory | Remove the entry; add prose pointing to where the coverage now lives if appropriate |
| Stale concept description | Rewrite to current behavior |
| Stale magnitude / count | Update if significantly off; leave if still approximate |
| Stale inline comment | Update or delete |
| Missing concept | Add a subsection in the most appropriate doc |
| Stale CLI flag | Sync README's CLI list with internal/cli/flags.go |
When rewriting a paragraph, preserve the structure of the surrounding doc (headings, table format, bullet style) so the diff stays minimal and reviewable.
go build ./...
go test ./...
The build catches stale exported names referenced in code that I forgot to update. Tests catch behavioral regressions if I accidentally edited code while editing comments.
Go back to Step 3. Keep iterating until a full round produces zero changes.
Termination: stop only when a complete pass finds nothing to fix and
go test ./...is green. A round that fixes items must be followed by a verification round.
After this skill finishes, line numbers and code snippets may now be drifted because doc text shifted around. Suggest the user run /doc-sync next to mop up file:line and snippet drift.
When done, summarize for the user in this shape:
**Stale concepts fixed:**
| File | Was | Now |
| ... | ... | ... |
**Missing concepts added:**
| File | Concept | Section |
| ... | ... | ... |
**Inventory fixes:**
| File | Change |
| ... | ... |
**Tests:** clean.
Recommend running /doc-sync next to verify file:line refs.
Keep the summary terse — the diff is the proof of work. Do NOT include line-number changes in this summary; if line numbers happen to shift, that's doc-sync's territory.
internal/cli/flags.go without a corresponding entry in README's flag list or a dedicated subsection explaining the output.--debug / log-format samples in docs drifting from what the code actually prints.# Recently modified production code (likely sources of doc drift)
git log --since="2 weeks ago" --name-only --pretty=format: -- '*.go' | grep -v _test.go | sort -u | grep -v '^$'
# Inventory-style file mentions in docs
grep -rn "├──\s*[a-z_.-]*\.go\|^\s*-\s*\`[a-z_-]*\.go\`" docs/ README.md
# Exported symbols added recently (potential undocumented concepts)
git log --since="2 weeks ago" -p -- '*.go' | grep -E "^\+func [A-Z]|^\+type [A-Z]|^\+const [A-Z]|^\+var [A-Z]" | sort -u
# CLI flags currently defined
grep -n "BoolVar\|StringVar\|IntVar" internal/cli/flags.go
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.
npx claudepluginhub yhuang/my-claude-skills --plugin code-doc-audit