enhance-docs

Use when improving documentation structure, accuracy, and RAG readiness.

23 stars

Best use case

enhance-docs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when improving documentation structure, accuracy, and RAG readiness.

Teams using enhance-docs should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/enhance-docs/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/ai-ml/enhance-docs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/enhance-docs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How enhance-docs Compares

Feature / Agentenhance-docsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when improving documentation structure, accuracy, and RAG readiness.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# enhance-docs

Analyze documentation for readability, structure, and RAG optimization.

## Parse Arguments

```javascript
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';
const fix = args.includes('--fix');
const aiMode = args.includes('--ai');
```

## Documentation Locations

| Type | Location | Purpose |
|------|----------|---------|
| User docs | `docs/*.md`, `README.md` | Human-readable guides |
| Agent docs | `agent-docs/*.md` | AI reference material |
| Project memory | `CLAUDE.md`, `AGENTS.md` | AI context/instructions |

## Optimization Modes

### AI-Only Mode (`--ai`)
For agent-docs and RAG-optimized documentation:
- Aggressive token reduction
- Dense information packing
- Self-contained sections for retrieval
- Optimal chunking boundaries

### Both Mode (`--both`, default)
For user-facing documentation:
- Balance readability with AI-friendliness
- Clear structure for both humans and retrievers

## Workflow

1. **Discover** - Find all .md files
2. **Parse** - Extract structure and content
3. **Check** - Run pattern checks based on mode
4. **Report** - Generate markdown output
5. **Fix** - Apply auto-fixes if --fix

## Detection Patterns

### 1. Link Validation (HIGH)

- Broken anchor links (`[text](#missing-anchor)`)
- Links to non-existent files
- Malformed link syntax

### 2. Structure Validation (HIGH)

**Heading hierarchy:**
- No jumps (H1 → H3 without H2)
- Single H1 per document
- Code blocks with language tags

**Position-aware content** (based on "lost in the middle" research):
- Critical info at START or END of document
- Supporting details in MIDDLE
- Flag important content buried in middle sections

**Recommended structure:**
```
1. Overview/Purpose (START - high attention)
2. Quick Start / TL;DR
3. Detailed Content
4. Reference / API
5. Summary / Key Points (END - high attention)
```

### 3. Token Efficiency (HIGH - AI Mode)

**Token estimation:** `characters / 4` or `words * 1.3`

**Unnecessary prose:**
- "In this document..."
- "As you can see..."
- "Let's explore..."
- "It's important to note that..."

**Verbose phrases:**
| Verbose | Concise |
|---------|---------|
| "in order to" | "to" |
| "due to the fact that" | "because" |
| "has the ability to" | "can" |
| "at this point in time" | "now" |
| "for the purpose of" | "for" |
| "in the event that" | "if" |

**Target:** ~1500 tokens for project memory files, flexible for reference docs.

### 4. RAG Optimization (MEDIUM - AI Mode)

**Chunk size guidelines:**
| Size | Issue |
|------|-------|
| >1000 tokens | Too long, split into subtopics |
| <50 tokens | Too short, merge with related content |
| 200-500 tokens | Optimal for retrieval |

**Semantic boundaries:**
- Single topic per section
- Self-contained sections (avoid "It", "This" at section start)
- Clear section titles that describe content

**Context anchors:**
```markdown
# Bad - ambiguous start
## Configuration
It requires several settings...

# Good - self-contained
## Configuration
The plugin configuration requires several settings...
```

### 5. Information Density (MEDIUM - AI Mode)

**Prefer tables over prose:**
```markdown
# Bad - verbose
The function accepts a path parameter which is required,
a limit parameter which defaults to 10, and an optional
format parameter.

# Good - dense
| Param | Required | Default | Description |
|-------|----------|---------|-------------|
| path | Yes | - | File path |
| limit | No | 10 | Max results |
| format | No | json | Output format |
```

**Prefer lists over paragraphs** for sequential items.

**Use code blocks** for examples, commands, configurations.

### 6. Cross-Reference Quality (MEDIUM)

- Internal links should use relative paths
- External links should be stable (avoid commit hashes)
- Reference sections should point to canonical sources

### 7. Balance Suggestions (MEDIUM - Both Mode)

- Missing section headers in long content (>500 words without heading)
- Important information buried late in document
- Missing TL;DR or summary for long documents

## Auto-Fixes

| Issue | Fix |
|-------|-----|
| Inconsistent headings | H1 → H3 becomes H1 → H2 |
| Verbose phrases | Replace with concise alternatives |
| Missing code language | Add based on content detection |

## Output Format

