Curate library or project documentation for ai_docs to optimize AI context
Curates library or project documentation into concise, actionable AI context entries with version-specific gotchas.
/plugin marketplace add laurigates/claude-plugins/plugin install blueprint-plugin@lgates-claude-pluginsCurate documentation for a library or project pattern into an ai_docs entry.
Usage: /blueprint:curate-docs [library-name] or /blueprint:curate-docs project:[pattern-name]
What is ai_docs? ai_docs are curated documentation entries optimized for AI agents. Unlike raw documentation, they are:
Prerequisites:
docs/blueprint/ai_docs/ directory existsIdentify the library:
# Check if already documented
ls docs/blueprint/ai_docs/libraries/
# Check project dependencies for version
cat package.json | grep "[library-name]"
# or
cat pyproject.toml | grep "[library-name]"
# or
cat requirements.txt | grep "[library-name]"
Gather documentation:
Use WebSearch:
[library-name] documentation [specific topic]
[library-name] common issues
[library-name] gotchas
[library-name] best practices
Use WebFetch to extract key sections:
Fetch: [library documentation URL]
Extract: [specific pattern or topic]
Identify existing patterns:
# Search for pattern implementations
grep -r "[pattern keyword]" src/
grep -r "[pattern keyword]" lib/
Analyze the pattern:
Identify how this library/pattern is used in this project:
From documentation and codebase:
Compile known issues:
Sources for gotchas:
For libraries:
docs/blueprint/ai_docs/libraries/[library-name].md
For project patterns:
docs/blueprint/ai_docs/project/[pattern-name].md
Use the ai_docs template:
# [Library/Pattern Name]
**Version:** X.Y.Z
**Last Updated:** YYYY-MM-DD
**Use Case:** [Why we use this in this project]
## Quick Reference
### [Common Operation 1]
```[language]
# Code snippet that can be directly copied
# Code snippet that can be directly copied
[When to use this pattern]
# Full example as used in this project
VAR_NAME=value
# How we configure this in the project
Issue: [What can go wrong] Solution:
# Correct approach
Issue: [What can go wrong] Solution:
# Correct approach
# Bad example
# Good example
# Mocking pattern for tests
### 3.3 Quality Checks
Before saving, verify:
- [ ] Entry is < 200 lines
- [ ] Code snippets are directly usable
- [ ] Gotchas include solutions
- [ ] Version is specified
- [ ] Use cases are clear
- [ ] Anti-patterns are shown
## Phase 4: Integrate
### 4.1 Save Entry
```bash
# Write to ai_docs
cat > docs/blueprint/ai_docs/[type]/[name].md << 'EOF'
[content]
EOF
If PRPs reference this library/pattern:
## ai_docs Entry Created: [Name]
**Location:** `docs/blueprint/ai_docs/[type]/[name].md`
**Version:** X.Y.Z
**Content Summary:**
- Quick Reference: [N operations]
- Patterns: [N patterns]
- Gotchas: [N documented]
- Anti-patterns: [N shown]
**Lines:** [count] (target: < 200)
**Use in PRPs:**
Reference with:
```markdown
### ai_docs References
- See `ai_docs/[type]/[name].md` - [Section]
Linked PRPs:
## Templates by Type
### Library Template
Best for: External dependencies (Redis, Pydantic, FastAPI, etc.)
Focus on:
- Version-specific behavior
- Connection/initialization patterns
- Error handling
- Performance gotchas
### Framework Template
Best for: Web frameworks, ORMs, testing frameworks
Focus on:
- Project structure conventions
- Configuration patterns
- Extension points
- Testing integration
### Project Pattern Template
Best for: Internal patterns (Repository, Service Layer, etc.)
Focus on:
- When to use this pattern
- How it's implemented in this codebase
- Integration with other patterns
- Common mistakes
### 4.4 Prompt for next action (use AskUserQuestion):
question: "ai_docs entry created. What would you like to do next?" options:
**Based on selection:**
- "Curate another" → Run `/blueprint:curate-docs` (ask for library/pattern name)
- "Create PRP using this context" → Run `/blueprint:prp-create` (ask for feature name)
- "Update linked PRPs" → List PRPs that could benefit from this ai_docs reference
- "I'm done" → Exit
**Tips**:
- Be ruthless about conciseness - every line uses tokens
- Include actual line numbers from codebase examples
- Document gotchas immediately when discovered
- Update entries as patterns evolve
- Link to official docs for rarely-used features