Code Documentation

Code Documentation

Guides an AI coding agent to write thorough code documentation: JSDoc, Python docstrings, JavaDoc, inline comments and API comments with examples.

Skill files8 files

references/

templates/

SKILL.md105 lines
1
---
2
name: code-documentation
3
description: >
4
Write comprehensive code documentation including JSDoc, Python docstrings,
5
inline comments, function documentation, and API comments. Use when
6
documenting code, writing docstrings, or creating inline documentation.
7
---
8
9
# Code Documentation
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Create clear, comprehensive code documentation using language-specific standards like JSDoc, Python docstrings, JavaDoc, and inline comments.
22
23
## When to Use
24
25
- Function and class documentation
26
- JSDoc for JavaScript/TypeScript
27
- Python docstrings
28
- JavaDoc for Java
29
- Inline code comments
30
- API documentation from code
31
- Type definitions
32
- Usage examples in code
33
34
## Quick Start
35
36
Minimal working example:
37
38
```javascript
39
/**
40
* Calculates the total price including tax and discount.
41
*
42
* @param {number} basePrice - The base price before tax and discount
43
* @param {number} taxRate - Tax rate as a decimal (e.g., 0.08 for 8%)
44
* @param {number} [discount=0] - Optional discount amount
45
* @returns {number} The final price after tax and discount
46
* @throws {Error} If basePrice or taxRate is negative
47
*
48
* @example
49
* const price = calculateTotalPrice(100, 0.08, 10);
50
* console.log(price); // 98
51
*
52
* @example
53
* // Without discount
54
* const price = calculateTotalPrice(100, 0.08);
55
* console.log(price); // 108
56
*/
57
function calculateTotalPrice(basePrice, taxRate, discount = 0) {
58
if (basePrice < 0 || taxRate < 0) {
59
throw new Error("Price and tax rate must be non-negative");
60
}
61
return basePrice * (1 + taxRate) - discount;
62
}
63
64
// ... (see reference guides for full implementation)
65
```
66
67
## Reference Guides
68
69
Detailed implementations in the `references/` directory:
70
71
| Guide | Contents |
72
|---|---|
73
| [Function Documentation](references/function-documentation.md) | Function Documentation |
74
| [Class Documentation](references/class-documentation.md) | Class Documentation |
75
| [Type Definitions](references/type-definitions.md) | Type Definitions |
76
| [Function Documentation](references/function-documentation-2.md) | Function Documentation |
77
| [Class Documentation](references/class-documentation-2.md) | Class Documentation |
78
| [Module Documentation](references/module-documentation.md) | Module Documentation |
79
80
## Best Practices
81
82
### ✅ DO
83
84
- Document public APIs thoroughly
85
- Include usage examples
86
- Document parameters and return values
87
- Specify thrown exceptions/errors
88
- Use language-specific standards (JSDoc, docstrings, etc.)
89
- Keep comments up-to-date
90
- Document "why" not "what"
91
- Include edge cases and gotchas
92
- Add links to related functions
93
- Document type definitions
94
- Use consistent formatting
95
96
### ❌ DON'T
97
98
- State the obvious in comments
99
- Leave commented-out code
100
- Write misleading comments
101
- Skip examples for complex functions
102
- Use vague parameter descriptions
103
- Forget to update docs when code changes
104
- Over-comment simple code
105

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,408 prompts

More by @OpenSourceBuffGuy

See all
Overhead portrait of a girl lying in snow prompt image

Overhead portrait of a girl lying in snow

Creates an overhead portrait of a girl in a school blazer lying in fresh snow, using a JSON spec that keeps the reference face and sets camera, outfit and soft overcast light.

image-prompt, json-prompt, nano-banana, reference-image, face-reference, negative-prompt, photorealistic, portrait, woman, close-up, high-angle, winter, soft-lighting, natural-light, bokeh, moody, editorial, vertical-format, muted-colors, limited-palette, film-grain, cinematic, structured-output, for-photographers, for-artists

Morning skincare ritual ending on serum hero shot prompt image

Morning skincare ritual ending on serum hero shot

Produces a 15-second skincare commercial from an uploaded storyboard, with eight timed match-cut shots ending on a serum hero shot.

video-prompt, video-ad, product-video, multi-shot, timed-beats, scene-transitions, camera-movement, macro, reference-image, storyboard, character-consistency, skincare, beauty, advertising, photorealistic, cinematic, natural-light, woman, hailuo, tracking-shot, slow-motion, for-marketers, long-form

Isometric Floating Country Map Dioramas prompt image

Isometric Floating Country Map Dioramas

Draws an isometric miniature diorama of a country as a single floating map, split into regions with their own climates and architecture, joined by winding roads.

image-prompt, nano-banana, isometric, maps, miniature, landscape, architecture, placeholders, template, photorealistic, cinematic, soft-lighting, landmarks, geography, 3d-render, negative-prompt, architectural-rendering, aerial-view, high-angle, travel, vibrant-colors

Reviews

Loading reviews…

Discussion

Loading comments…