Esta skill debe usarse cuando el usuario pide "documentar un patrón", "documentar un problema", "documentar una decisión", "documentar guías", "documentar la sesión", "crear documentación de", o...
Generate structured technical documentation for specific knowledge elements discovered during development sessions.
For reusable code patterns, techniques, or solutions.
Template: references/templates/pattern.md
Example: examples/pattern-example.md (Retry with Exponential Backoff)
Memory type: reference
For complex bugs, race conditions, or difficult technical challenges.
Template: references/templates/problem-solution.md
Example: examples/problem-solution-example.md (Race Condition in Cache)
Memory type: project
For architectural decisions, technology choices, or trade-off analysis.
Template: references/templates/decision.md
Example: examples/decision-example.md (PostgreSQL vs MongoDB)
Memory type: project
For design systems, code standards, or team conventions.
Template: references/templates/guidelines.md
Example: examples/guidelines-example.md (Button Component Guidelines)
Memory type: feedback
For sessions focused on discussion, research, or analysis with no code changes.
Guard: Check your own session context. If no code was modified in this session, automatically select this type without prompting the user.
Template: references/templates/session-knowledge.md
Memory type: project
Follow these steps to create documentation:
Before identifying type: if this is a session documentation request, check your own context.
Determine which type of documentation fits the user's intent:
Ask user if type is ambiguous: "Is this a pattern, problem-solution, or decision?"
Read the corresponding template from references/templates/{type}.md (use absolute path ${CLAUDE_PLUGIN_ROOT}/skills/document/references/templates/{type}.md when loading):
pattern.md for patternsproblem-solution.md for problemsdecision.md for decisionsguidelines.md for guidelinessession-knowledge.md for session knowledgeTemplates contain structure and field descriptions.
Extract information from session context:
Auto-detect:
Ask user if needed:
Use conversation context:
The primary output is a project memory entry. Map document type to memory type:
| Document Type | Memory Type | Rationale |
|---|---|---|
| Pattern | reference |
Reusable knowledge pointer |
| Problem-Solution | project |
Context about ongoing work |
| Decision | project |
Architectural context |
| Guidelines | feedback |
Guides future behavior |
| Session Knowledge | project |
Session context |
{type}_{slug}.md namingMEMORY.md indexContent quality guidelines:
Ask the user: "Do you want an exportable copy for sharing with colleagues?"
Generate a full document using the template and write it to the project.
Default location: .claude/sessions/{category}/{filename}.md
Directory structure:
.claude/sessions/
├── patterns/
├── problems/
├── decisions/
├── guidelines/
└── knowledge/
Filename format: {YYYYMMDD-HHMMSS}-{slug}.md
Example: 20260115-142345-retry-pattern.md
User can override:
Only runs if Step 6 produced a file.
git check-ignore -q <file_path>.gitignore (e.g. .claude/sessions/).gitignore was updated to exclude generated docs.All documents include standard metadata:
These are suggested tag categories. Use relevant tags based on actual content.
Technical area: backend, frontend, database, api, infrastructure
Technology: go, typescript, react, postgresql, redis, docker
Change type: bugfix, optimization, refactoring, feature
Complexity: simple, moderate, complex
Impact: breaking-change, backward-compatible, experimental
User says: "Document the retry pattern we implemented for the HTTP client"
Actions:
references/templates/pattern.md.claude/docs/patterns/20260115-142345-retry-pattern.mdUser says: "Document how we fixed that race condition in the cache"
Actions:
references/templates/problem-solution.md.claude/docs/problems/20260115-164512-cache-race-condition.mdUser says: "Document why we chose PostgreSQL over MongoDB"
Actions:
references/templates/decision.md.claude/docs/decisions/20260114-091530-postgresql-choice.mdDetailed templates with field descriptions:
references/templates/pattern.md - Pattern documentation templatereferences/templates/problem-solution.md - Problem-solution templatereferences/templates/decision.md - Decision documentation templatereferences/templates/guidelines.md - Guidelines templatereferences/templates/session-knowledge.md - Session knowledge templateEach template file includes:
Complete, real-world examples in examples/:
examples/pattern-example.md - Retry with Exponential Backoff patternexamples/problem-solution-example.md - Race Condition in Distributed Cacheexamples/decision-example.md - Database Choice (PostgreSQL vs MongoDB)examples/guidelines-example.md - Button Component Design GuidelinesRefer to examples when generating exportable documents to match quality and detail level.
.claude/docs/{category}/ structure.claude/sessions/ only when user requests them for sharingYYYYMMDD-HHMMSS-slug.md for chronological sorting