This guide covers the Documentation Kitty mission, which helps you create and maintain high-quality software documentation following Write the Docs and Divio principles.
The Documentation Mission provides a structured workflow for generating comprehensive documentation across four distinct types (Divio system), with automated gap analysis and support for API reference generation from code.
Key Features:
Create comprehensive documentation for a new project:
# In your project root
cd kitty-specs/
/spec-kitty.specify Create comprehensive documentation for our project, covering all four Divio types
When prompted, specify:
initialtutorial, how-to, reference, explanationdevelopers (or end-users, contributors, operators)sphinx for Python)Then proceed with planning and implementation:
/spec-kitty.plan We'll use Sphinx for Python API docs, organize by feature modules
/spec-kitty.tasks
/spec-kitty.implement
Identify and fill gaps in existing documentation:
/spec-kitty.specify Audit existing documentation and fill identified gaps
When prompted:
gap_fillingThe mission will:
docs/ directoryDocument a specific feature or component:
/spec-kitty.specify Document the new authentication system
When prompted:
feature_specifichow-to, reference for API features)The Documentation Mission follows a six-phase workflow:
Purpose: Identify documentation needs and target audience
Activities:
Artifacts Created:
spec.md - Documentation requirements and scopePurpose: Analyze existing documentation and identify gaps
Activities:
Artifacts Created:
gap-analysis.md - Comprehensive audit report with coverage matrixGap Analysis Output Example:
## Coverage Matrix
| Area | tutorial | how-to | reference | explanation |
|------|----------|--------|-----------|-------------|
| auth | ✓ | ✗ | ✓ | ✗ |
| api | ✗ | ✓ | ✓ | ✗ |
| cli | ✓ | ✓ | ✗ | ✗ |
**Coverage**: 6/12 cells = 50.0%
## Identified Gaps
### High Priority
- **auth → how-to**: Users need how-tos to solve common problems and tasks
- **cli → reference**: Users need API reference to use core features
### Medium Priority
- **api → tutorial**: Users need tutorials for advanced features
Purpose: Plan documentation structure and select generators
Activities:
Artifacts Created:
plan.md - Documentation structure and generator configdivio-templates/ - Template files for each Divio typegenerator-configs/ - Configuration for JSDoc/Sphinx/rustdocPurpose: Create documentation from templates and generators
Activities:
Artifacts Created:
docs/ directorydocs/api/python/)Purpose: Check quality, accessibility, and completeness
Activities:
Validation Checks:
Purpose: Deploy documentation and notify stakeholders
Activities:
Artifacts Created:
publish.md - Deployment record and access URLsThe mission uses the Divio 4-type documentation system, where each type serves a distinct purpose:
Purpose: Learning-oriented, teaches a beginner
Characteristics:
Example Structure:
# Getting Started with [Project]
## What You'll Build
By the end of this tutorial, you'll have a working...
## Prerequisites
- Python 3.11+
- Basic command line knowledge
## Step 1: Installation
First, install the package...
## Step 2: Your First [Feature]
Now let's create...
## Next Steps
You've learned the basics. Next, explore...
When to Use:
Purpose: Task-oriented, solves a specific problem
Characteristics:
Example Structure:
# How to Configure OAuth Authentication
## Problem
You need to add OAuth authentication to your application.
## Prerequisites
- Existing application setup
- OAuth provider credentials
## Solution
### Step 1: Install Dependencies
```bash
pip install authlib
…
…
Test your OAuth flow by…
When to Use:
Purpose: Information-oriented, describes the API
Characteristics:
Example Structure:
# API Reference
## Module: authentication
### Function: `validate_token(token: str) -> bool`
Validates an authentication token.
**Parameters**:
- `token` (str): The JWT token to validate
**Returns**:
- `bool`: True if valid, False otherwise
**Raises**:
- `TokenExpiredError`: If token has expired
- `InvalidSignatureError`: If signature verification fails
**Example**:
```python
is_valid = validate_token("eyJ0eXAiOiJKV1QiLCJh...")
**When to Use**:
- Documenting all APIs
- Providing lookup information
- Supporting experienced users
- Generating from code comments
### Explanation
**Purpose**: Understanding-oriented, explains concepts
**Characteristics**:
- Discusses why, not how
- Provides background and context
- Explains architecture and design
- Explores alternatives and trade-offs
- Deepens understanding
**Example Structure**:
```markdown
# Authentication Architecture
## Why Token-Based Authentication?
Traditional session-based authentication...
## How It Works
When a user logs in, the system...
[Architecture diagram]
## Design Decisions
### Why JWT Over Session Cookies?
We chose JWT tokens because...
**Trade-offs**:
- ✓ Stateless (scales horizontally)
- ✓ Works across domains
- ✗ Cannot revoke individual tokens
- ✗ Larger payload than session ID
### Alternative Approaches Considered
We also evaluated...
## Security Considerations
Token-based authentication introduces...
When to Use:
The mission supports three API reference generators:
Detection: Automatically enabled if project contains:
package.json file.js, .jsx, .ts, or .tsx filesConfiguration:
{
"source": {
"include": ["src/"],
"includePattern": ".+\\.(js|jsx|ts|tsx)$"
},
"opts": {
"destination": "docs/api/javascript",
"recurse": true,
"template": "node_modules/docdash"
}
}
Setup:
npm install --save-dev jsdoc docdash
npx jsdoc -c jsdoc.json
Output: HTML documentation in docs/api/javascript/
Detection: Automatically enabled if project contains:
setup.py or pyproject.toml file.py filesConfiguration (conf.py):
project = 'Your Project'
extensions = [
'sphinx.ext.autodoc', # Auto-generate from docstrings
'sphinx.ext.napoleon', # Google/NumPy style docstrings
'sphinx.ext.viewcode', # Link to source code
]
# Napoleon settings for Google-style docstrings
napoleon_google_docstring = True
napoleon_numpy_docstring = True
Setup:
pip install sphinx sphinx-rtd-theme
def validate_token(token: str) -> bool:
"""Validate an authentication token.
Args:
token: The JWT token to validate
Returns:
True if valid, False otherwise
Raises:
TokenExpiredError: If token has expired
"""
# Implementation...
sphinx-build -b html docs/ docs/_build/html/
Output: HTML documentation in docs/_build/html/
Detection: Automatically enabled if project contains:
Cargo.toml file.rs filesConfiguration (in Cargo.toml):
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--document-private-items"] # Optional: include private APIs
Setup:
/// Validates an authentication token.
///
/// # Arguments
///
/// * `token` - The JWT token to validate
///
/// # Returns
///
/// Returns `true` if valid, `false` otherwise
///
/// # Errors
///
/// Returns `TokenError` if token is expired or invalid
pub fn validate_token(token: &str) -> Result<bool, TokenError> {
// Implementation...
}
cargo doc --no-deps --target-dir docs/output/
Output: HTML documentation in docs/output/doc/
Use Case: Creating documentation for a new project with no existing docs
Behavior:
State Persisted:
{
"iteration_mode": "initial",
"divio_types_selected": ["tutorial", "how-to", "reference", "explanation"],
"generators_configured": [
{
"name": "sphinx",
"language": "python",
"config_path": "docs/conf.py"
}
],
"target_audience": "developers",
"last_audit_date": null,
"coverage_percentage": 0.0
}
Use Case: Iterating on existing documentation to fill identified gaps
Behavior:
State Persisted:
{
"iteration_mode": "gap_filling",
"divio_types_selected": [], // Analyze all types
"generators_configured": [...], // Existing generators
"target_audience": "developers",
"last_audit_date": "2026-01-13T15:00:00Z",
"coverage_percentage": 0.67 // 67% coverage after audit
}
Gap Prioritization Rules:
Use Case: Documenting a specific feature or component
Behavior:
State Persisted:
{
"iteration_mode": "feature_specific",
"divio_types_selected": ["how-to", "reference"], // Only relevant types
"generators_configured": [...],
"target_audience": "developers",
"last_audit_date": "2026-01-13T15:00:00Z",
"coverage_percentage": 0.75 // Project-wide coverage
}
Error: GeneratorError: sphinx-build not found - install Sphinx to use this generator
Solution: Install the required generator tool:
# Sphinx (Python)
pip install sphinx sphinx-rtd-theme
# JSDoc (JavaScript)
npm install --save-dev jsdoc docdash
# rustdoc (Rust) - comes with Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Error: conf.py not found - run configure() first
Solution: The generator configuration step failed. Manually run:
# During /spec-kitty.plan phase
# Generator configuration should be created automatically
# If missing, check plan.md for generator setup instructions
Issue: Gap analysis shows low confidence for document types
Cause: Documents lack frontmatter with explicit type field
Solution: Add frontmatter to existing docs:
---
type: tutorial # or how-to, reference, explanation
title: Getting Started
---
# Getting Started
...
Issue: API reference docs exist but show as gaps
Cause: Auto-generated docs may not be in docs/ directory
Solution: Configure generator output paths to write to docs/api/:
# Sphinx conf.py
html_output = 'docs/api/python/'
# JSDoc config
"opts": {
"destination": "docs/api/javascript"
}
Issue: Gap analysis shows “unknown” framework
Solution: Add framework indicator file:
docs/conf.pymkdocs.ymldocusaurus.config.jsError: Validation failed: templates_populated check failed
Cause: Template files contain placeholders like [TODO: ...]
Solution: Replace all placeholders with actual content:
# Before
## Prerequisites
[TODO: List prerequisites]
# After
## Prerequisites
- Python 3.11 or later
- pip package manager
Scenario: Document a new Python CLI tool from scratch
Step 1: Specify
/spec-kitty.specify Create comprehensive documentation for our CLI tool
Responses to prompts:
initialtutorial, how-to, reference, explanationdeveloperssphinxStep 2: Plan
/spec-kitty.plan
- Tutorial: Getting started guide showing installation and first command
- How-tos: Common tasks (configuring, deploying, troubleshooting)
- Reference: Full CLI command reference (auto-generated from argparse)
- Explanation: Architecture and design decisions
- Use Sphinx with autodoc for API reference
- Organize as docs/tutorial/, docs/howto/, docs/reference/, docs/explanation/
Step 3: Generate Tasks
/spec-kitty.tasks
Output includes work packages like:
Step 4: Implement
/spec-kitty.implement
Agent creates:
docs/conf.py (Sphinx configuration)docs/tutorial/getting-started.mddocs/howto/configuring.md, docs/howto/deploying.mddocs/reference/cli.md (generated from argparse)docs/explanation/architecture.mdStep 5: Review and Accept
/spec-kitty.review
/spec-kitty.accept
Result: Complete documentation suite ready for deployment
Scenario: Existing project has API reference but missing tutorials and how-tos
Step 1: Specify
/spec-kitty.specify Audit documentation and fill gaps
Responses to prompts:
gap_fillingdevelopersStep 2: Gap Analysis
Automatic audit generates gap-analysis.md:
## Coverage Matrix
| Area | tutorial | how-to | reference | explanation |
|------|----------|--------|-----------|-------------|
| cli | ✗ | ✗ | ✓ | ✗ |
| api | ✗ | ✗ | ✓ | ✗ |
| auth | ✗ | ✗ | ✓ | ✗ |
**Coverage**: 3/12 cells = 25.0%
## Identified Gaps
### High Priority
- **cli → tutorial**: New users need tutorials to get started
- **api → tutorial**: New users need tutorials to get started
- **auth → tutorial**: New users need tutorials to get started
### Medium Priority
- **cli → how-to**: Users need how-tos to solve common problems
- **api → how-to**: Users need how-tos to solve common problems
- **auth → how-to**: Users need how-tos to solve common problems
Step 3: Plan
/spec-kitty.plan
Focus on high-priority gaps first:
- Tutorial for CLI: "Getting Started with CLI"
- Tutorial for API: "Building Your First Integration"
- Tutorial for Auth: "Implementing Authentication"
Then medium-priority:
- How-to for CLI: "Common CLI Tasks"
- How-to for API: "API Integration Patterns"
- How-to for Auth: "Configuring OAuth"
Step 4: Generate Tasks
Tasks focus on filling gaps:
Step 5: Implement and Validate
After implementation, re-run gap analysis:
# In validate phase, gap analysis runs again
# New coverage: 9/12 cells = 75.0%
Result: High-priority gaps filled, documentation coverage improved from 25% to 75%
Documentation state is persisted in kitty-specs/<feature>/meta.json under the documentation_state field. This enables:
State is automatically managed during the workflow. No manual editing required.
The Documentation Mission is defined in src/specify_cli/missions/documentation/mission.yaml:
name: "Documentation Kitty"
domain: "other"
workflow:
phases:
- discover
- audit
- design
- generate
- validate
- publish
artifacts:
required:
- spec.md
- plan.md
- tasks.md
- gap-analysis.md
optional:
- divio-templates/
- generator-configs/
- audit-report.md
- research.md
Mission-specific commands customize behavior:
/spec-kitty.specify prompts for iteration mode, Divio types, generators/spec-kitty.plan prompts for documentation structure, generator configs/spec-kitty.implement generates docs from templates and invokes generators/spec-kitty.review validates Divio adherence, accessibility, completenessFor contributors interested in the implementation:
src/specify_cli/missions/documentation/mission.yamlsrc/specify_cli/gap_analysis.pysrc/specify_cli/doc_generators.pysrc/specify_cli/doc_state.pyThese files are in the Spec Kitty source repository.