← All skills
Prompt · Slash command✓ Verified

Document

Add documentation comments to the current file or function.

What happens when you install it

1

You run the install command

mcp install-skill document

MCPHub CLI downloads this prompt from the registry.

2

Saved as a file in Claude Code

~/.claude/commands/document.md

Claude Code reads all .md files in this folder as slash commands.

3

Use it in any conversation

/documentin Claude Code (after restart)

Claude runs the prompt against your current file or selection — no copy-paste needed.

Content

Document

Add documentation to the selected code. Documentation should reduce the time a new developer needs to understand the code.

Format

Use the documentation standard for the language:

  • TypeScript/JavaScript — JSDoc (/** */)
  • Python — docstrings (""" """)
  • Go — godoc comments (// FunctionName ...)
  • Rust — doc comments (/// )

What to document

  • All public functions, methods, and classes
  • Non-obvious logic — explain the why, not the what
  • Parameters: name, type, what it represents, constraints, default
  • Return value: type and what it means
  • Errors/exceptions thrown and when
  • Side effects (mutations, I/O, network calls)

What not to document

  • The obvious: // increment i for i++
  • Implementation details that can be read from the code
  • Unstable internal state

Quality bar

Each doc comment should answer: "What do I need to know to use this correctly?"

Output

Return the original code with documentation added. Don't change any logic.