Golden Rule: If users ask the same question twice, document it
Document (✅ DO):
Don't Document (❌ DON'T):
Principles: Audience-focused, Show don't tell, Keep current
Audience-focused: Write for users (what/how), developers (why/when), contributors (setup/conventions) Show, don't tell: Code examples, real use cases, expected output Keep current: Update with code changes, remove outdated info, mark deprecations
# Project Name
Brief description (1-2 sentences)
## Features
- Key feature 1
- Key feature 2
## Installation
```bash
npm install package-name
const result = doSomething();
[Detailed examples]
[If applicable]
[Link to CONTRIBUTING.md]
[License type]
## Function Documentation
```javascript
/**
* Calculate total price including tax
*
* @param {number} price - Base price
* @param {number} taxRate - Tax rate (0-1)
* @returns {number} Total with tax
*
* @example
* calculateTotal(100, 0.1) // 110
*/
function calculateTotal(price, taxRate) {
return price * (1 + taxRate);
}
// Calculate discount by tier (Bronze: 5%, Silver: 10%, Gold: 15%)
const discount = getDiscountByTier(customer.tier);
// HACK: API returns null instead of [], normalize it
const items = response.items || [];
// TODO: Use async/await when Node 18+ is minimum
// Increment i
i++;
// Get user
const user = getUser();
### POST /api/users
Create a new user
**Request:**
```json
{ "name": "John", "email": "john@example.com" }
Response:
{ "id": "123", "name": "John", "email": "john@example.com" }
Errors:
✅ Explain WHY, not just WHAT ✅ Include working examples ✅ Show expected output ✅ Cover error handling ✅ Use consistent terminology ✅ Keep structure predictable ✅ Update when code changes
Golden Rule: If users ask the same question twice, document it.