```markdown
## Documentation Analysis: {name}

**File**: {path}
**Mode**: {AI-only | Both}
**Tokens**: ~{count}

| Certainty | Count |
|-----------|-------|
| HIGH | {n} |
| MEDIUM | {n} |

### Link Issues
| Line | Issue | Fix | Certainty |

### Structure Issues
| Line | Issue | Fix | Certainty |

### Efficiency Issues [AI mode]
| Line | Issue | Fix | Certainty |

### RAG Issues [AI mode]
| Line | Issue | Fix | Certainty |
```

## Pattern Statistics

| Category | Patterns | Mode | Certainty |
|----------|----------|------|-----------|
| Links | 3 | shared | HIGH |
| Structure | 4 | shared | HIGH |
| Token Efficiency | 3 | ai | HIGH |
| RAG Optimization | 3 | ai | MEDIUM |
| Information Density | 2 | ai | MEDIUM |
| Cross-Reference | 2 | shared | MEDIUM |
| Balance | 3 | both | MEDIUM |
| **Total** | **20** | - | - |

<examples>
### Verbose Phrase
<bad_example>
```markdown
In order to configure the plugin, you need to...
```
</bad_example>
<good_example>
```markdown
To configure the plugin...
```
</good_example>

### RAG Chunking
<bad_example>
```markdown
## Installation
[2000+ tokens of mixed content covering install, config, and usage]
```
</bad_example>
<good_example>
```markdown
## Installation
[400 tokens - installation only]

## Configuration
[300 tokens - config only]

## Usage
[400 tokens - usage only]
```
</good_example>

### Position-Aware Content
<bad_example>
```markdown
## Introduction
[Long background...]

## History
[More context...]

## Critical Setup Steps
[Important info buried in middle]
```
</bad_example>
<good_example>
```markdown
## Quick Start (Critical)
[Important setup steps at START]

## Background
[Supporting context in middle]

## Reference
[Details...]

## Key Reminders
[Critical points repeated at END]
```
</good_example>

### Tables vs Prose
<bad_example>
```markdown
The API accepts three parameters. The first is `query` which is required.
The second is `limit` which defaults to 10. The third is `format`.
```
</bad_example>
<good_example>
```markdown
| Param | Required | Default |
|-------|----------|---------|
| query | Yes | - |
| limit | No | 10 |
| format | No | json |
```
</good_example>
</examples>

## References

- `agent-docs/CONTEXT-OPTIMIZATION-REFERENCE.md` - Token budgeting, position awareness, chunking
- `agent-docs/PROMPT-ENGINEERING-REFERENCE.md` - Structure, information density

## Constraints

- Auto-fix only HIGH certainty issues
- Preserve original tone and style
- Balance AI optimization with human readability (default mode)
- Don't remove content, only restructure or condense

Related Skills

docs-writer

23
from christophacham/agent-skills-library

Write, review, and edit documentation files with consistent structure, tone, and technical accuracy. Use when creating docs, reviewing markdown files, writing READMEs, updating `/docs` directories, or when user says "write documentation", "review this doc", "improve this README", "create a guide", or "edit markdown". Do NOT use for code comments, inline JSDoc, or API reference generation.

docs:write-concisely

23
from christophacham/agent-skills-library

Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.

googledocs-automation

23
from christophacham/agent-skills-library

Automate Google Docs tasks via Rube MCP (Composio): create, edit, search, export, copy, and update documents. Always search tools first for current schemas.

google-docs

23
from christophacham/agent-skills-library

Interact with Google Docs - create documents, search by title, read content, and edit text. Use when user asks to: create a Google Doc, find a document, read doc content, add text to a doc, or replace text in a document. Lightweight alternative to full Google Workspace MCP server with standalone OAuth authentication.

docsumo-automation

23
from christophacham/agent-skills-library

Automate Docsumo tasks via Rube MCP (Composio). Always search tools first for current schemas.

algodocs-automation

23
from christophacham/agent-skills-library

Automate Algodocs tasks via Rube MCP (Composio). Always search tools first for current schemas.

docs:update-docs

23
from christophacham/agent-skills-library

Update and maintain project documentation for local code changes using multi-agent workflow with tech-writer agents. Covers docs/, READMEs, JSDoc, and API documentation.

generate-docs

23
from christophacham/agent-skills-library

Generate project documentation from an existing codebase. This documentation shall serve Agents and Humans. Creates a project overview, module documentation, and feature documentation with explicit inventories (files/dirs + symbols) for each module. Use this skill when onboarding a new project or creating initial documentation for an undocumented codebase.

enhance-prompts

23
from christophacham/agent-skills-library

Use when improving general prompts for structure, examples, and constraints.

enhance-claude-memory

23
from christophacham/agent-skills-library

Use when improving CLAUDE.md or AGENTS.md project memory files.

enhance-agent-prompts

23
from christophacham/agent-skills-library

Use when improving agent prompts, frontmatter, and tool restrictions.

docsbot-ai-automation

23
from christophacham/agent-skills-library

Automate Docsbot AI tasks via Rube MCP (Composio). Always search tools first for current schemas.