code-documentation▌
aj-geddes/useful-ai-prompts · updated Apr 8, 2026
Create clear, comprehensive code documentation using language-specific standards like JSDoc, Python docstrings, JavaDoc, and inline comments.
Code Documentation
Table of Contents
Overview
Create clear, comprehensive code documentation using language-specific standards like JSDoc, Python docstrings, JavaDoc, and inline comments.
When to Use
- Function and class documentation
- JSDoc for JavaScript/TypeScript
- Python docstrings
- JavaDoc for Java
- Inline code comments
- API documentation from code
- Type definitions
- Usage examples in code
Quick Start
Minimal working example:
/**
* Calculates the total price including tax and discount.
*
* @param {number} basePrice - The base price before tax and discount
* @param {number} taxRate - Tax rate as a decimal (e.g., 0.08 for 8%)
* @param {number} [discount=0] - Optional discount amount
* @returns {number} The final price after tax and discount
* @throws {Error} If basePrice or taxRate is negative
*
* @example
* const price = calculateTotalPrice(100, 0.08, 10);
* console.log(price); // 98
*
* @example
* // Without discount
* const price = calculateTotalPrice(100, 0.08);
* console.log(price); // 108
*/
function calculateTotalPrice(basePrice, taxRate, discount = 0) {
if (basePrice < 0 || taxRate < 0) {
throw new Error("Price and tax rate must be non-negative");
}
return basePrice * (1 + taxRate) - discount;
}
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Function Documentation | Function Documentation |
| Class Documentation | Class Documentation |
| Type Definitions | Type Definitions |
| Function Documentation | Function Documentation |
| Class Documentation | Class Documentation |
| Module Documentation | Module Documentation |
Best Practices
✅ DO
- Document public APIs thoroughly
- Include usage examples
- Document parameters and return values
- Specify thrown exceptions/errors
- Use language-specific standards (JSDoc, docstrings, etc.)
- Keep comments up-to-date
- Document "why" not "what"
- Include edge cases and gotchas
- Add links to related functions
- Document type definitions
- Use consistent formatting
❌ DON'T
- State the obvious in comments
- Leave commented-out code
- Write misleading comments
- Skip examples for complex functions
- Use vague parameter descriptions
- Forget to update docs when code changes
- Over-comment simple code
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★32 reviews- ★★★★★Pratham Ware· Dec 28, 2024
Keeps context tight: code-documentation is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Anaya Choi· Dec 16, 2024
Useful defaults in code-documentation — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Yusuf Park· Dec 12, 2024
code-documentation fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Sakura Mehta· Dec 4, 2024
code-documentation is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Hiroshi Harris· Nov 23, 2024
code-documentation reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Sakshi Patil· Nov 19, 2024
Registry listing for code-documentation matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kaira Smith· Nov 11, 2024
Keeps context tight: code-documentation is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Li Gupta· Nov 7, 2024
code-documentation has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Li Tandon· Oct 26, 2024
Solid pick for teams standardizing on skills: code-documentation is focused, and the summary matches what you get after install.
- ★★★★★Kaira Johnson· Oct 14, 2024
Registry listing for code-documentation matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 32