Code Documentation with JSDoc
Add comprehensive JSDoc documentation to existing code
Add comprehensive JSDoc documentation to this code:
```typescript
[PASTE_YOUR_CODE]
```
For each function/method, add:
- **@description** — what it does (one sentence)
- **@param** — each parameter with type and description
- **@returns** — return type and what it represents
- **@throws** — any exceptions with conditions
- **@example** — one realistic usage example
For each interface/type:
- **@description** — purpose of this type
- **Property descriptions** — inline comment for non-obvious fields
For each class:
- **@description** — responsibility and when to use it
- **@example** — basic instantiation and usage
Rules:
- Don't state the obvious (skip "name - the name of the user")
- Focus on WHY and WHEN, not just WHAT
- Include edge cases in descriptions ("returns null if user not found")
- Use `@see` to link related functions
- Keep examples realistic, not contrived
Return the fully documented code.How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into Claude, ChatGPT, or Cursor
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More Documentation Prompts
Related documentation templates from the vault
API Quickstart Tutorial Writer
Use this prompt to api quickstart tutorial writer with AI assistance
Architecture Decision Record (ADR) Series Generator
Generate a series of Architecture Decision Records documenting key technical choices with context, alternatives, and consequences
Onboarding Guide for New Developers
Use this prompt to onboarding guide for new developers with AI assistance
Architecture Decision Record Template
Document architectural decisions with context, options, and rationale
You Might Also Like
Prompts from other categories that share similar tags
OpenAPI Specification Generator
Generate a complete OpenAPI 3.1 specification from existing API routes
Legacy Code Modernization
Modernize legacy JavaScript/TypeScript code to current best practices
TypeScript Type Wizard
Get help with complex TypeScript types, generics, and utility types
API Contract First Design
Design a complete API contract before writing any implementation code
Keep Exploring the Vault