/document-feature
Create comprehensive documentation for features, maintaining living documentation that evolves with your code.
Overview
- Purpose: Intelligent feature documentation
- Category: Core Orchestration
- Type: Dynamic prompt
- MCP Tools: None (documentation generation)
Syntax
bash
/document-feature [feature-name]Usage Examples
bash
# Document specific feature
/document-feature "authentication system"
# Document recent implementation
/document-feature "shopping cart"
# Document API endpoints
/document-feature "user management API"
# Document integration
/document-feature "Stripe payment integration"Documentation Created
Feature Documentation
Creates CLAUDE.md in feature directory:
markdown
# Authentication System
## Overview
JWT-based authentication with refresh tokens
## Architecture
- Token generation in /lib/auth/tokens.ts
- Middleware in /middleware/auth.ts
- User model in /models/User.ts
## Implementation Details
- Access tokens: 15 minutes
- Refresh tokens: 7 days
- Secure httpOnly cookies
- Role-based permissions
## API Endpoints
- POST /auth/login
- POST /auth/register
- POST /auth/refresh
- POST /auth/logout
## Security Measures
- Password hashing with bcrypt
- Rate limiting on auth endpoints
- CSRF protection
- Session invalidation
## Usage Examples
```typescript
// Login example
const { token } = await auth.login(email, password);Testing
- Unit tests: /tests/auth/unit
- Integration: /tests/auth/integration
- Coverage: 95%
Future Improvements
- Add OAuth providers
- Implement 2FA
- Add device management
### API Documentation
Generates OpenAPI/Swagger specs when applicable
### User Documentation
Creates user-facing guides in `/docs`
## Best Practices
## Prompt Adaptation
This prompt dynamically adapts based on:
### Context Discovery
- Analyzes current project state and structure
- Discovers existing patterns and conventions
- Understands team workflows and preferences
- Adapts to technology stack and architecture
### Intelligence Patterns
- Learns from previous executions in the project
- Adapts complexity based on team expertise
- Prioritizes based on project phase
- Suggests optimizations from accumulated knowledge
## Memory Integration
This prompt actively uses and updates distributed memory:
### Reads From
- `CLAUDE.md` - Project context and conventions
- `.orchestre/` - Orchestration state and patterns
- Feature-specific CLAUDE.md files
- Previous execution results
### Updates
- Relevant CLAUDE.md files with new insights
- `.orchestre/` with execution patterns
- Documentation as part of the workflow
- Pattern library with successful approaches
### 1. Document While Fresh
```bash
/execute-task "Implement feature"
/document-feature "feature" # Document immediately2. Include Examples
Documentation includes:
- Code examples
- API calls
- Common use cases
- Error scenarios
3. Living Documentation
Updates existing docs rather than replacing
Integration
With Development Flow
bash
/execute-task "Add payment processing"
/document-feature "payment processing"
/review # Reviews include documentationWith Learning
bash
/learn patterns
/document-feature "discovered patterns"Output
📝 Documenting Feature: Authentication System
🔍 Analyzing implementation...
Found 12 files related to authentication
📋 Generating documentation...
✅ Created src/auth/CLAUDE.md
✅ Updated API documentation
✅ Added usage examples
✅ Documented security measures
✅ Created test documentation
📊 Documentation Coverage:
- Technical: 100%
- API: 100%
- Examples: 8 scenarios
- Tests: Documented
💡 Suggestions:
- Add troubleshooting section
- Include performance metrics
- Document error codesDirect Invocation
This is a dynamic prompt that Claude executes directly - no file installation needed:
bash
# Simply type the command
/document-feature [parameters]
# Claude will:
# 1. Analyze current context
# 2. Discover relevant patterns
# 3. Execute intelligently
# 4. Update distributed memory
# 5. Provide detailed resultsRelated
- /discover-context - Find what to document
- /learn - Extract patterns to document
- Memory System - Documentation strategy
