Agent skill
document
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", "documentar el conocimiento de la sesión", "document session knowledge", "capturar lo aprendido en la sesión", "crear documentación de", o quiere capturar conocimiento técnico de la sesión usando plantillas estructuradas.
Install this agent skill to your Project
npx add-skill https://github.com/DieGopherLT/dotclaudefiles/tree/main/plugins/dotclaudefiles/skills/document
SKILL.md
Document Skill
Generate structured technical documentation for specific knowledge elements discovered during development sessions.
Documentation Types
Pattern Documentation
For reusable code patterns, techniques, or solutions.
Template: references/templates/pattern.md
Example: examples/pattern-example.md (Retry with Exponential Backoff)
Problem-Solution Documentation
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)
Decision Documentation
For architectural decisions, technology choices, or trade-off analysis.
Template: references/templates/decision.md
Example: examples/decision-example.md (PostgreSQL vs MongoDB)
Guidelines Documentation
For design systems, code standards, or team conventions.
Template: references/templates/guidelines.md
Example: examples/guidelines-example.md (Button Component Guidelines)
Session Knowledge Documentation
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
Storage: .claude/docs/sessions/
Free-Form Documentation
For anything that doesn't fit other categories.
Template: references/templates/free-form.md
Documentation Process
Follow these steps to create documentation:
Step 1: Identify Document Type
Before identifying type: if this is a session documentation request, check your own context.
- If no code was modified in this session -> automatically use Session Knowledge (no git needed).
- If code was modified -> Session Knowledge is still an option but proceed with normal type selection.
Determine which type of documentation fits the user's intent:
- Pattern: Reusable solution or technique
- Problem-Solution: Bug fix or challenge resolved
- Decision: Choice between alternatives with rationale
- Guidelines: Standards or conventions
- Session Knowledge: Discussion, research, or analysis session with no code changes
- Free-Form: Doesn't fit other categories
Ask user if type is ambiguous: "Is this a pattern, problem-solution, or decision?"
Step 2: Load Appropriate Template
Read the corresponding template from references/templates/{type}.md (use absolute path ${CLAUDE_PLUGIN_ROOT}/skills/document/references/templates/{type}.md when loading):
pattern.mdfor patternsproblem-solution.mdfor problemsdecision.mdfor decisionsguidelines.mdfor guidelinessession-knowledge.mdfor session knowledgefree-form.mdfor free-form
Templates contain structure and field descriptions.
Step 3: Gather Information
Extract information from session context:
Auto-detect:
- Current timestamp (YYYY-MM-DD HH:MM:SS)
- Project name (from git repo or directory)
- Related commit hash (if in git repo and applicable)
- Relevant files modified/discussed
Ask user if needed:
- Document title
- Tags for categorization
- Additional context not in session
- Custom instructions for content
Use conversation context:
- Code discussed during session
- Problems encountered and solutions
- Decisions made and alternatives considered
- Patterns implemented
Step 4: Generate Document
Populate template with gathered information:
- Fill metadata section automatically
- Structure main content based on template
- Include code examples from session
- Reference relevant files
- Add appropriate tags
Content quality guidelines:
- Be specific and technical
- Include code examples where applicable
- Explain rationale, not just what was done
- Document trade-offs and alternatives
- Keep it concise but complete
Step 5: Determine Storage Location
Default location: .claude/docs/{category}/{filename}.md
Directory structure:
.claude/docs/
├── patterns/
├── problems/
├── decisions/
├── guidelines/
├── sessions/
└── free-form/
Filename format: {YYYYMMDD-HHMMSS}-{slug}.md
Example: 20260115-142345-retry-pattern.md
User can override:
- Custom directory path
- Custom filename
- Root directory if preferred
Step 6: Write and Confirm
- Write document to determined location
- Show user the path and brief summary
- Offer to open file for review/edits
Step 7: Git Ignore Check
After writing the file:
- Run:
git check-ignore -q <file_path> - If file IS ignored: proceed normally, nothing to do.
- If file is NOT ignored:
- Add the parent directory expression to
.gitignore(e.g..claude/docs/) - Inform the user that
.gitignorewas updated to exclude generated docs.
- Add the parent directory expression to
Metadata Fields
All documents include standard metadata:
- Timestamp: Auto-generated (YYYY-MM-DD HH:MM:SS)
- Project: Auto-detected from git or directory name
- Category: Document type (Pattern/Problem-Solution/Decision/Guidelines/Session Knowledge/Free-Form)
- Tags: Comma-separated tags for search
- Related Commit: Git commit hash if available (not applicable for Session Knowledge)
Tag Suggestions
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
Examples
Example 1: Documenting a Pattern
User says: "Document the retry pattern we implemented for the HTTP client"
Actions:
- Identify type: Pattern
- Load
references/templates/pattern.md - Extract from session:
- Retry implementation code
- Configuration approach
- Files modified
- Auto-detect:
- Timestamp: 2026-01-15 14:23:45
- Project: payment-service
- Commit: a3f7d92
- Ask user: "What should we call this pattern?" -> "Retry with Exponential Backoff"
- Generate document in
.claude/docs/patterns/20260115-142345-retry-pattern.md - Include: context, implementation, benefits, trade-offs
Example 2: Documenting a Problem
User says: "Document how we fixed that race condition in the cache"
Actions:
- Identify type: Problem-Solution
- Load
references/templates/problem-solution.md - Extract from session:
- Problem description
- Investigation steps
- Solution code
- Verification approach
- Auto-detect metadata
- Generate document in
.claude/docs/problems/20260115-164512-cache-race-condition.md - Include: problem statement, root cause, solution, prevention measures
Example 3: Documenting a Decision
User says: "Document why we chose PostgreSQL over MongoDB"
Actions:
- Identify type: Decision
- Load
references/templates/decision.md - Extract from session:
- Options considered
- Pros/cons of each
- Decision rationale
- Ask user about status: "Is this Proposed or Accepted?" -> "Accepted"
- Generate document in
.claude/docs/decisions/20260114-091530-postgresql-choice.md - Include: context, options, rationale, consequences, review criteria
Additional Resources
Template Reference Files
Detailed 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 templatereferences/templates/free-form.md- Free-form template
Each template file includes:
- When to use guidance
- Full template structure
- Field descriptions
- Best practices
Working Examples
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 Guidelines
Refer to examples when generating documents to match quality and detail level.
Best Practices
Content Quality
- Be specific: Include actual code, file names, specific details
- Include context: Explain why, not just what
- Show trade-offs: Document alternatives and their pros/cons
- Add examples: Code snippets clarify better than prose
- Reference files: List specific files and their roles
Organization
- Use appropriate category: Choose template that best fits content
- Tag consistently: Use suggested tag categories
- Follow naming: Use timestamp-slug filename format
- Store logically: Use
.claude/docs/{category}/structure
Writing Style
- Technical and precise: Assume technical audience
- Concise but complete: Cover all important aspects
- Markdown formatting: Use headers, lists, code blocks properly
- Link related docs: Reference other patterns/decisions when relevant
Notes
- Documentation saved in
.claude/docs/by default (can be overridden) - Filename format:
YYYYMMDD-HHMMSS-slug.mdfor chronological sorting - Metadata enables search and filtering later
- Templates are guidelines - adapt content to fit actual needs
- Session Knowledge type does not require git context - use session memory directly
- Free-form template for anything that doesn't fit other categories
- Always include code examples when documenting technical content
- Document trade-offs honestly - perfect solutions don't exist
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
plan-feature
smart-interview
Esta skill debe usarse cuando el usuario pregunta "¿Preguntas?", "¿Tienes dudas?", "¿Tienes preguntas?", "¿Quieres aclarar algo?", "¿Necesitas aclarar algo?", "aclara lo que necesites", o cuando quiere aterrizar requerimientos antes de planear. Tambien la invoca plan-feature en Phase 3. Ejecuta entrevista estructurada para obtener requerimientos cuantificables, reglas de negocio traducibles a codigo, y flujos del sistema; luego anota los resultados en el plan.
post-implementation
Esta skill debe usarse cuando el usuario pide "haz review de los cambios", "review the changes", "aplica el post-implementacion", "apply post-implementation", "run post-implementation", o cuando el plan aprobado instruye "invoke /smart-plan:post-implementation". Ejecuta workflow post-implementacion despues de que el codigo este completo con quality review (3 reviewers paralelos), auto-fix de issues (confianza >= 80%), documentacion del feature, y commit opcional. Puede usarse despues de cualquier implementacion, no solo smart-plan.
smart-delegation
Esta skill debe usarse cuando Claude detecta que una implementacion es lo suficientemente grande como para dividirla en sub-agentes (5+ archivos, dependencias entre cambios, nuevas abstracciones que otros archivos consumen), cuando el usuario pide "delega la implementacion", "orquesta los implementadores", "usa sub-agentes", "delegate to sub-agents", "orchestrate implementers", o cuando plan-feature invoca la delegacion tras aprobar un plan.
tdd-workflow
Esta skill debe usarse cuando el usuario pide "aplicar TDD", "desarrollo guiado por tests", "test-driven development", "red green refactor", "ciclo RGR", "escribir tests primero", "nueva feature con TDD", "mejorar testabilidad", "filosofia TDD", o menciona Iron Laws, TDD philosophy, o quiere entender el proceso TDD. NO usar cuando el usuario pide agregar tests a un proyecto existente o setup de testing — eso es testing:add-testing.
add-testing
Esta skill debe usarse cuando el usuario pide "agregar tests a proyecto existente", "add testing to existing project", "setup de testing", "configurar infraestructura de tests", "pipeline completo de testing", "quiero tests para este modulo", "agregar cobertura de tests", "add test coverage", "integrar testing al proyecto". Ejecuta pipeline completo de 7 pasos: auditoria de testabilidad, adaptacion condicional de codigo, investigacion de dependencias, implementacion de tests, auditoria de calidad de inputs, reporte de cobertura y generacion de reglas del proyecto.
Didn't find tool you were looking for?