Context doctor
Audit project documentation for context engineering best practices. Use when the user asks about documentation quality, when AGENTS.md or CLAUDE.md feels bloated or duplicated, when setting up a new project's agent documentation, or when the user wants to optimize their context window usage. Also use when the user says things like "my agent keeps reading too many files", "context is getting wasted on docs", "how should I structure my CLAUDE.md", "audit my docs", or "check my AGENTS.md files". Even if the user doesn't say "context" — if they're complaining about agent efficiency or documentation sprawl, this skill should activate.From its SKILL.md
npx -y skills add KitsuneKode/agent-skills --skill context-doctorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.9 KB, as published. Nobody here has run it
Context Doctor
Audit a project's documentation structure for context engineering best practices. Finds waste, duplication, and misplaced content so agents spend tokens on work, not re-reading redundant docs.
Why this matters: Every line in CLAUDE.md, AGENTS.md, and .claude/rules/
is loaded into the agent's context window. Bloated or duplicated docs mean agents
start every session with less room for actual work. This skill finds the waste
and tells you exactly what to move, merge, or delete.
When This Skill Activates
- User asks about documentation quality or structure
- CLAUDE.md or AGENTS.md feels bloated
- Setting up agent docs for a new project
- User wants to optimize context window usage
- User invokes
/context-doctordirectly
Audit Process
Step 1: Run the Mechanical Checks
Run the audit script if available:
bash <skill-path>/scripts/audit.sh
This checks:
- CLAUDE.md line count (warn if >50 lines)
@importvalidation (broken references).context/gitignore check- AGENTS.md file count
- Duplicated keywords across AGENTS.md files
If the script isn't available, do these checks manually with grep/wc.
Step 2: Semantic Analysis
Read each AGENTS.md and CLAUDE.md file. Look for:
Duplication
Facts repeated across multiple files. Common offenders:
- "X is a stub/scaffold" appearing in both root and workspace AGENTS.md
- Read order / navigation instructions in multiple places
- Template surface lists duplicated across docs
- Command references (dev, build, test) in multiple files
For each duplicate, identify the single source of truth — the one file where this fact naturally belongs. The others should reference it, not repeat it.
Misplaced Content
Content that's in the wrong file:
- Workspace-specific guidance in root CLAUDE.md — should be in
.claude/rules/withpaths:frontmatter so it only loads when relevant - Stable topology in AGENTS.md — this is fine, AGENTS.md is the right place
- Behavioral rules in AGENTS.md — should be in
.claude/rules/ - Commands and env vars in docs/ — should be in root AGENTS.md (single source)
Bloat
Content that shouldn't be in always-loaded context at all:
- Long explanations that the agent can derive from reading the code
- Historical context that's in git history
- Verbose examples when a one-liner would do
- README content that serves human readers, not agents
Step 3: Generate Report
Output a structured report:
# Context Doctor Report
## Summary
- X AGENTS.md files found
- CLAUDE.md is Y lines (target: <50)
- Z duplicated facts found
- N broken @imports
## Findings
### Critical (fix now)
- [finding with specific file:line references]
### Recommended (improve quality)
- [finding with specific suggestions]
### Optional (nice to have)
- [finding]
## Suggested Actions
1. [Specific action with before/after]
2. [Specific action]
Step 4: Offer to Fix
After presenting the report, ask if the user wants you to apply the
recommendations. If yes, make the changes and verify with bun run repo:doctor
or equivalent.
What Good Looks Like
CLAUDE.md (~20-50 lines):
- Navigation pointers (read AGENTS.md first, then docs/)
- Project-specific rules the agent can't derive from code
@importreferences for lazy-loaded context- Session handoff reference (if using session-handoff skill)
Root AGENTS.md (topology + routing):
- Workspace map (what lives where)
- Commands (dev, build, test, lint)
- Env vars and secrets
- Commit conventions
Workspace AGENTS.md (per-package):
- What this package does (one paragraph)
- Key files and their roles
- Package-specific patterns or gotchas
.claude/rules/ (conditional context):
- Path-scoped rules that only load when working in specific directories
- Example: tRPC patterns only load when touching
packages/trpc/**
Anti-patterns
- CLAUDE.md as a novel: If it's over 50 lines, most of it should move
- Copy-paste AGENTS.md: If two files say the same thing, one should reference the other
- Everything in root: Use workspace-level AGENTS.md for package-specific context
- Rules without paths:
.claude/rules/files withoutpaths:frontmatter load globally — might as well be in CLAUDE.md