Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Review and improve AI agent instruction documents (AGENTS.md, Claude.md, etc.) for quality, clarity, and effectiveness. Use when users request review of agent documentation, ask to evaluate document structure, detect bloat, check progressive disclosure, or improve agent instruction quality. Applicable across different AI agent environments.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 188% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 215% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 98% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 148% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 372% | 0% |
This skill helps review and improve documents intended for AI agent consumption (like AGENTS.md, Claude.md, or custom agent instructions). It identifies common issues that reduce document effectiveness:
Follow this sequence when reviewing a document:
Run the quantitative analysis script to get objective metrics:
bash# Default: Analyze file + all linked files (recommended) node scripts/analyze_document.js --root-dir <root-directory> <file-path> # Analyze single file only (skip link analysis) node scripts/analyze_document.js --no-include-links <file-path>
⚠️ SECURITY: The --root-dir parameter is REQUIRED for link analysis. It enforces a security sandbox, preventing malicious documents from accessing sensitive files (like ~/.ssh/id_rsa or ~/.aws/credentials) through directory traversal attacks (../../../etc/passwd).
Default behavior: Link analysis is enabled by default when --root-dir is specified. This ensures progressive disclosure evaluation includes the entire documentation system (main doc + linked docs).
Link analysis:
For detailed usage including path options and output format, see Using the Analysis Script below.
This skill is not AGENTS.md-only. Instruction discovery, scope, and overrides vary by tool and filename. Before expanding scope beyond the requested file, identify which tool consumes it (AGENTS.md / Claude Code / GitHub Copilot / Aider / etc.).
For AGENTS.md (agents.md open format):
When reviewing path/to/AGENTS.md, treat it as instructions for the directory subtree path/to/** — but note that nested AGENTS.md files override parent instructions for their own subtrees.
AGENTS.md and documents reachable via its internal linksAGENTS.md to the edited file wins; explicit user chat prompts override everythingbash # Option 1: Unified analysis (with shared deduplication, recommended) # Analyze all together - common references (TESTING.md etc.) are analyzed once find /path/to/project -name "AGENTS.md" -exec \ node scripts/analyze_document.js --root-dir /path/to/project {} +
# Or use shell glob expansion node scripts/analyze_document.js --root-dir /project /project//AGENTS.md
# Option 2: Individual analysis (separate reports) # Analyze each one independently find /path/to/project -name "AGENTS.md" -print0 | \ xargs -0 -I {} node scripts/analyze_document.js --no-include-links {}
For other instruction files (CLAUDE.md, GitHub Copilot, Aider, etc.):
Do not assume "nearest file wins" or parent-directory discovery unless the tool's documentation says so. See conventions.md for a quick reference.
Default scope:
Read the document with these questions in mind:
Sequential Reading Impact:
Redundancy:
Progressive Disclosure:
--root-dir 付き実行(デフォルトでリンク解析有効)で、リンク先ドキュメントも含めて評価してください。内部リンクが多くても、参照先が低品質(例: セクション過多・過分割)だと逆効果になり得ます。For detailed criteria, see review-criteria.md.
Before proposing changes, ask the user if:
Structure the review output as:
markdown## Document Analysis: [filename] ### Quantitative Metrics - Lines: [count] ([evaluation]) - Sections: [count] ([evaluation]) - Max depth: [level] ([evaluation]) - Internal links: [count] ([evaluation]) - Overall score: [X/10] ### Key Issues 1. [Most critical issue with line references] 2. [Second issue with line references] 3. [Additional issues...] ### Recommendations [Prioritized list of improvements] ### Detailed Feedback [Specific observations from qualitative review]
Offer concrete, actionable suggestions:
Ask user preference:
When implementing improvements:
The scripts/analyze_document.js script provides deterministic metrics to support your review.
Basic usage:
bash# Default: Analyze file + linked files (recommended) node scripts/analyze_document.js --root-dir <root-directory> <file-path> # Single file only (skip link analysis) node scripts/analyze_document.js --no-include-links <file-path> # Full output format (instead of summary) node scripts/analyze_document.js --root-dir <root-directory> --format full <file-path>
Advanced options:
bash# Custom limits (for very large documentation systems) node scripts/analyze_document.js --root-dir <root-directory> --max-depth 5 --max-count 50 <file-path> # Optional hardening (skip symlink targets when following links) node scripts/analyze_document.js --root-dir <root-directory> --no-symlinks <file-path>
Multiple files (unified analysis with shared deduplication):
bash# Analyze multiple files together (common references analyzed once) node scripts/analyze_document.js --root-dir /project \ /project/AGENTS.md /project/subdir/AGENTS.md # Use shell glob expansion node scripts/analyze_document.js --root-dir /project /project/**/AGENTS.md # With find command find /project -name "AGENTS.md" -exec \ node scripts/analyze_document.js --root-dir /project {} +
Path options (depending on your working directory):
bash# Codex standard installation path node ~/.codex/skills/agent-document-reviewer/scripts/analyze_document.js --root-dir <root-directory> <file-path> # Claude Code standard installation path node ~/.claude/skills/agent-document-reviewer/scripts/analyze_document.js --root-dir <root-directory> <file-path> # Relative path from working directory (from project root) node scripts/analyze_document.js --root-dir . <file-path>
Important notes:
summary (concise, suitable for LLM contexts)--root-dir is specified--root-dir is REQUIRED for link analysis (security sandbox)--no-include-links to skip link analysis (single file only)--no-symlinks to avoid reading through symlink targets during link analysis (best-effort)--format full for detailed output with section arraysOutput (single file with --no-include-links):
json{ "file": "AGENTS.md", "metrics": { "totalLines": 450, "sectionCount": 12, "maxDepth": 3, "internalLinks": 5, "anchorLinks": 0, ... }, "evaluation": { "scores": { "overall": 8 }, "feedback": ["✅ Document length is acceptable..."] } }
Output (default with --root-dir, includes link analysis):
json{ "file": "AGENTS.md", "linkedAnalysis": { "analyzed": [ { "file": "AGENTS.md", "depth": 0, "metrics": {...}, "evaluation": {...} }, { "file": "TESTING.md", "depth": 1, "metrics": {...}, "evaluation": {...} } ], "notFound": ["references/missing-file.md"], "skipped": { "maxDepth": ["deeper-file.md"], "maxCount": [], "outsideRoot": [ { "url": "../../../etc/passwd", "resolvedPath": "/etc/passwd" } ] }, "summary": { "totalAnalyzed": 2, "averageScore": 7.5, "worstScore": 7, "worstFile": "/path/to/AGENTS.md" } } }
Output (multiple files with --root-dir, unified analysis):
json{ "entryPoints": ["AGENTS.md", "subdir/AGENTS.md"], "linkedAnalysis": { "analyzed": [ { "file": "AGENTS.md", "depth": 0, "metrics": {...}, "evaluation": {...} }, { "file": "COMMON.md", "depth": 1, "metrics": {...}, "evaluation": {...} }, { "file": "subdir/AGENTS.md", "depth": 0, "metrics": {...}, "evaluation": {...} } ], "summary": { "totalAnalyzed": 3, "averageScore": 8.0, "worstScore": 7, "worstFile": "/path/to/AGENTS.md" } } }
Note: When analyzing multiple entry points, common references (like COMMON.md) are analyzed only once due to shared deduplication.
Interpreting scores (0-10 scale):
Always run this script first to ground your review in objective data.
Key evaluation dimensions:
#section) are penalized - LLMs read entire documents at once, making same-document navigation meaninglessFor detailed criteria with examples, see review-criteria.md.
Quick reference for document quality:
For comprehensive best practices with templates, see best-practices.md.
| Problem | Solution | Key Technique | |---------|----------|---------------| | Document too long (>800 lines) | Split into core + specialized topics | Progressive disclosure with internal links | | Critical rules buried | Create "Core Principles" section at top | Front-load MUST/NEVER rules | | High redundancy | Consolidate repeated content | State once, cross-reference elsewhere | | No progressive disclosure | Extract detailed sections to separate files | Keep main doc <500 lines |
Pattern 1: Splitting long documents
markdown# Main Document (keep essential workflow) ## Specialized Topics - Testing: See [TESTING.md](TESTING.md) - API: See [API.md](API.md) - Database: See [DATABASE.md](DATABASE.md)
Pattern 2: Front-loading critical rules
markdown# Agent Instructions ## Core Principles (Read This First) 1. Always run tests before committing 2. Never commit secrets 3. Use conventional commits
Pattern 3: Eliminating redundancy
markdown## Core Principles - Use TypeScript for all new files ## Section B Follow core principles above for file creation.
Other measured skills in the registry, with their headline benchmark lift.