- Version: 2.0
Generates comprehensive documentation for implemented stories including user guides, technical specs, testing docs, and inline code comments.
/plugin marketplace add ninthspace/claude-code-marketplace/plugin install sdd@ninthspace-marketplacePurpose: Analyze story implementation and generate user, technical, and testing documentation with examples and inline code comments.
Syntax: /sdd:story-document [story_id]
| Parameter | Type | Required | Default | Description | Validation |
|---|---|---|---|---|---|
| story_id | string | No | current active | Story ID to document (format: STORY-YYYY-NNN) | Must be valid story ID |
/docs/stories/development/ or /docs/stories/review//docs/project-context//docs/stories/development//docs/stories/development/[story-id].md/docs/stories/review/[story-id].md/docs/stories/qa/[story-id].md/sdd:project-status to find valid story IDsREAD story file to extract:
SCAN codebase to identify implementation:
LOAD project context:
/docs/project-context/technical-stack.md - Framework conventions/docs/project-context/coding-standards.md - Documentation style/docs/project-context/development-process.md - Doc requirementsGenerate Multiple Documentation Types:
USER DOCUMENTATION (if user-facing feature):
/docs/features/[feature-name].mdTECHNICAL DOCUMENTATION:
/docs/technical/[feature-name].mdTESTING DOCUMENTATION:
/docs/testing/[feature-name].mdINLINE CODE DOCUMENTATION:
CODE EXAMPLES:
/docs/examples/[feature-name]/UPDATE project-level docs:
/README.md - Add feature to feature list (if user-facing)/docs/api.md - Add API endpoints (if applicable)/docs/configuration.md - Add new config options/CHANGELOG.md - Document changes/docs/migration.md - Add migration guide (if breaking changes)PRESERVE existing content:
UPDATE story file with documentation summary:
## Documentation
### Generated Documentation
- User Guide: /docs/features/[feature-name].md
- Technical: /docs/technical/[feature-name].md
- Testing: /docs/testing/[feature-name].md
- Examples: /docs/examples/[feature-name]/
### Updated Documentation
- README.md: Added feature to feature list
- CHANGELOG.md: Documented changes for v[version]
### Inline Documentation
- Added PHPDoc blocks to [count] functions
- Documented [count] component props
- Added complex logic comments in [file:line]
### Documentation Status
- [x] User documentation complete
- [x] Technical documentation complete
- [x] Testing documentation complete
- [x] Inline code comments added
- [x] Examples created
- [ ] Screenshots needed (optional)
- [ ] Diagrams needed (optional)
CHECK documentation completion criteria:
DISPLAY documentation summary:
✅ Documentation Generated
═══════════════════════════════════
Story: [STORY-YYYY-NNN] - [Title]
DOCUMENTATION CREATED:
✓ User Guide: /docs/features/[feature-name].md
✓ Technical: /docs/technical/[feature-name].md
✓ Testing: /docs/testing/[feature-name].md
✓ Examples: /docs/examples/[feature-name]/
DOCUMENTATION UPDATED:
✓ README.md (feature list)
✓ CHANGELOG.md (version notes)
[✓ Migration guide (if breaking changes)]
INLINE DOCUMENTATION:
✓ [count] functions documented
✓ [count] components documented
✓ [count] complex logic comments
DOCUMENTATION DEBT:
[- Screenshots recommended for user guide]
[- Sequence diagram would help explain flow]
Story Updated: Documentation section added
SUGGEST next steps:
💡 NEXT STEPS:
1. Review generated documentation for accuracy
2. Add screenshots/diagrams if noted
3. /sdd:story-review [story-id] # Move to code review
4. Share docs with team for feedback
/docs/features/[feature-name].md - User-facing documentation/docs/technical/[feature-name].md - Technical documentation/docs/testing/[feature-name].md - Testing documentation/docs/examples/[feature-name]/ - Code examples# [Feature Name]
## Overview
[What the feature does and why it exists]
## Prerequisites
[What user needs before using this feature]
## Getting Started
### Quick Start
[Simplest possible example to get started]
### Step-by-Step Guide
1. [First step with clear instructions]
2. [Second step]
3. [Continue...]
## Usage Examples
### Example 1: [Common Use Case]
[Description of scenario]
```[language]
[Code example]
[Expected result]
[Description]
[Code example]
| Option | Type | Default | Description |
|---|---|---|---|
| [option] | [type] | [default] | [what it does] |
[Example configuration]
Problem: [Description] Solution: [How to fix]
Problem: [Description] Solution: [How to fix]
### Technical Documentation Template
```markdown
# [Feature Name] - Technical Documentation
## Architecture Overview
[High-level architecture description]
## Components
### [Component 1]
**Purpose**: [What it does]
**Location**: [File path]
**Dependencies**: [What it depends on]
**Public Interface**:
```[language]
[Key methods/functions]
Usage:
[How to use it]
[Same structure]
[Description of how data flows through the system]
[Diagram or flowchart in text/Mermaid format]
[Full signature]
Parameters:
param1 ([type]): [Description]param2 ([type]): [Description]Returns: [Return type and description]
Throws: [Exceptions that can be thrown]
Example:
[Usage example]
| Variable | Required | Default | Description |
|---|---|---|---|
| [VAR] | [Yes/No] | [default] | [what it does] |
[List of config files and their purpose]
[Step-by-step integration instructions]
[Available hooks/events for extending functionality]
[Link to testing documentation]
[Link to user documentation troubleshooting section]
### Testing Documentation Template
```markdown
# Testing: [Feature Name]
## Test Coverage Summary
- Unit Tests: [count] tests, [X]% coverage
- Integration Tests: [count] tests
- E2E Tests: [count] tests
- Manual Tests: [count] scenarios
## Running Tests
### All Tests
```bash
[Command to run all tests]
[Command to run unit tests]
[Command to run integration tests]
Given: [Initial state] When: [Action taken] Then: [Expected result]
Test: [Test file and function name]
Given: [Initial state] When: [Action taken] Then: [Expected error handling]
Test: [Test file and function name]
[If applicable, performance test results]
[How to set up test data or where test fixtures are located]
## Examples
### Example 1: Document Current Active Story
```bash
INPUT:
/sdd:story-document
OUTPUT:
→ Finding active story...
→ Located: STORY-2025-003 in /docs/stories/development/
→ Analyzing implemented features...
→ Scanning codebase for TaskManager component...
→ Generating documentation...
✅ Documentation Generated
═══════════════════════════════════
Story: STORY-2025-003 - Task Management System
DOCUMENTATION CREATED:
✓ User Guide: /docs/features/task-management.md
✓ Technical: /docs/technical/task-management.md
✓ Testing: /docs/testing/task-management.md
✓ Examples: /docs/examples/task-management/
DOCUMENTATION UPDATED:
✓ README.md (added to feature list)
✓ CHANGELOG.md (documented for v1.2.0)
INLINE DOCUMENTATION:
✓ 12 functions documented with PHPDoc
✓ 3 Livewire components documented
✓ 5 complex logic sections commented
DOCUMENTATION DEBT:
- Screenshots recommended for user guide
- Consider adding sequence diagram for task lifecycle
Story Updated: Documentation section added
💡 NEXT STEPS:
1. Review generated documentation for accuracy
2. Add screenshots to user guide
3. /sdd:story-review STORY-2025-003 # Move to code review
4. Share docs with team for feedback
INPUT:
/sdd:story-document STORY-2025-005
OUTPUT:
→ Locating story: STORY-2025-005...
→ Found in /docs/stories/review/
→ Analyzing authentication implementation...
→ Generating documentation...
✅ Documentation Generated
═══════════════════════════════════
Story: STORY-2025-005 - User Authentication
DOCUMENTATION CREATED:
✓ User Guide: /docs/features/authentication.md
✓ Technical: /docs/technical/authentication.md
✓ Testing: /docs/testing/authentication.md
✓ Examples: /docs/examples/authentication/
✓ Migration Guide: /docs/migration-v2.md (breaking changes)
DOCUMENTATION UPDATED:
✓ README.md (security section)
✓ CHANGELOG.md (v2.0.0 breaking changes)
✓ docs/api.md (auth endpoints)
INLINE DOCUMENTATION:
✓ 8 controller methods documented
✓ 4 middleware classes documented
✓ Security notes added to sensitive functions
Story Updated: Documentation section added
💡 NEXT STEPS:
1. Review security documentation carefully
2. /sdd:story-review STORY-2025-005 # Continue review process
INPUT:
/sdd:story-document STORY-2025-007
OUTPUT:
→ Locating story: STORY-2025-007...
→ Found in /docs/stories/development/
→ Analyzing REST API implementation...
→ Extracting API endpoints and schemas...
→ Generating OpenAPI specification...
✅ Documentation Generated
═══════════════════════════════════
Story: STORY-2025-007 - REST API for Tasks
DOCUMENTATION CREATED:
✓ API Reference: /docs/api/tasks.md
✓ Technical: /docs/technical/api-tasks.md
✓ Testing: /docs/testing/api-tasks.md
✓ OpenAPI Spec: /docs/openapi/tasks.yaml
✓ Postman Collection: /docs/examples/tasks.postman.json
DOCUMENTATION UPDATED:
✓ docs/api.md (added tasks endpoints)
✓ README.md (API section)
✓ CHANGELOG.md (new API endpoints)
INLINE DOCUMENTATION:
✓ 6 API endpoints documented
✓ Request/response schemas defined
✓ Error responses documented
Story Updated: Documentation section added
💡 NEXT STEPS:
1. Test with Postman collection
2. Share OpenAPI spec with frontend team
3. /sdd:story-review STORY-2025-007
/sdd:project-status to list valid stories/sdd:story-implement [id] first/sdd:project-status/sdd:story-implement [id] - Generate implementation first/sdd:story-review [id] - Move to code review after documentation/sdd:story-test [id] - Verify tests before documenting/sdd:project-status - Find stories to document