xarchitecture
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Generate and maintain comprehensive documentation from code
How it fires
How this command gets triggered: by you, by Claude, or both.
/xdocsContext preview
What this command does when you run it.
Generate and maintain comprehensive documentation from code
description: Generate and maintain comprehensive documentation from code tags: [documentation, generation, maintenance]
Generate and maintain documentation from code, keeping it in sync with implementation.
**Basic documentation generation:**
/xdocs
**Generate API documentation:**
/xdocs --api
**Check documentation coverage:**
/xdocs --check
**Generate README:**
/xdocs --readme
**Help and options:**
/xdocs --help
If $ARGUMENTS contains "help" or "--help": Display this usage information and exit.
Parse documentation options from $ARGUMENTS (--generate, --api, --readme, --check, or specific module/file).
Check existing documentation: !find . -name "*.md" | grep -v node_modules | head -20 !test -f README.md && echo "README exists" || echo "No README.md found" !find . -name "*.py" -exec grep -l '"""' {} \; | wc -l
Based on the arguments and project type, generate appropriate documentation.
For Python projects, extract docstrings: !python -c "import ast; import os; [print(f'{f}: {len([n for n in ast.walk(ast.parse(open(f).read())) if isinstance(n, ast.FunctionDef) and ast.get_docstring(n)])} documented functions') for f in os.listdir('.') if f.endswith('.py')]" 2>/dev/null
For JavaScript/TypeScript projects: !grep -E "^(export |const |function |class )" *.js *.ts 2>/dev/null | head -20
If --api flag is present, analyze API endpoints: !grep -r -E "@(app|router)\.(get|post|put|delete|patch)" . --include="*.py" 2>/dev/null | head -20 !grep -r -E "(app|router)\.(get|post|put|delete|patch)" . --include="*.js" 2>/dev/null | head -20
Count undocumented functions: !find . -name "*.py" -exec grep -E "^def |^class " {} \; | wc -l !find . -name "*.py" -exec grep -A1 -E "^def |^class " {} \; | grep '"""' | wc -l
Think step by step about documentation needs and:
1. Identify what documentation is missing 2. Generate appropriate documentation based on code analysis 3. Create templates for missing documentation 4. Ensure examples are included where helpful
Generate documentation in this format:
For README.md:
# Project Name Brief description of what this project does. ## Installation ```bash # Installation commands based on package.json or requirements.txt
# Example usage based on main entry points
[Description from docstring or inferred from code]
**Parameters:**
**Returns:**
**Example:**
# Example usage
See CONTRIBUTING.md for details.
[License information]
For API documentation:
```markdown
# API Documentation
## Endpoints
### GET /endpoint
Description of what this endpoint does.
**Parameters:**
- `param` (query/path/body): Description
**Response:**
```json
{
"field": "example"
}**Example:**
curl -X GET http://localhost:8000/endpoint
If --check flag is present, generate a documentation coverage report:
๐ DOCUMENTATION COVERAGE REPORT โโโโโโโโโโโโโโโโโโโโโโโโโโโโ Overall Coverage: X%
โ DOCUMENTED (X/Y) โโโโโโโโโโโโโโโโโ โ module.py: X/Y functions โ api.py: X/Y endpoints
โ MISSING DOCUMENTATION (X/Y) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ utils.py: functionName (line X) โ models.py: ClassName (line X)
๐ง QUICK FIXES โโโโโโโโโโโโ 1. Add docstring to functionName in utils.py 2. Document ClassName in models.py 3. Create API documentation for /endpoint
๐ TEMPLATES TO ADD โโโโโโโโโโโโโโโโ
If --generate flag with specific file, create documentation for that file. If --update flag, update existing documentation to match code changes.
Transform Claude Code into a complete development platform with 45 AI-powered commands that automate your entire software development workflow. Now with improved git identity management!
Design, analyze, and evolve system architecture using Domain-Driven Design, 12-Factor App, and proven patterns
Manage project configuration files, environment variables, and application settings
Continue an execution plan from where it left off across sessions
Interactive debugging support with error analysis and fix suggestions - integrates with Debug Specialist sub-agent for complexโฆ
Automate git workflow - stage, commit with smart messages, and push to specified branch