writing-documentation-for-llms
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.
Install
mkdir -p .claude/skills/writing-documentation-for-llms && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7317" && unzip -o skill.zip -d .claude/skills/writing-documentation-for-llms && rm skill.zipInstalls to .claude/skills/writing-documentation-for-llms
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
- Structure & Progressive Disclosure
- Content Patterns
- Anti-patterns
- Testing & Iteration
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:
- What it does: The concrete capability
- 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:
- Identify gaps with LLM working without docs
- Create 3+ representative test cases
- Establish baseline performance
- Write minimal docs to address gaps
- Test and iterate based on results
Develop iteratively with Claude
- Complete a task with Claude without docs
- Identify the reusable pattern
- Ask Claude to create docs capturing that pattern
- Review for conciseness (remove explanations Claude already knows)
- Test docs with a fresh instance on similar tasks
- 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.
More by CaptainCrouton89
View all skills by CaptainCrouton89 →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversSupercharge your AI code assistant with GitMCP—get accurate, up-to-date code and API docs from any GitHub project. Free,
DeepWiki converts deepwiki.com pages into clean Markdown, with fast, secure extraction—perfect as a PDF text, page, or i
Learn how to use Python to read a file and manipulate local files safely through the Filesystem API.
Boost your AI code assistant with Context7: inject real-time API documentation from OpenAPI specification sources into y
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Uno Platform — Documentation and prompts for building cross-platform .NET apps with a single codebase. Get guides, sampl
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.