Skip to main content
command CX Codex

document — Claude Code command: what it does, how to install

document builds inline comments, API references, component guides, and user manuals directly from code analysis.

MIT ★ 23,950 updated 2026-09-27

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/document.md
Open on GitHub

What document does

The command targets specific files or directories to create documentation matching your project context. It runs a structured flow: inspecting functions and schemas, identifying target formats, generating text, and saving it via file tools like Read, Grep, and Write.

You control output via flags: --type accepts inline, external, api, or guide, while --style switches between brief and detailed. It extracts JSDoc annotations, parameters, and return types for source files, or structures full endpoint overviews for API directories.

The command refuses to document code without sufficient structural context and respects existing project documentation conventions without exposing sensitive internal details.

What it helps with

  • generate JSDoc or docstrings for functions and classes
  • build API reference docs with endpoints and data schemas
  • write user guides with practical code integration examples
  • document component libraries with prop specifications

Example prompts for the agent

  • /sc:document src/auth/login.js --type inline
  • /sc:document src/api --type api --style detailed
  • /sc:document components/ --type external

How to install document

Manually: put the files in place

.claude/commands/document.md

Call it with /document. For all projects use ~/.claude/commands/

Questions about document

How to install document in Claude Code?

Place the command specification file into .claude/commands/document.md within your project repository.

What does the document command do?

It examines target code structures, extracts interfaces, and generates inline comments, API references, or external guides based on selected flags.

Does document require additional MCP servers?

No, it requires no external MCP servers and works directly using standard file read and write operations.

Source text

document.md · MIT
---
name: document
description: "Generate focused documentation for components, functions, APIs, and features"
category: utility
complexity: basic
mcp-servers: []
personas: []
---

# /sc:document - Focused Documentation Generation

## Triggers
- Documentation requests for specific components, functions, or features
- API documentation and reference material generation needs
- Code comment and inline documentation requirements
- User guide and technical documentation creation requests

## Usage
```
/sc:document [target] [--type inline|external|api|guide] [--style brief|detailed]
```

## Behavioral Flow
1. **Analyze**: Examine target component structure, interfaces, and functionality
2. **Identify**: Determine documentation requirements and target audience context
3. **Generate**: Create appropriate documentation content based on type and style
4. **Format**: Apply consistent structure and organizational patterns
5. **Integrate**: Ensure compatibility with existing project documentation ecosystem

Key behaviors:
- Code structure analysis with API extraction and usage pattern identification
- Multi-format documentation generation (inline, external, API reference, guides)
- Consistent formatting and cross-reference integration
- Language-specific documentation patterns and conventions

## Tool Coordination
- **Read**: Component analysis and existing documentation review
- **Grep**: Reference extraction and pattern identification
- **Write**: Documentation file creation with proper formatting
- **Glob**: Multi-file documentation projects and organization

## Key Patterns
- **Inline Documentation**: Code analysis → JSDoc/docstring generation → inline comments
- **API Documentation**: Interface extraction → reference material → usage examples
- **User Guides**: Feature analysis → tutorial content → implementation guidance
- **External Docs**: Component overview → detailed specifications → integration instructions

## Examples

### Inline Code Documentation
```
/sc:document src/auth/login.js --type inline
# Generates JSDoc comments with parameter and return descriptions
# Adds comprehensive inline documentation for functions and classes
```

### API Reference Generation
```
/sc:document src/api --type api --style detailed
# Creates comprehensive API documentation with endpoints and schemas
# Generates usage examples and integration guidelines
```

### User Guide Creation
```
/sc:document payment-module --type guide --style brief
# Creates user-focused documentation with practical examples
# Focuses on implementation patterns and common use cases
```

### Component Documentation
```
/sc:document components/ --type external
# Generates external documentation files for component library
# Includes props, usage examples, and integration patterns
```

## Boundaries

**Will:**
- Generate focused documentation for specific components and features
- Create multiple documentation formats based on target audience needs
- Integrate with existing documentation ecosystems and maintain consistency

**Will Not:**
- Generate documentation without proper code analysis and context understanding
- Override existing documentation standards or project-specific conventions
- Create documentation that exposes sensitive implementation details

© SuperClaude-Org · MIT · SuperClaude-Org/SuperClaude_Framework

Similar slash commands

All slash commands for Writing and docs →

From the same set56

The whole set →
root-cause-analyst The root-cause-analyst subagent for Claude Code systematically investigates failures and complex errors by collecting evidence and testing hypotheses. It finds root causes rather than patching symptoms. CX Codex ★ 23,950repo stars security-engineer The security-engineer subagent reviews code for vulnerabilities, maps attack paths, and checks security standards. Use it for audits and risk analysis. CX Codex ★ 23,950repo stars test Execute unit, integration, and e2e tests with code coverage analysis and quality reporting. Auto-detects test frameworks and supports watch mode for continuous testing during development. CX Codex +1 ★ 23,950repo stars python-expert python-expert writes production Python code guided by SOLID principles and clean architecture. Useful when you need test-driven development, 95%+ test coverage, and OWASP security. CX Codex ★ 23,950repo stars build Handles building, compiling, and packaging projects with automatic error detection and artifact optimization. Runs from Claude Code with configurable environments and build types. CX Codex +1 ★ 23,950repo stars analyze analyze reviews code for quality, security, performance, and architecture. Use it for a whole project or a selected directory. CX Codex +1 ★ 23,950repo stars load Loads project context via Serena MCP and restores cross-session memory. Runs at session start or when switching between projects. CX Codex +1 ★ 23,950repo stars design design plans system architecture, API specifications, and database schemas before coding starts. Useful for creating technical contracts and component diagrams. CX Codex +1 ★ 23,950repo stars

Project sponsors

Companies that keep this analytics open