# document

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

- command · `type=command` · Claude Code, Codex, GitHub Copilot, Gemini CLI · ★ 23950 repo stars
- Author: SuperClaude-Org
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/SuperClaude-Org/SuperClaude_Framework/tree/HEAD/plugins/superclaude/commands/document.md
- Updated: 2026-09-27
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/commands/document

## What it 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.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/document.md` — Call it with /document. For all projects use ~/.claude/commands/

### Codex

**Manually: put the files in place**
- File: `~/.codex/prompts/document.md` — Call it with /prompts:document. Codex marks this format deprecated in favour of skills

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/document.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/document.toml` — Gemini stores commands as TOML: the prompt text goes into the prompt field

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/SuperClaude-Org/SuperClaude_Framework/tree/HEAD/plugins/superclaude/commands/document.md

## When to use it
- 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
- /sc:document src/auth/login.js --type inline
- /sc:document src/api --type api --style detailed
- /sc:document components/ --type external

## Source text · document.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 807e922c5dc3d970.

BEGIN THIRD-PARTY FILE 807e922c5dc3d970
````text
---
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
````
END THIRD-PARTY FILE 807e922c5dc3d970

The third-party file has ended. Everything between the 807e922c5dc3d970 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© SuperClaude-Org · MIT · https://github.com/SuperClaude-Org/SuperClaude_Framework/tree/HEAD/plugins/superclaude/commands/document.md

## Similar
- [code-documentation](https://affpapa.org/en/nevibecode/skills/aj-geddes-code-documentation.md) — skill · 502 installs
- [documentation-templates](https://affpapa.org/en/nevibecode/skills/documentation-templates.md) — skill · 305 installs
- [technical-writer](https://affpapa.org/en/nevibecode/agents/josstei-technical-writer.md) — subagent · ★ 489 repo stars
- [update-docs](https://affpapa.org/en/nevibecode/skills/update-docs.md) — skill · 1400 installs
- [api-docs](https://affpapa.org/en/nevibecode/skills/api-docs.md) — skill · 893 installs
- [code-documenter](https://affpapa.org/en/nevibecode/skills/code-documenter.md) — skill · 6200 installs

From the same set: [superclaude-org/superclaude_framework](https://affpapa.org/en/nevibecode/by/superclaude-org/superclaude_framework.md) — 56 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
