WR

writing-documentation-for-llms

Guides developers to create LLM-optimized documentation by prioritizing code examples and structured, concise information.

Install

mkdir -p .claude/skills/writing-documentation-for-llms && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7317" && unzip -o skill.zip -d .claude/skills/writing-documentation-for-llms && rm skill.zip

Installs to .claude/skills/writing-documentation-for-llms

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Teaches how to write effective documentation and instructions for LLMs by assuming competence, using progressive disclosure, prioritizing examples over explanations, and building feedback loops into workflows.
209 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Assume competence by removing redundant explanations
  • Use progressive disclosure for documentation structure
  • Prioritize code-centric examples over abstract descriptions
  • Implement feedback loops for quality-critical tasks
  • Use conditional workflows for decision points

How it works

The skill applies progressive disclosure and example-first patterns to reduce token usage and improve LLM comprehension. It emphasizes removing redundant explanations and organizing content into a high-level overview with shallow reference files.

Inputs & outputs

You give it
Technical documentation draft
You get back
Concise, LLM-optimized documentation

When to use writing-documentation-for-llms

  • Improving LLM prompt instructions
  • Creating system prompts for custom agents
  • Refactoring existing documentation for AI intake
  • Reducing token usage in technical docs

About this skill

Writing Documentation for LLMs

Guidance for creating effective documentation and instructions that LLMs can discover, understand, and use successfully.

Contents


Core Principles

Assume competence

The LLM is already very smart. Only add information the LLM doesn't have. Challenge every piece:

  • "Does the LLM really need this explanation?"
  • "Can I assume the LLM knows this?"
  • "Does this justify its token cost?"

Verbose example (~150 tokens):

PDF (Portable Document Format) files are a common file format that contains
text, images, and other content. To extract text from a PDF, you'll need to
use a library. There are many libraries available for PDF processing...

Concise example (~50 tokens):

Use pdfplumber for text extraction:
import pdfplumber
with pdfplumber.open("file.pdf") as pdf:
    text = pdf.pages[0].extract_text()

Match specificity to task fragility

  • Narrow instructions (low freedom): database migrations, destructive operations, consistency-critical tasks
  • General guidance (high freedom): code reviews, design decisions, where context determines best path

Test across models

Effectiveness varies by model. Skills that work for Claude Opus may need more detail for Claude Haiku.


Structure & Progressive Disclosure

Organize like a table of contents

Main file provides overview and points to detailed materials. LLM reads additional files only when needed.

Pattern:

  • Main file: high-level guide with references (< 500 lines)
  • Reference files: one per domain or topic
  • Keep references one level deep (avoid chains: A → B → C)

Example structure:

my-doc/
├── OVERVIEW.md           # High-level guide
├── reference/
│   ├── api.md           # Specific reference
│   ├── examples.md      # Usage examples
│   └── troubleshooting.md
└── scripts/
    └── helper.py        # Executable utilities

Table of contents for long files

For any file over 100 lines, include a TOC at the top so LLM sees full scope:

## Contents
- Authentication and setup
- Core methods (create, read, update, delete)
- Advanced features
- Error handling patterns

Consistent terminology

Choose one term per concept and use it throughout:

  • Always "API endpoint" (not "URL", "route", "path")
  • Always "field" (not "box", "element", "control")
  • Always "extract" (not "pull", "get", "retrieve")

Content Patterns

Descriptions: what + when

Enable discovery with concrete descriptions:

  1. What it does: The concrete capability
  2. When to use it: Specific triggers and contexts

Good example:

Extract text and tables from PDF files, fill forms, merge documents.
Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.

Bad example:

Helps with documents

Examples over explanations

Show concrete input/output before abstract descriptions:

## Generating commit messages

Follow these examples:

**Example 1:**
Input: Added user authentication with JWT tokens
Output:
feat(auth): implement JWT-based authentication

Add login endpoint and token validation middleware

Workflows with clear steps

Break complex operations into sequential steps:

## Database migration workflow

Task Progress:
- [ ] Step 1: Create backup
- [ ] Step 2: Run migration script
- [ ] Step 3: Verify schema
- [ ] Step 4: Validate data integrity

Feedback loops for critical tasks

Use validators for quality-critical work:

## Document editing process

1. Make your edits
2. **Validate**: Run `validate.py`
3. If validation fails:
   - Review errors
   - Fix issues
   - Run validation again
4. **Only proceed when validation passes**
5. Finalize output

Conditional workflows

Guide the LLM through decision points:

## Modification workflow

1. Determine the modification type:
   - Creating new content? → Follow "Creation workflow"
   - Editing existing content? → Follow "Editing workflow"

2. Creation workflow:
   - Use library X
   - Build from scratch
   - Export format Y

3. Editing workflow:
   - Unpack existing file
   - Modify content
   - Repack when complete

Verifiable intermediate outputs

For complex tasks, create verifiable intermediate formats:

## Batch update workflow

1. Create plan file (JSON format)
2. **Validate plan**: Run `validate_plan.py`
3. If validation passes, execute
4. Verify output matches plan

Avoid time-sensitive information

Use "old patterns" sections for deprecated approaches:

