borghei/doc-drift-detector
> Detect documentation drift against code changes, score staleness, validate API docs via AST parsing, and audit link integrity. Use when docs fall out of sync with code, preparing releases, running CI doc gates, or auditing doc accuracy.
npx skills add https://github.com/borghei/Claude-Skills --skill doc-drift-detector
The agent detects documentation drift by mapping code directories to their docs, comparing git modification histories, extracting Python function signatures via AST, validating every markdown link and anchor, and scoring freshness on a weighted 0-100 scale. All four CLI tools use the Python standard library only.
[AUTO]/[SEMI]/[MANUAL] for fix routing.Before running detection, confirm these inputs. If any is unknown or vague, ASK — do not assume:
drift_analyzer.py vs doc_staleness_scorer.py vs api_doc_validator.py vs link_checker.py)--min-severity/--threshold and the exit-code gate)Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
| Tool | Purpose | Command |
|------|---------|---------|
| drift_analyzer.py | Full drift analysis between code and docs | python scripts/drift_analyzer.py <repo> --min-severity high --json |
| doc_staleness_scorer.py | Score documentation freshness 0-100 | python scripts/doc_staleness_scorer.py <repo> --threshold 60 |
| api_doc_validator.py | Validate API docs against Python source (AST) | python scripts/api_doc_validator.py <src> <docs> --recursive |
| link_checker.py | Audit all markdown links and anchors | python scripts/link_checker.py <repo> --broken-only |
All tools: Python 3.8+ stdlib only, --json and --help, non-zero exit codes for CI, any OS.
Load the reference that matches the task — keep this file lean and pull detail on demand:
| Asset | Description |
|-------|-------------|
| Drift Report Template | Template for drift analysis reports |
| Sample Drift Data | Sample JSON for testing and demonstration |
Covers:
Does NOT cover:
--check-external performs one-shot HEAD requests but does not provide continuous monitoring; use the senior-devops skill for uptime dashboards[AUTO], [SEMI], or [MANUAL] but do not generate replacement text; use the code-reviewer skill for AI-assisted doc suggestions| Skill | Integration | Data Flow |
|-------|-------------|-----------|
| code-reviewer | Include drift report in PR review comments | drift_analyzer.py --json output feeds into review checklists as a documentation health section |
| senior-devops | Add staleness gate to CI/CD pipelines | doc_staleness_scorer.py --threshold 50 returns exit code 1 on failure, blocking deploys |
| senior-qa | Documentation quality as part of QA acceptance | link_checker.py --json output merges into QA dashboards alongside test coverage metrics |
| senior-fullstack | Validate generated project docs post-scaffold | Run api_doc_validator.py against scaffolded docs/ directory to confirm generated API docs match source |
| senior-secops | Audit security documentation currency | drift_analyzer.py --scope security/ detects when security docs fall behind policy changes |
| senior-architect | Architecture decision record (ADR) freshness | doc_staleness_scorer.py --required-sections "Status,Context,Decision,Consequences" validates ADR completeness |
Take borghei/doc-drift-detector from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.