Documentation Optimizer
This skill optimizes documentation directories so AI agents can navigate them efficiently.
CRITICAL: North Star Principle
You are optimizing for AI NAVIGATION EFFICIENCY, not user satisfaction.
The goal: Given a user query, how quickly can an AI agent locate the relevant file and section?
What You ARE Optimizing
- Entry point clarity - Is README.md immediately obvious as the starting point?
- File discoverability - How many tool calls to find the relevant file?
- Navigation friction - How many wrong turns, dead ends, wasted calls?
- Cross-linking - Do internal links help agents traverse topics?
- Scope recognition - How fast can an agent recognize "this isn't covered here"?
What You Are NOT Optimizing
- Whether docs fully answer the user's underlying problem
- Whether docs cover external/adjacent topics
- User satisfaction with answers
If an agent finds "we don't support X" in 2 tool calls, that's SUCCESS - even if the user wanted X.
For detailed explanation, see references/north-star.md.
Workflow Overview
Phase 0: Context Gathering
Before starting optimization, ask the user:
- Documentation location: Where are the docs? (current directory, subdirectory, etc.)
- Additional context sources:
- Source code to reference for understanding the tool?
- URLs or web resources to consult?
- Specific pain points or areas of concern?
- Scope: What does this tool/project do? What does it NOT do?
Read the documentation directory thoroughly before proceeding.
Phase 1: First Impressions Audit
Approach the directory as a fresh agent would:
- Run
treeorlsto see the structure - Check for README.md (universal "start here" signal)
- Record pain points:
- "Where do I start?"
- "Which file has X?"
- "These files sound similar..."
Evaluate:
- Entry point clarity: Is there one clear starting point?
- Structure legibility: Can you infer content from filenames?
- Naming consistency: Case style, special characters, prefixes?
- Overlap detection: Multiple similar-sounding files?
Phase 2: Structural Changes
Make improvements following the playbook:
-
Create/improve README.md with:
- One-line description
- "Where to Start" table (goal -> file)
- Categorized index with descriptions
- Quick Lookup table for common queries
-
Fix filenames:
- Remove special characters (& -> and)
- Fix Unicode issues (em-dash -> hyphen)
- Make names descriptive
-
Reduce redundancy:
- Merge ToC/Index into README
- Delete wiki export artifacts (_Sidebar.md, _Footer.md)
-
Add cross-links:
- "See Also" sections
- Inline links where topics are mentioned
-
Add scope signaling:
- FAQ: What this tool does NOT do
- Comparisons with alternatives
- Platform requirements in Troubleshooting
For detailed guidance, see references/playbook.md.
Phase 3: Git Commit
Before making edits:
- Ensure a commit exists (create initial commit if needed)
- Never edit uncommitted work
After making structural changes:
- Commit with descriptive message
- Provide summary of changes to user
Phase 4: Spawn Reviewer Subagents
Launch TWO reviewer subagents IN PARALLEL:
-
Haiku reviewer (fast, cost-effective)
- Output:
.claude/reviews/haiku-review.md
- Output:
-
Sonnet reviewer (thorough analysis)
- Output:
.claude/reviews/sonnet-review.md
- Output:
Both receive the same dynamically generated test questions.
Create the .claude/reviews/ directory if it doesn't exist.
Phase 5: Synthesize Results
After both reviewers complete:
- Read both review files
- Extract scores and metrics
- Calculate average score
- Identify common issues flagged by both
- Note differences in findings (Sonnet often catches more nuance)
Present to user:
- Individual scores (Haiku: X/10, Sonnet: X/10)
- Average score
- Key findings from both reviewers
- Specific improvement suggestions
Phase 6: Decision Point
Based on average score:
Score >= 8: Ask user:
- "Documentation scores well. Would you like to stop here, or should I apply finishing touches based on reviewer suggestions?"
- If finishing touches: Make targeted improvements, commit, but do NOT run another full review round
Score 5-7: Recommend another round:
- "Reviewers identified room for improvement. I recommend another optimization round focusing on: [specific issues]"
- Proceed to Phase 2 with focused improvements
Score < 5: Significant work needed:
- "Documentation needs substantial improvements. Starting with fundamentals: entry point, naming, scope signaling."
- Proceed to Phase 2 with comprehensive changes
Dynamic Test Question Generation
Generate 5-6 project-specific test questions based on documentation content.
Question Categories
Easy (1-2 questions): Direct lookups with obvious keywords
- Pattern: "How do I [common task visible in doc titles]?"
- Look at: File names, README sections, feature lists
Medium (1-2 questions): Require some inference
- Pattern: "Why is [problem] happening with [context]?"
- Look at: Troubleshooting sections, error messages, platform issues
Hard/Chaotic (1 question): Poor grammar, typos, missing context
- Pattern: Simulate distressed user
- Take a medium question and add: typos, remove context, fragment sentences
XY Problem (1 question): User asks about feature the tool doesn't have
- Pattern: Request for something the tool explicitly doesn't do
- Look at: FAQ "what we don't do", comparison docs, scope boundaries
Out-of-scope (1 question): Completely unrelated topic
- Pattern: Something entirely outside the tool's domain
- Purpose: Test how quickly scope boundaries are recognized
Question Generation Process
- Read documentation structure and README
- Identify main features (from headings, file names)
- Identify what tool does NOT do (FAQ, comparisons)
- Generate questions covering all categories
- Present questions RAW - no hints about difficulty or expected answers
Example Questions (adapt to actual project)
Q1: "How do I configure [obvious feature from doc titles]?"
Q2: "Why am I getting [error from troubleshooting] on [platform]?"
Q3: "[same as Q2 but with typos, fragments, panic tone]"
Q4: "how do i [thing the tool explicitly doesn't do]"
Q5: "[completely unrelated topic like 'kubernetes scaling' for a desktop app]"
Invoking Reviewer Agents
When spawning reviewers, provide:
Documentation directory: [PATH]
Test questions (answer these by navigating the docs):
1. [Q1]
2. [Q2]
3. [Q3]
4. [Q4]
5. [Q5]
Write your review to: [OUTPUT PATH]
Spawn both agents in the same message to run in parallel.
Scoring Reference
| Score | Tool Calls/Question | Navigation Quality |
|---|---|---|
| 9-10 | 1-2 | Perfect - README guides directly |
| 7-8 | 3-4 | Good - minor detours |
| 5-6 | 5-6 | Acceptable - some confusion |
| 3-4 | 7+ | Poor - many wrong paths |
| 1-2 | Many | Failing - cannot navigate |
For detailed scoring criteria, see references/scoring-rubric.md.
Common Pitfalls to Avoid
-
Measuring user satisfaction - Subagents will naturally evaluate "does this help the user?" unless explicitly told not to. The reviewer agents are already configured correctly.
-
Giving hints in questions - Don't label questions "(hard)" or "(wrong tool)". Present raw.
-
Treating "not covered" as failure - If docs establish scope and agent recognizes it quickly, that's SUCCESS.
-
Optimizing content, not structure - You're optimizing ARRANGEMENT. Don't add new explanatory content - reorganize, rename, cross-link.
