Agent skill
audit-documentation
Run a single-session documentation audit on the codebase
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/audit-documentation
SKILL.md
Single-Session Documentation Audit
Pre-Audit Validation
Step 1: Check Thresholds
Run npm run review:check and report results.
- If no thresholds triggered: "⚠️ No review thresholds triggered. Proceed anyway?"
- Continue with audit regardless (user invoked intentionally)
Step 2: Gather Current Baselines
Collect these metrics by running commands:
# Documentation lint
npm run docs:check 2>&1 | tail -30
# Document sync check
npm run docs:sync-check 2>&1 | head -30
# Count documentation files
find docs -name "*.md" 2>/dev/null | wc -l
# Check for broken links
grep -rn "\[.*\](.*\.md)" docs/ --include="*.md" 2>/dev/null | head -20
# Recent doc changes
git log --oneline --since="7 days ago" -- "*.md" | head -10
Step 3: Load False Positives Database
Read docs/audits/FALSE_POSITIVES.jsonl and filter findings matching:
- Category:
documentation - Expired entries (skip if
expiresdate passed)
Note patterns to exclude from final findings.
Step 4: Check Template Currency
Read docs/templates/MULTI_AI_DOCUMENTATION_AUDIT_TEMPLATE.md and verify:
- Document inventory is current
- Template-instance relationships are tracked
- Tier structure is accurate
If outdated, note discrepancies but proceed with current values.
Audit Execution
Focus Areas (7 Categories):
- Broken Links (internal cross-references that 404)
- Stale Content (outdated versions, deprecated info)
- Coverage Gaps (undocumented features, missing guides)
- Tier Compliance (docs in correct folders per tier)
- Frontmatter Consistency (required fields present)
- Template-Instance Sync (templates match instances)
- Content Quality (coherence, bloat, contradictions, flow)
For each category:
- Search relevant files using Grep/Glob
- Identify specific issues with file:line references
- Classify severity: S0 (Critical - blocks work) | S1 (Major - causes confusion) | S2 (Minor) | S3 (Trivial)
- Estimate effort: E0 (trivial) | E1 (hours) | E2 (day) | E3 (major)
- Assign confidence level (see Evidence Requirements below)
Documentation Checks:
- All
[text](path.md)links resolve - Version numbers in docs match package.json
- Dates in "Last Updated" are reasonable
- Required sections present (Purpose, Usage, etc.)
- No placeholder content ([TODO], [PLACEHOLDER], [X])
- Archive docs properly excluded from lint
Content Quality Checks (Category 7):
- No circular documentation (A→B→C→A reference loops that confuse readers)
- No redundant/duplicate content across documents
- No contradictory information (conflicting guidance for same task)
- Documentation narrative is cohesive and flows logically
- Document relationships are navigable (clear paths to related content)
- No bloated content (overly verbose, could be condensed)
- Consistent terminology across documents
- No orphaned docs (no incoming links, unclear purpose)
Scope:
- Include:
docs/,README.md,ROADMAP.md,ARCHITECTURE.md,DEVELOPMENT.md - Exclude:
node_modules/,.next/
Evidence Requirements (MANDATORY)
All findings MUST include:
- File:Line Reference - Exact location (e.g.,
docs/guides/auth.md:45) - Content Snippet - The actual problematic content (broken link, stale text)
- Verification Method - How you confirmed this is an issue (link check, grep, file stat)
- Impact Description - Who is affected and how (users, developers, onboarding)
Confidence Levels:
- HIGH (90%+): Confirmed by tool (docs:check, link checker), verified file exists, issue reproducible
- MEDIUM (70-89%): Found via pattern search, file verified, but no tool confirmation
- LOW (<70%): Pattern match only, needs manual verification
S0/S1 findings require:
- HIGH or MEDIUM confidence (LOW confidence S0/S1 must be escalated)
- Dual-pass verification (re-read the content after initial finding)
- Cross-reference with docs:check or docs:sync-check output
Cross-Reference Validation
Before finalizing findings, cross-reference with:
- docs:check output - Mark findings as "TOOL_VALIDATED" if linter flagged same issue
- docs:sync-check output - Mark sync findings as "TOOL_VALIDATED" if sync checker flagged
- git log - Mark stale findings as "TOOL_VALIDATED" if last modified date confirms staleness
- Prior audits - Check
docs/audits/single-session/documentation/for duplicate findings
Findings without tool validation should note: "cross_ref": "MANUAL_ONLY"
Dual-Pass Verification (S0/S1 Only)
For all S0 (blocks work) and S1 (causes confusion) findings:
- First Pass: Identify the issue, note file:line and initial evidence
- Second Pass: Re-read the actual content in context
- Verify the documentation issue is real
- Check if content was recently updated
- Confirm file and line still exist
- Decision: Mark as CONFIRMED or DOWNGRADE (with reason)
Document dual-pass result in finding: "verified": "DUAL_PASS_CONFIRMED" or
"verified": "DOWNGRADED_TO_S2"
Output Requirements
1. Markdown Summary (display to user):
## Documentation Audit - [DATE]
### Baselines
- Total docs: X files
- docs:check errors: X
- docs:sync-check issues: X
- Docs changed (7 days): X
### Findings Summary
| Severity | Count | Category | Confidence |
| -------- | ----- | -------- | ----------- |
| S0 | X | ... | HIGH/MEDIUM |
| S1 | X | ... | HIGH/MEDIUM |
| S2 | X | ... | ... |
| S3 | X | ... | ... |
### Broken Links
1. [source.md:line] -> [target.md] (missing) - TOOL_VALIDATED
2. ...
### False Positives Filtered
- X findings excluded (matched FALSE_POSITIVES.jsonl patterns)
### Stale Documents
1. [file.md] - Last updated X days ago, references deprecated feature
2. ...
### Coverage Gaps
- Feature X has no documentation
- ...
### Recommendations
- ...
2. JSONL Findings (save to file):
Create file: docs/audits/single-session/documentation/audit-[YYYY-MM-DD].jsonl
Each line (UPDATED SCHEMA with confidence and verification):
{
"id": "DOC-001",
"category": "Links|Stale|Coverage|Tier|Frontmatter|Sync|Quality",
"severity": "S0|S1|S2|S3",
"effort": "E0|E1|E2|E3",
"confidence": "HIGH|MEDIUM|LOW",
"verified": "DUAL_PASS_CONFIRMED|TOOL_VALIDATED|MANUAL_ONLY",
"file": "docs/path/to/file.md",
"line": 123,
"title": "Short description",
"description": "Detailed issue",
"recommendation": "How to fix",
"evidence": ["broken link text", "grep output", "git log output"],
"cross_ref": "docs_check|docs_sync|git_log|MANUAL_ONLY"
}
3. Markdown Report (save to file):
Create file: docs/audits/single-session/documentation/audit-[YYYY-MM-DD].md
Full markdown report with all findings, baselines, and fix plan.
Post-Audit Validation
Before finalizing the audit:
-
Run Validation Script:
bashnode scripts/validate-audit.js docs/audits/single-session/documentation/audit-[YYYY-MM-DD].jsonl -
Validation Checks:
- All findings have required fields
- No matches in FALSE_POSITIVES.jsonl (or documented override)
- No duplicate findings
- All S0/S1 have HIGH or MEDIUM confidence
- All S0/S1 have DUAL_PASS_CONFIRMED or TOOL_VALIDATED
-
If validation fails:
- Review flagged findings
- Fix or document exceptions
- Re-run validation
Post-Audit
- Display summary to user
- Confirm files saved to
docs/audits/single-session/documentation/ - Run
node scripts/validate-audit.json the JSONL file - Validate CANON schema (if audit updates CANON files):
bashEnsure all CANON files pass validation before committing.
npm run validate:canon - Update AUDIT_TRACKER.md - Add entry to "Documentation Audits" table:
- Date: Today's date
- Session: Current session number from SESSION_CONTEXT.md
- Commits Covered: Number of commits since last documentation audit
- Files Covered: Number of documentation files analyzed
- Findings: Total count (e.g., "2 S1, 4 S2, 3 S3")
- Confidence: Overall confidence (HIGH if majority HIGH, else MEDIUM)
- Validation: PASSED or PASSED_WITH_EXCEPTIONS
- Reset Threshold: YES (single-session audits reset that category's threshold)
- Update Technical Debt Backlog - Re-aggregate all findings:
bashThis updates
npm run aggregate:audit-findingsdocs/aggregation/MASTER_ISSUE_LIST.mdand the Technical Debt Backlog section inROADMAP.md. Review the updated counts and ensure new findings are properly categorized. - Ask: "Would you like me to fix any of these documentation issues now?"
Threshold System
Category-Specific Thresholds
This audit resets the documentation category threshold in
docs/AUDIT_TRACKER.md (single-session audits reset their own category;
multi-AI audits reset all thresholds). Reset means the commit counter for this
category starts counting from zero after this audit.
Documentation audit triggers (check AUDIT_TRACKER.md):
- 20+ doc files changed since last documentation audit, OR
- 30+ commits since last documentation audit
Multi-AI Escalation
After 3 single-session documentation audits, a full multi-AI Documentation Audit is recommended. Track this in AUDIT_TRACKER.md "Single audits completed" counter.
Adding New False Positives
If you encounter a pattern that should be excluded from future audits:
node scripts/add-false-positive.js \
--pattern "regex-pattern" \
--category "documentation" \
--reason "Explanation of why this is not a documentation issue" \
--source "AI_REVIEW_LEARNINGS_LOG.md#review-XXX"
⚠️ Update Dependencies
When updating this command (categories, checklist items), also update:
| Document | What to Update | Why |
|---|---|---|
docs/templates/MULTI_AI_DOCUMENTATION_AUDIT_TEMPLATE.md |
Category list, checklist structure | Multi-AI version of this audit |
docs/SLASH_COMMANDS_REFERENCE.md |
/audit-documentation section |
Documentation of this command |
Why this matters: This is the single-session version of the documentation audit. Category changes should stay synchronized with the multi-AI template.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?