codingbeginner

Code Documentation Generator

Generates JSDoc, docstrings, or inline documentation for functions, classes, and modules.

Prompt

Generate comprehensive documentation for the following {{language}} code. Use the standard documentation format for the language (JSDoc for JavaScript/TypeScript, docstrings for Python, GoDoc for Go, Javadoc for Java).

For each public function/method/class, include:
- **Summary**: one-line description of what it does
- **Parameters**: name, type, description, default value, constraints
- **Returns**: type and description
- **Throws/Errors**: conditions that cause errors
- **Examples**: at least one usage example with expected output
- **Notes**: edge cases, performance characteristics, thread safety

Do NOT add documentation to trivial getters/setters or obvious one-liners.

```{{language}}
{{code}}
```

Variables

{{language}}{{code}}

Use Cases

  • Documenting undocumented codebases
  • Onboarding new team members
  • API reference generation

Compatible Models

claude-sonnet-4-20250514gpt-4o

Tags

documentationjsdocdocstringscomments

Details

Author
PromptIndex
Updated
2026-04-01
Difficulty
beginner

Related Prompts

  • Code Review Assistant

    Performs a thorough code review covering correctness, performance, security, and maintainability.

  • Bug Finder

    Identifies bugs, edge cases, and potential runtime errors in a code snippet.

  • Test Generator

    Generates comprehensive unit tests for a function or module with edge cases and mocks.