agentic-team-templates 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +280 -0
- package/bin/cli.js +5 -0
- package/package.json +47 -0
- package/src/index.js +521 -0
- package/templates/_shared/code-quality.md +162 -0
- package/templates/_shared/communication.md +114 -0
- package/templates/_shared/core-principles.md +62 -0
- package/templates/_shared/git-workflow.md +165 -0
- package/templates/_shared/security-fundamentals.md +173 -0
- package/templates/blockchain/.cursorrules/defi-patterns.md +520 -0
- package/templates/blockchain/.cursorrules/gas-optimization.md +339 -0
- package/templates/blockchain/.cursorrules/overview.md +130 -0
- package/templates/blockchain/.cursorrules/security.md +318 -0
- package/templates/blockchain/.cursorrules/smart-contracts.md +364 -0
- package/templates/blockchain/.cursorrules/testing.md +415 -0
- package/templates/blockchain/.cursorrules/web3-integration.md +538 -0
- package/templates/blockchain/CLAUDE.md +389 -0
- package/templates/cli-tools/.cursorrules/architecture.md +412 -0
- package/templates/cli-tools/.cursorrules/arguments.md +406 -0
- package/templates/cli-tools/.cursorrules/distribution.md +546 -0
- package/templates/cli-tools/.cursorrules/error-handling.md +455 -0
- package/templates/cli-tools/.cursorrules/overview.md +136 -0
- package/templates/cli-tools/.cursorrules/testing.md +537 -0
- package/templates/cli-tools/.cursorrules/user-experience.md +545 -0
- package/templates/cli-tools/CLAUDE.md +356 -0
- package/templates/data-engineering/.cursorrules/data-modeling.md +367 -0
- package/templates/data-engineering/.cursorrules/data-quality.md +455 -0
- package/templates/data-engineering/.cursorrules/overview.md +85 -0
- package/templates/data-engineering/.cursorrules/performance.md +339 -0
- package/templates/data-engineering/.cursorrules/pipeline-design.md +280 -0
- package/templates/data-engineering/.cursorrules/security.md +460 -0
- package/templates/data-engineering/.cursorrules/testing.md +452 -0
- package/templates/data-engineering/CLAUDE.md +974 -0
- package/templates/devops-sre/.cursorrules/capacity-planning.md +653 -0
- package/templates/devops-sre/.cursorrules/change-management.md +584 -0
- package/templates/devops-sre/.cursorrules/chaos-engineering.md +651 -0
- package/templates/devops-sre/.cursorrules/disaster-recovery.md +641 -0
- package/templates/devops-sre/.cursorrules/incident-management.md +565 -0
- package/templates/devops-sre/.cursorrules/observability.md +714 -0
- package/templates/devops-sre/.cursorrules/overview.md +230 -0
- package/templates/devops-sre/.cursorrules/postmortems.md +588 -0
- package/templates/devops-sre/.cursorrules/runbooks.md +760 -0
- package/templates/devops-sre/.cursorrules/slo-sli.md +617 -0
- package/templates/devops-sre/.cursorrules/toil-reduction.md +567 -0
- package/templates/devops-sre/CLAUDE.md +1007 -0
- package/templates/documentation/.cursorrules/adr.md +277 -0
- package/templates/documentation/.cursorrules/api-documentation.md +411 -0
- package/templates/documentation/.cursorrules/code-comments.md +253 -0
- package/templates/documentation/.cursorrules/maintenance.md +260 -0
- package/templates/documentation/.cursorrules/overview.md +82 -0
- package/templates/documentation/.cursorrules/readme-standards.md +306 -0
- package/templates/documentation/CLAUDE.md +120 -0
- package/templates/fullstack/.cursorrules/api-contracts.md +331 -0
- package/templates/fullstack/.cursorrules/architecture.md +298 -0
- package/templates/fullstack/.cursorrules/overview.md +109 -0
- package/templates/fullstack/.cursorrules/shared-types.md +348 -0
- package/templates/fullstack/.cursorrules/testing.md +386 -0
- package/templates/fullstack/CLAUDE.md +349 -0
- package/templates/ml-ai/.cursorrules/data-engineering.md +483 -0
- package/templates/ml-ai/.cursorrules/deployment.md +601 -0
- package/templates/ml-ai/.cursorrules/model-development.md +538 -0
- package/templates/ml-ai/.cursorrules/monitoring.md +658 -0
- package/templates/ml-ai/.cursorrules/overview.md +131 -0
- package/templates/ml-ai/.cursorrules/security.md +637 -0
- package/templates/ml-ai/.cursorrules/testing.md +678 -0
- package/templates/ml-ai/CLAUDE.md +1136 -0
- package/templates/mobile/.cursorrules/navigation.md +246 -0
- package/templates/mobile/.cursorrules/offline-first.md +302 -0
- package/templates/mobile/.cursorrules/overview.md +71 -0
- package/templates/mobile/.cursorrules/performance.md +345 -0
- package/templates/mobile/.cursorrules/testing.md +339 -0
- package/templates/mobile/CLAUDE.md +233 -0
- package/templates/platform-engineering/.cursorrules/ci-cd.md +778 -0
- package/templates/platform-engineering/.cursorrules/developer-experience.md +632 -0
- package/templates/platform-engineering/.cursorrules/infrastructure-as-code.md +600 -0
- package/templates/platform-engineering/.cursorrules/kubernetes.md +710 -0
- package/templates/platform-engineering/.cursorrules/observability.md +747 -0
- package/templates/platform-engineering/.cursorrules/overview.md +215 -0
- package/templates/platform-engineering/.cursorrules/security.md +855 -0
- package/templates/platform-engineering/.cursorrules/testing.md +878 -0
- package/templates/platform-engineering/CLAUDE.md +850 -0
- package/templates/utility-agent/.cursorrules/action-control.md +284 -0
- package/templates/utility-agent/.cursorrules/context-management.md +186 -0
- package/templates/utility-agent/.cursorrules/hallucination-prevention.md +253 -0
- package/templates/utility-agent/.cursorrules/overview.md +78 -0
- package/templates/utility-agent/.cursorrules/token-optimization.md +369 -0
- package/templates/utility-agent/CLAUDE.md +513 -0
- package/templates/web-backend/.cursorrules/api-design.md +255 -0
- package/templates/web-backend/.cursorrules/authentication.md +309 -0
- package/templates/web-backend/.cursorrules/database-patterns.md +298 -0
- package/templates/web-backend/.cursorrules/error-handling.md +366 -0
- package/templates/web-backend/.cursorrules/overview.md +69 -0
- package/templates/web-backend/.cursorrules/security.md +358 -0
- package/templates/web-backend/.cursorrules/testing.md +395 -0
- package/templates/web-backend/CLAUDE.md +366 -0
- package/templates/web-frontend/.cursorrules/accessibility.md +296 -0
- package/templates/web-frontend/.cursorrules/component-patterns.md +204 -0
- package/templates/web-frontend/.cursorrules/overview.md +72 -0
- package/templates/web-frontend/.cursorrules/performance.md +325 -0
- package/templates/web-frontend/.cursorrules/state-management.md +227 -0
- package/templates/web-frontend/.cursorrules/styling.md +271 -0
- package/templates/web-frontend/.cursorrules/testing.md +311 -0
- package/templates/web-frontend/CLAUDE.md +399 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Code Comments
|
|
2
|
+
|
|
3
|
+
Guidelines for inline comments, docstrings, and API documentation.
|
|
4
|
+
|
|
5
|
+
## The Comment Hierarchy
|
|
6
|
+
|
|
7
|
+
### 1. Self-Documenting Code (Preferred)
|
|
8
|
+
|
|
9
|
+
Good naming eliminates the need for most comments.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// Bad: Requires comment to understand
|
|
13
|
+
const d = 86400; // seconds in a day
|
|
14
|
+
|
|
15
|
+
// Good: Self-documenting
|
|
16
|
+
const SECONDS_PER_DAY = 86400;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// Bad: Comment explains what code does
|
|
21
|
+
// Check if user is admin
|
|
22
|
+
if (user.role === 'admin') { ... }
|
|
23
|
+
|
|
24
|
+
// Good: Code speaks for itself
|
|
25
|
+
if (user.isAdmin()) { ... }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Inline Comments (Why, Not What)
|
|
29
|
+
|
|
30
|
+
Comments explain *why*, not *what*. The code shows what; comments show intent.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// Good: Explains why
|
|
34
|
+
// Using retry logic because the payment API is flaky during peak hours
|
|
35
|
+
await retryWithBackoff(processPayment, 3);
|
|
36
|
+
|
|
37
|
+
// Bad: Explains what (obvious from code)
|
|
38
|
+
// Increment counter by 1
|
|
39
|
+
counter++;
|
|
40
|
+
|
|
41
|
+
// Bad: Outdated comment
|
|
42
|
+
// Send email to user
|
|
43
|
+
await sendSlackNotification(user); // Code changed, comment didn't
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Warning Comments
|
|
47
|
+
|
|
48
|
+
Flag non-obvious gotchas and constraints.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// WARNING: This function is not thread-safe.
|
|
52
|
+
// Always call from the main thread.
|
|
53
|
+
function updateGlobalState() { ... }
|
|
54
|
+
|
|
55
|
+
// HACK: Workaround for Chrome bug #12345
|
|
56
|
+
// Remove after Chrome 120 ships
|
|
57
|
+
element.style.transform = 'translateZ(0)';
|
|
58
|
+
|
|
59
|
+
// TODO(username): Refactor when API v2 launches
|
|
60
|
+
// Tracking issue: #456
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API Documentation (Docstrings)
|
|
64
|
+
|
|
65
|
+
### Purpose
|
|
66
|
+
|
|
67
|
+
API documentation is **the contract** for how code must behave. It tells future developers:
|
|
68
|
+
- What the function/class does
|
|
69
|
+
- How to use it
|
|
70
|
+
- What to expect
|
|
71
|
+
|
|
72
|
+
### TypeScript/JavaScript (JSDoc/TSDoc)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
/**
|
|
76
|
+
* Calculates the total price including tax and discounts.
|
|
77
|
+
*
|
|
78
|
+
* @param items - Array of cart items to price
|
|
79
|
+
* @param taxRate - Tax rate as decimal (e.g., 0.08 for 8%)
|
|
80
|
+
* @param couponCode - Optional discount coupon
|
|
81
|
+
* @returns The final price in cents
|
|
82
|
+
* @throws {InvalidCouponError} If coupon code is expired or invalid
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const total = calculateTotal(cartItems, 0.08, 'SAVE10');
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
function calculateTotal(
|
|
90
|
+
items: CartItem[],
|
|
91
|
+
taxRate: number,
|
|
92
|
+
couponCode?: string
|
|
93
|
+
): number { ... }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Python (Docstrings)
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
def calculate_total(items: list[CartItem], tax_rate: float, coupon_code: str | None = None) -> int:
|
|
100
|
+
"""
|
|
101
|
+
Calculate the total price including tax and discounts.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
items: List of cart items to price.
|
|
105
|
+
tax_rate: Tax rate as decimal (e.g., 0.08 for 8%).
|
|
106
|
+
coupon_code: Optional discount coupon.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
The final price in cents.
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
InvalidCouponError: If coupon code is expired or invalid.
|
|
113
|
+
|
|
114
|
+
Example:
|
|
115
|
+
>>> total = calculate_total(cart_items, 0.08, 'SAVE10')
|
|
116
|
+
"""
|
|
117
|
+
...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Go (Godoc)
|
|
121
|
+
|
|
122
|
+
```go
|
|
123
|
+
// CalculateTotal computes the final price including tax and discounts.
|
|
124
|
+
//
|
|
125
|
+
// The taxRate should be provided as a decimal (e.g., 0.08 for 8%).
|
|
126
|
+
// If couponCode is empty, no discount is applied.
|
|
127
|
+
//
|
|
128
|
+
// Returns an error if the coupon code is expired or invalid.
|
|
129
|
+
func CalculateTotal(items []CartItem, taxRate float64, couponCode string) (int, error) {
|
|
130
|
+
...
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## What to Document
|
|
135
|
+
|
|
136
|
+
### Always Document
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
/**
|
|
140
|
+
* Public functions and methods
|
|
141
|
+
* - What it does (one sentence)
|
|
142
|
+
* - Parameters and return values
|
|
143
|
+
* - Exceptions/errors thrown
|
|
144
|
+
* - Example usage for complex APIs
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Non-obvious constraints
|
|
149
|
+
* - Thread safety requirements
|
|
150
|
+
* - Performance characteristics
|
|
151
|
+
* - Valid input ranges
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Side effects
|
|
156
|
+
* - External API calls
|
|
157
|
+
* - Database modifications
|
|
158
|
+
* - File system changes
|
|
159
|
+
*/
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Skip Documentation For
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Obvious getters/setters (unless they have side effects)
|
|
166
|
+
function getName(): string { return this.name; }
|
|
167
|
+
|
|
168
|
+
// Private implementation details
|
|
169
|
+
private parseInternal(data: Buffer): void { ... }
|
|
170
|
+
|
|
171
|
+
// Self-explanatory one-liners
|
|
172
|
+
const isActive = user.status === 'active';
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Class/Module Documentation
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
/**
|
|
179
|
+
* Manages user authentication and session lifecycle.
|
|
180
|
+
*
|
|
181
|
+
* This service handles login, logout, token refresh, and session
|
|
182
|
+
* validation. All methods are thread-safe.
|
|
183
|
+
*
|
|
184
|
+
* @example Basic usage
|
|
185
|
+
* ```ts
|
|
186
|
+
* const auth = new AuthService(config);
|
|
187
|
+
* const session = await auth.login(credentials);
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @example With token refresh
|
|
191
|
+
* ```ts
|
|
192
|
+
* auth.on('tokenExpiring', async () => {
|
|
193
|
+
* await auth.refreshToken();
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
class AuthService { ... }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Comment Anti-Patterns
|
|
201
|
+
|
|
202
|
+
### Commented-Out Code
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// Bad: Use version control instead
|
|
206
|
+
// function oldImplementation() {
|
|
207
|
+
// return legacyCalculation();
|
|
208
|
+
// }
|
|
209
|
+
function newImplementation() { ... }
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Noise Comments
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// Bad: Adds no value
|
|
216
|
+
// Constructor
|
|
217
|
+
constructor() { }
|
|
218
|
+
|
|
219
|
+
// Bad: Repeats the obvious
|
|
220
|
+
// Loop through users
|
|
221
|
+
for (const user of users) { }
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Outdated Comments
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
// Bad: Comment lies about what code does
|
|
228
|
+
// Returns the user's full name
|
|
229
|
+
function getDisplayName(user: User): string {
|
|
230
|
+
return user.username; // Actually returns username
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Comment Formatting
|
|
235
|
+
|
|
236
|
+
### Use Consistent Style
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// Single-line comments for brief notes
|
|
240
|
+
// Use sentence case with period.
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Multi-line comments for API documentation.
|
|
244
|
+
* Keep lines under 80-100 characters.
|
|
245
|
+
* Use proper grammar and punctuation.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
// TODO: Use consistent format for action items
|
|
249
|
+
// TODO(username): Include who if assignment needed
|
|
250
|
+
// FIXME: For bugs that need fixing
|
|
251
|
+
// HACK: For temporary workarounds
|
|
252
|
+
// NOTE: For important clarifications
|
|
253
|
+
```
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Documentation Maintenance
|
|
2
|
+
|
|
3
|
+
Guidelines for keeping documentation fresh, accurate, and useful.
|
|
4
|
+
|
|
5
|
+
## Core Principle
|
|
6
|
+
|
|
7
|
+
> Dead docs are bad. They misinform, they slow down, they incite despair in
|
|
8
|
+
> engineers and laziness in team leads. — Google Documentation Guide
|
|
9
|
+
|
|
10
|
+
## The Same-Commit Rule
|
|
11
|
+
|
|
12
|
+
**Documentation changes belong in the same commit as code changes.**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Good: Docs updated with code
|
|
16
|
+
git commit -m "feat: add payment retry logic
|
|
17
|
+
|
|
18
|
+
- Add exponential backoff for failed payments
|
|
19
|
+
- Update API docs with new retry behavior
|
|
20
|
+
- Add example to README"
|
|
21
|
+
|
|
22
|
+
# Bad: Docs updated separately (or never)
|
|
23
|
+
git commit -m "feat: add payment retry logic"
|
|
24
|
+
# ... 3 weeks later ...
|
|
25
|
+
git commit -m "docs: update payment docs" # If remembered at all
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Delete Dead Documentation
|
|
29
|
+
|
|
30
|
+
### Signs of Dead Docs
|
|
31
|
+
|
|
32
|
+
- References to removed features
|
|
33
|
+
- Code examples that don't compile
|
|
34
|
+
- Broken links
|
|
35
|
+
- Outdated screenshots
|
|
36
|
+
- Instructions that don't work
|
|
37
|
+
- "TODO: update this" comments
|
|
38
|
+
|
|
39
|
+
### Deletion Strategy
|
|
40
|
+
|
|
41
|
+
1. **Default to delete** when uncertain
|
|
42
|
+
2. **Archive important history** in ADRs if needed
|
|
43
|
+
3. **Don't preserve for nostalgia** — that's what git history is for
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
<!-- Bad: Leaving dead docs -->
|
|
47
|
+
## Legacy Authentication (Deprecated)
|
|
48
|
+
|
|
49
|
+
> Note: This section is outdated. See new auth docs below.
|
|
50
|
+
|
|
51
|
+
The old auth system used...
|
|
52
|
+
|
|
53
|
+
<!-- Good: Delete and move on -->
|
|
54
|
+
## Authentication
|
|
55
|
+
|
|
56
|
+
Current auth system uses JWT tokens...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Regular Maintenance
|
|
60
|
+
|
|
61
|
+
### Quarterly Review Checklist
|
|
62
|
+
|
|
63
|
+
- [ ] All README quick-start instructions work
|
|
64
|
+
- [ ] Code examples compile and run
|
|
65
|
+
- [ ] Links resolve (use `npx linkinator`)
|
|
66
|
+
- [ ] Screenshots match current UI
|
|
67
|
+
- [ ] API docs match implementation
|
|
68
|
+
- [ ] No TODO/FIXME comments older than 90 days
|
|
69
|
+
|
|
70
|
+
### Automated Checks
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
# .github/workflows/docs.yml
|
|
74
|
+
name: Documentation Health
|
|
75
|
+
|
|
76
|
+
on:
|
|
77
|
+
schedule:
|
|
78
|
+
- cron: '0 0 * * 0' # Weekly
|
|
79
|
+
push:
|
|
80
|
+
paths:
|
|
81
|
+
- 'docs/**'
|
|
82
|
+
- '*.md'
|
|
83
|
+
|
|
84
|
+
jobs:
|
|
85
|
+
check-links:
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v4
|
|
89
|
+
- run: npx linkinator . --recurse --skip "^(?!http)"
|
|
90
|
+
|
|
91
|
+
check-markdown:
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
steps:
|
|
94
|
+
- uses: actions/checkout@v4
|
|
95
|
+
- run: npx markdownlint '**/*.md'
|
|
96
|
+
|
|
97
|
+
test-code-examples:
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
steps:
|
|
100
|
+
- uses: actions/checkout@v4
|
|
101
|
+
- run: npm ci
|
|
102
|
+
- run: npm run test:docs # Test code examples compile
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Documentation Ownership
|
|
106
|
+
|
|
107
|
+
### Every Doc Has an Owner
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
---
|
|
111
|
+
owner: @payments-team
|
|
112
|
+
last-reviewed: 2024-01-15
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
# Payment Processing Guide
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Review Triggers
|
|
119
|
+
|
|
120
|
+
Docs should be reviewed when:
|
|
121
|
+
- Related code changes
|
|
122
|
+
- User reports confusion
|
|
123
|
+
- New team member struggles
|
|
124
|
+
- 90 days since last review
|
|
125
|
+
|
|
126
|
+
## Preventing Documentation Decay
|
|
127
|
+
|
|
128
|
+
### Link to Source of Truth
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
<!-- Bad: Duplicates information that will drift -->
|
|
132
|
+
## Supported Node Versions
|
|
133
|
+
- Node 18
|
|
134
|
+
- Node 20
|
|
135
|
+
- Node 22
|
|
136
|
+
|
|
137
|
+
<!-- Good: Links to canonical source -->
|
|
138
|
+
## Requirements
|
|
139
|
+
See `engines` field in [package.json](./package.json) for supported versions.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Generate When Possible
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// Generate CLI help from code
|
|
146
|
+
const commands = {
|
|
147
|
+
build: {
|
|
148
|
+
description: 'Build the project',
|
|
149
|
+
options: [
|
|
150
|
+
{ name: '--watch', description: 'Watch for changes' },
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// README generated from this object
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Use Versioned References
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
<!-- Bad: Will break on next release -->
|
|
162
|
+
See the [API docs](https://docs.example.com/api)
|
|
163
|
+
|
|
164
|
+
<!-- Good: Pinned to version -->
|
|
165
|
+
See the [API docs for v2.x](https://docs.example.com/v2/api)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Handling Outdated Docs
|
|
169
|
+
|
|
170
|
+
### Triage Process
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
┌─────────────────────┐
|
|
174
|
+
│ Is it still needed? │
|
|
175
|
+
└─────────┬───────────┘
|
|
176
|
+
│
|
|
177
|
+
┌─────┴─────┐
|
|
178
|
+
│ │
|
|
179
|
+
Yes No
|
|
180
|
+
│ │
|
|
181
|
+
▼ ▼
|
|
182
|
+
┌───────────┐ ┌────────┐
|
|
183
|
+
│ Update it │ │ Delete │
|
|
184
|
+
└───────────┘ └────────┘
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Update vs. Rewrite
|
|
188
|
+
|
|
189
|
+
**Update when:**
|
|
190
|
+
- Core information is correct
|
|
191
|
+
- Structure is sound
|
|
192
|
+
- Just needs minor corrections
|
|
193
|
+
|
|
194
|
+
**Rewrite when:**
|
|
195
|
+
- Fundamental approach changed
|
|
196
|
+
- More than 50% needs changes
|
|
197
|
+
- Structure doesn't fit current reality
|
|
198
|
+
|
|
199
|
+
## Team Documentation Habits
|
|
200
|
+
|
|
201
|
+
### Code Review Checklist
|
|
202
|
+
|
|
203
|
+
Reviewers should check:
|
|
204
|
+
- [ ] Docstrings added/updated for changed functions
|
|
205
|
+
- [ ] README reflects new features
|
|
206
|
+
- [ ] API docs updated for endpoint changes
|
|
207
|
+
- [ ] No commented-out documentation
|
|
208
|
+
- [ ] Examples are tested
|
|
209
|
+
|
|
210
|
+
### PR Template
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
## Documentation
|
|
214
|
+
|
|
215
|
+
- [ ] README updated (if applicable)
|
|
216
|
+
- [ ] API docs updated (if applicable)
|
|
217
|
+
- [ ] Code comments updated
|
|
218
|
+
- [ ] No documentation needed (explain why)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Definition of Done
|
|
222
|
+
|
|
223
|
+
A feature is not complete until:
|
|
224
|
+
- Public APIs are documented
|
|
225
|
+
- README reflects the change (if user-facing)
|
|
226
|
+
- Relevant code comments updated
|
|
227
|
+
- Examples work correctly
|
|
228
|
+
|
|
229
|
+
## Anti-Patterns
|
|
230
|
+
|
|
231
|
+
### "We'll Document It Later"
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
Later === Never
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Document as you code. If it's too complex to document, it's too complex.
|
|
238
|
+
|
|
239
|
+
### Documentation-Only PRs
|
|
240
|
+
|
|
241
|
+
Large documentation PRs are a smell. They indicate docs weren't updated with code.
|
|
242
|
+
|
|
243
|
+
```markdown
|
|
244
|
+
<!-- Bad: 6 months of accumulated debt -->
|
|
245
|
+
PR: "Update all documentation"
|
|
246
|
+
Files changed: 47
|
|
247
|
+
|
|
248
|
+
<!-- Good: Incremental updates -->
|
|
249
|
+
PR: "feat: add payment retry logic"
|
|
250
|
+
Files changed: 3 (including docs)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Separate Doc Repos
|
|
254
|
+
|
|
255
|
+
Keeping docs in a separate repository:
|
|
256
|
+
- Creates sync issues
|
|
257
|
+
- Removes accountability
|
|
258
|
+
- Makes "update docs with code" impossible
|
|
259
|
+
|
|
260
|
+
Docs belong with code unless there's a compelling reason otherwise.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Documentation Standards
|
|
2
|
+
|
|
3
|
+
Guidelines for writing effective technical documentation across all project types.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
> "Say what you mean, simply and directly." — Brian Kernighan
|
|
8
|
+
|
|
9
|
+
### Core Principles
|
|
10
|
+
|
|
11
|
+
1. **Minimum Viable Documentation** - A small set of fresh, accurate docs beats a large assembly in various states of disrepair
|
|
12
|
+
2. **Write for Humans First** - Code tells computers what to do; documentation tells humans why
|
|
13
|
+
3. **Radical Simplicity** - Fewer distractions make for better writing and more productive reading
|
|
14
|
+
4. **Better is Better Than Best** - Incremental improvement beats prolonged debate
|
|
15
|
+
|
|
16
|
+
### The Documentation Spectrum
|
|
17
|
+
|
|
18
|
+
Documentation exists on a spectrum from terse to detailed:
|
|
19
|
+
|
|
20
|
+
1. **Meaningful names** - Self-documenting code through good naming
|
|
21
|
+
2. **Inline comments** - Why the code exists, not what it does
|
|
22
|
+
3. **API documentation** - Method/class contracts (JSDoc, docstrings)
|
|
23
|
+
4. **README files** - Orientation for new users
|
|
24
|
+
5. **Guides and tutorials** - How to accomplish specific tasks
|
|
25
|
+
6. **Architecture Decision Records** - Why we chose this approach
|
|
26
|
+
|
|
27
|
+
## Scope
|
|
28
|
+
|
|
29
|
+
This ruleset applies to:
|
|
30
|
+
|
|
31
|
+
- Code comments and docstrings
|
|
32
|
+
- README files
|
|
33
|
+
- API documentation
|
|
34
|
+
- Architecture Decision Records (ADRs)
|
|
35
|
+
- User guides and tutorials
|
|
36
|
+
- Runbooks and operational docs
|
|
37
|
+
|
|
38
|
+
## When to Document
|
|
39
|
+
|
|
40
|
+
### Always Document
|
|
41
|
+
|
|
42
|
+
- Public APIs and interfaces
|
|
43
|
+
- Non-obvious business logic
|
|
44
|
+
- Architectural decisions and tradeoffs
|
|
45
|
+
- Setup and installation procedures
|
|
46
|
+
- Configuration options
|
|
47
|
+
- Breaking changes
|
|
48
|
+
|
|
49
|
+
### Don't Document
|
|
50
|
+
|
|
51
|
+
- What the code literally does (the code says that)
|
|
52
|
+
- Obvious behavior that types already express
|
|
53
|
+
- Temporary workarounds without context
|
|
54
|
+
- Implementation details that change frequently
|
|
55
|
+
|
|
56
|
+
## Documentation as Code
|
|
57
|
+
|
|
58
|
+
### Same Commit Rule
|
|
59
|
+
|
|
60
|
+
**Change documentation in the same commit as the code change.** This:
|
|
61
|
+
- Keeps docs fresh
|
|
62
|
+
- Provides context for reviewers
|
|
63
|
+
- Ensures docs and code stay in sync
|
|
64
|
+
|
|
65
|
+
### Review Checklist
|
|
66
|
+
|
|
67
|
+
When reviewing code changes, verify:
|
|
68
|
+
- [ ] Docstrings updated for changed functions
|
|
69
|
+
- [ ] README updated if behavior changes
|
|
70
|
+
- [ ] API docs reflect new endpoints/parameters
|
|
71
|
+
- [ ] ADR created for significant decisions
|
|
72
|
+
|
|
73
|
+
## Definition of Done
|
|
74
|
+
|
|
75
|
+
Documentation is complete when:
|
|
76
|
+
|
|
77
|
+
- [ ] New public APIs have docstrings
|
|
78
|
+
- [ ] README reflects current state
|
|
79
|
+
- [ ] Complex logic has explanatory comments
|
|
80
|
+
- [ ] Setup instructions are tested and work
|
|
81
|
+
- [ ] Links are valid and point to correct resources
|
|
82
|
+
- [ ] No outdated information remains
|