| name | documentation |
| description | Code documentation SOP — JSDoc, inline comments, README, and API docs standards Use when this capability is needed. |
| metadata | {"author":"furkangonel"} |
Documentation SOP
Principle: Document WHY, not WHAT
Good comments explain intent, context, and constraints — not what the code obviously does.
counter++;
counter++;
JSDoc / TSDoc Standards
Functions
function getRenewalDate(user: User, referenceDate = new Date()): string | null {
...
}
Classes
class DatabasePool {
...
}
Interfaces / Types
interface StripePayment {
intentId: string;
amountCents: number;
currency: string;
confirmedAt: number;
}
When to Write Inline Comments
Write a comment when:
- A workaround for a third-party library bug is in place (link to the issue)
- Business logic is non-obvious (
// Freelancers in DE are taxed differently per §19 UStG)
- A performance optimization would look like an anti-pattern without explanation
- A "why not" explains an approach that was tried and abandoned
README Structure
# Project Name
One-line description of what this does and who it's for.
## Quick Start
\`\`\`bash
npm install
cp .env.example .env # fill in required values
npm run dev
\`\`\`
## Requirements
- Node.js 20+
- PostgreSQL 15+
## Configuration
| Variable | Required | Description |
|----------|----------|-------------|
| DATABASE_URL | Yes | PostgreSQL connection string |
| REDIS_URL | No | Cache backend (optional) |
## Development
\`\`\`bash
npm run dev # Start development server
npm test # Run tests
npm run build # Production build
\`\`\`
## Architecture
Brief description of key design decisions and folder structure.
## Contributing
See CONTRIBUTING.md
## License
MIT
CHANGELOG Format (Keep a Changelog)
## [1.2.0] - 2025-01-15
### Added
- User avatar upload support (PNG, JPG up to 5MB)
### Fixed
- Race condition in session renewal that caused rare logouts
### Changed
- Password minimum length increased from 8 to 12 characters
### Deprecated
- /api/v1/profile endpoint — use /api/v2/users/:id instead
### Removed
- Legacy XML response format (deprecated in 1.0.0)
Agent Instructions
- Read the existing documentation style before adding new docs
- Only document public APIs — internal helpers can have minimal comments
- Run
search_in_files to find similar functions and match their doc style
- Update the README if a new feature changes the public interface
- Keep examples in JSDoc comments runnable and correct
- Never document the obvious — every comment should earn its place
Source: furkangonel/cowrangler — distributed by TomeVault.