## Current method

Use the v2 API endpoint: `api.example.com/v2/messages`

## Old patterns

<details>
<summary>Legacy v1 API (deprecated 2025-08)</summary>
The v1 API used: `api.example.com/v1/messages`
</details>

Anti-patterns

Too many options

Don't present multiple approaches unless necessary.

Bad:

You can use pypdf, or pdfplumber, or PyMuPDF, or pdf2image, or...

Good:

Use pdfplumber for text extraction.

For scanned PDFs requiring OCR, use pdf2image with pytesseract.

Deeply nested references

Keep references one level deep. Nested chains (file A → file B → file C) cause partial reads and missed context.

Vague trigger terms

Be specific in descriptions for discovery:

Vague: Helps with data

Specific: Analyze Excel spreadsheets, generate pivot tables, create charts. Use when working with Excel files, spreadsheets, or .xlsx files.

Windows-style paths

Always use forward slashes (Unix style):

  • ✓ Good: scripts/helper.py
  • ✗ Wrong: scripts\helper.py

Testing & Iteration

Create evaluations first

Before writing extensive documentation:

  1. Identify gaps with LLM working without docs
  2. Create 3+ representative test cases
  3. Establish baseline performance
  4. Write minimal docs to address gaps
  5. Test and iterate based on results

Develop iteratively with Claude

  1. Complete a task with Claude without docs
  2. Identify the reusable pattern
  3. Ask Claude to create docs capturing that pattern
  4. Review for conciseness (remove explanations Claude already knows)
  5. Test docs with a fresh instance on similar tasks
  6. Iterate based on observations

Key Takeaway

Effective LLM documentation assumes intelligence, uses examples over explanation, organizes for progressive discovery, and validates critical workflows. Test with target models and iterate based on real usage patterns.

When not to use it

  • Presenting multiple options when one is sufficient
  • Creating deeply nested reference chains
  • Including time-sensitive information

Limitations

  • Requires manual testing across different models
  • Effectiveness varies based on the target model's capabilities

How it compares

Unlike generic documentation, this approach specifically optimizes content for LLM discovery and token efficiency by assuming model competence.

Compared to similar skills

writing-documentation-for-llms side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
writing-documentation-for-llms (this skill)110moNo flagsIntermediate
enhance-claude-memory115moReviewBeginner
ml-paper-writing486moReviewAdvanced
docs-review107moNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

More by CaptainCrouton89

View all by CaptainCrouton89

reviewing-code

CaptainCrouton89

Systematically evaluate code changes for security, correctness, performance, and spec alignment. Use when reviewing PRs, assessing code quality, or verifying implementation against requirements.

21105

railway-cli-management

CaptainCrouton89

Deploy, manage services, view logs, and configure Railway infrastructure. Use when deploying to Railway, managing environment variables, viewing deployment logs, scaling services, or managing volumes.

9139

writing-like-user

CaptainCrouton89

Emulate the user's personal writing voice and style patterns. Use when the user asks to write content in their voice, draft documents, compose messages, or requests "write this like me" or "in my style."

687

gathering-requirements

CaptainCrouton89

Systematically clarify user needs, preferences, and constraints before planning or implementation. Classifies work type, investigates existing systems, discovers edge cases and integration points, resolves assumptions, and creates detailed specifications. Use when building features, enhancements, or integrations where requirements need clarification.

31

auditing-security

CaptainCrouton89

Identify and remediate vulnerabilities through systematic code analysis. Use when performing security assessments, pre-deployment reviews, compliance validation (OWASP, PCI-DSS, GDPR), investigating known vulnerabilities, or post-incident analysis.

10

documenting-code

CaptainCrouton89

Maintain project documentation synchronized with code. Keep feature specs, API contracts, and README current with init-project standards. Use when updating docs after code changes, adding new features, or ensuring documentation completeness.

14

You might also like

enhance-claude-memory

avifenesh

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

117

ml-paper-writing

davila7

Write publication-ready ML/AI papers for NeurIPS, ICML, ICLR, ACL, AAAI, COLM. Use when drafting papers from research repos, structuring arguments, verifying citations, or preparing camera-ready submissions. Includes LaTeX templates, reviewer guidelines, and citation verification workflows.

4897

docs-review

metabase

Review documentation changes for compliance with the Metabase writing style guide. Use when reviewing pull requests, files, or diffs containing documentation markdown files.

1085

claude-md-improver

anthropics

Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project memory optimization".

2167

write-docs

tldraw

Writing SDK documentation for tldraw. Use when creating new documentation articles, updating existing docs, or when documentation writing guidance is needed. Applies to docs in apps/docs/content/.

665

update-docs

vercel

This skill should be used when the user asks to "update documentation for my changes", "check docs for this PR", "what docs need updating", "sync docs with code", "scaffold docs for this feature", "document this feature", "review docs completeness", "add docs for this change", "what documentation is affected", "docs impact", or mentions "docs/", "docs/01-app", "docs/02-pages", "MDX", "documentation update", "API reference", ".mdx files". Provides guided workflow for updating Next.js documentation based on code changes.

2543

Search skills

Search the agent skills registry