@brainst0rm/core 0.13.0 → 0.14.1
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/dist/chunk-M7BBX56R.js +340 -0
- package/dist/chunk-M7BBX56R.js.map +1 -0
- package/dist/{chunk-SWXTFHC7.js → chunk-Z5D2QZY6.js} +3 -3
- package/dist/chunk-Z5D2QZY6.js.map +1 -0
- package/dist/chunk-Z6ZWNWWR.js +34 -0
- package/dist/index.d.ts +2717 -188
- package/dist/index.js +16178 -7949
- package/dist/index.js.map +1 -1
- package/dist/self-extend-47LWSK3E.js +52 -0
- package/dist/self-extend-47LWSK3E.js.map +1 -0
- package/dist/skills/builtin/api-and-interface-design/SKILL.md +300 -0
- package/dist/skills/builtin/browser-testing-with-devtools/SKILL.md +307 -0
- package/dist/skills/builtin/ci-cd-and-automation/SKILL.md +391 -0
- package/dist/skills/builtin/code-review-and-quality/SKILL.md +353 -0
- package/dist/skills/builtin/code-simplification/SKILL.md +340 -0
- package/dist/skills/builtin/context-engineering/SKILL.md +301 -0
- package/dist/skills/builtin/daemon-operations/SKILL.md +55 -0
- package/dist/skills/builtin/debugging-and-error-recovery/SKILL.md +306 -0
- package/dist/skills/builtin/deprecation-and-migration/SKILL.md +207 -0
- package/dist/skills/builtin/documentation-and-adrs/SKILL.md +295 -0
- package/dist/skills/builtin/frontend-ui-engineering/SKILL.md +333 -0
- package/dist/skills/builtin/git-workflow-and-versioning/SKILL.md +303 -0
- package/dist/skills/builtin/github-collaboration/SKILL.md +215 -0
- package/dist/skills/builtin/godmode-operations/SKILL.md +68 -0
- package/dist/skills/builtin/idea-refine/SKILL.md +186 -0
- package/dist/skills/builtin/idea-refine/examples.md +244 -0
- package/dist/skills/builtin/idea-refine/frameworks.md +101 -0
- package/dist/skills/builtin/idea-refine/refinement-criteria.md +126 -0
- package/dist/skills/builtin/idea-refine/scripts/idea-refine.sh +15 -0
- package/dist/skills/builtin/incremental-implementation/SKILL.md +243 -0
- package/dist/skills/builtin/memory-init/SKILL.md +54 -0
- package/dist/skills/builtin/memory-reflection/SKILL.md +59 -0
- package/dist/skills/builtin/multi-model-routing/SKILL.md +56 -0
- package/dist/skills/builtin/performance-optimization/SKILL.md +291 -0
- package/dist/skills/builtin/planning-and-task-breakdown/SKILL.md +240 -0
- package/dist/skills/builtin/security-and-hardening/SKILL.md +368 -0
- package/dist/skills/builtin/shipping-and-launch/SKILL.md +310 -0
- package/dist/skills/builtin/spec-driven-development/SKILL.md +212 -0
- package/dist/skills/builtin/test-driven-development/SKILL.md +376 -0
- package/dist/skills/builtin/using-agent-skills/SKILL.md +173 -0
- package/dist/trajectory-analyzer-ZAI2XUAI.js +14 -0
- package/dist/{trajectory-capture-RF7TUN6I.js → trajectory-capture-ERPIVYQJ.js} +3 -3
- package/package.json +14 -11
- package/dist/chunk-OU3NPQBH.js +0 -87
- package/dist/chunk-OU3NPQBH.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-SWXTFHC7.js.map +0 -1
- package/dist/trajectory-MOCIJBV6.js +0 -8
- /package/dist/{chunk-PZ5AY32C.js.map → chunk-Z6ZWNWWR.js.map} +0 -0
- /package/dist/{trajectory-MOCIJBV6.js.map → trajectory-analyzer-ZAI2XUAI.js.map} +0 -0
- /package/dist/{trajectory-capture-RF7TUN6I.js.map → trajectory-capture-ERPIVYQJ.js.map} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deprecation-and-migration
|
|
3
|
+
description: Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deprecation and Migration
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Code is a liability, not an asset. Every line of code has ongoing maintenance cost — bugs to fix, dependencies to update, security patches to apply, and new engineers to onboard. Deprecation is the discipline of removing code that no longer earns its keep, and migration is the process of moving users safely from the old to the new.
|
|
11
|
+
|
|
12
|
+
Most engineering organizations are good at building things. Few are good at removing them. This skill addresses that gap.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- Replacing an old system, API, or library with a new one
|
|
17
|
+
- Sunsetting a feature that's no longer needed
|
|
18
|
+
- Consolidating duplicate implementations
|
|
19
|
+
- Removing dead code that nobody owns but everybody depends on
|
|
20
|
+
- Planning the lifecycle of a new system (deprecation planning starts at design time)
|
|
21
|
+
- Deciding whether to maintain a legacy system or invest in migration
|
|
22
|
+
|
|
23
|
+
## Core Principles
|
|
24
|
+
|
|
25
|
+
### Code Is a Liability
|
|
26
|
+
|
|
27
|
+
Every line of code has ongoing cost: it needs tests, documentation, security patches, dependency updates, and mental overhead for anyone working nearby. The value of code is the functionality it provides, not the code itself. When the same functionality can be provided with less code, less complexity, or better abstractions — the old code should go.
|
|
28
|
+
|
|
29
|
+
### Hyrum's Law Makes Removal Hard
|
|
30
|
+
|
|
31
|
+
With enough users, every observable behavior becomes depended on — including bugs, timing quirks, and undocumented side effects. This is why deprecation requires active migration, not just announcement. Users can't "just switch" when they depend on behaviors the replacement doesn't replicate.
|
|
32
|
+
|
|
33
|
+
### Deprecation Planning Starts at Design Time
|
|
34
|
+
|
|
35
|
+
When building something new, ask: "How would we remove this in 3 years?" Systems designed with clean interfaces, feature flags, and minimal surface area are easier to deprecate than systems that leak implementation details everywhere.
|
|
36
|
+
|
|
37
|
+
## The Deprecation Decision
|
|
38
|
+
|
|
39
|
+
Before deprecating anything, answer these questions:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
1. Does this system still provide unique value?
|
|
43
|
+
→ If yes, maintain it. If no, proceed.
|
|
44
|
+
|
|
45
|
+
2. How many users/consumers depend on it?
|
|
46
|
+
→ Quantify the migration scope.
|
|
47
|
+
|
|
48
|
+
3. Does a replacement exist?
|
|
49
|
+
→ If no, build the replacement first. Don't deprecate without an alternative.
|
|
50
|
+
|
|
51
|
+
4. What's the migration cost for each consumer?
|
|
52
|
+
→ If trivially automated, do it. If manual and high-effort, weigh against maintenance cost.
|
|
53
|
+
|
|
54
|
+
5. What's the ongoing maintenance cost of NOT deprecating?
|
|
55
|
+
→ Security risk, engineer time, opportunity cost of complexity.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Compulsory vs Advisory Deprecation
|
|
59
|
+
|
|
60
|
+
| Type | When to Use | Mechanism |
|
|
61
|
+
| -------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
62
|
+
| **Advisory** | Migration is optional, old system is stable | Warnings, documentation, nudges. Users migrate on their own timeline. |
|
|
63
|
+
| **Compulsory** | Old system has security issues, blocks progress, or maintenance cost is unsustainable | Hard deadline. Old system will be removed by date X. Provide migration tooling. |
|
|
64
|
+
|
|
65
|
+
**Default to advisory.** Use compulsory only when the maintenance cost or risk justifies forcing migration. Compulsory deprecation requires providing migration tooling, documentation, and support — you can't just announce a deadline.
|
|
66
|
+
|
|
67
|
+
## The Migration Process
|
|
68
|
+
|
|
69
|
+
### Step 1: Build the Replacement
|
|
70
|
+
|
|
71
|
+
Don't deprecate without a working alternative. The replacement must:
|
|
72
|
+
|
|
73
|
+
- Cover all critical use cases of the old system
|
|
74
|
+
- Have documentation and migration guides
|
|
75
|
+
- Be proven in production (not just "theoretically better")
|
|
76
|
+
|
|
77
|
+
### Step 2: Announce and Document
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
## Deprecation Notice: OldService
|
|
81
|
+
|
|
82
|
+
**Status:** Deprecated as of 2025-03-01
|
|
83
|
+
**Replacement:** NewService (see migration guide below)
|
|
84
|
+
**Removal date:** Advisory — no hard deadline yet
|
|
85
|
+
**Reason:** OldService requires manual scaling and lacks observability.
|
|
86
|
+
NewService handles both automatically.
|
|
87
|
+
|
|
88
|
+
### Migration Guide
|
|
89
|
+
|
|
90
|
+
1. Replace `import { client } from 'old-service'` with `import { client } from 'new-service'`
|
|
91
|
+
2. Update configuration (see examples below)
|
|
92
|
+
3. Run the migration verification script: `npx migrate-check`
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Step 3: Migrate Incrementally
|
|
96
|
+
|
|
97
|
+
Migrate consumers one at a time, not all at once. For each consumer:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
1. Identify all touchpoints with the deprecated system
|
|
101
|
+
2. Update to use the replacement
|
|
102
|
+
3. Verify behavior matches (tests, integration checks)
|
|
103
|
+
4. Remove references to the old system
|
|
104
|
+
5. Confirm no regressions
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**The Churn Rule:** If you own the infrastructure being deprecated, you are responsible for migrating your users — or providing backward-compatible updates that require no migration. Don't announce deprecation and leave users to figure it out.
|
|
108
|
+
|
|
109
|
+
### Step 4: Remove the Old System
|
|
110
|
+
|
|
111
|
+
Only after all consumers have migrated:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
1. Verify zero active usage (metrics, logs, dependency analysis)
|
|
115
|
+
2. Remove the code
|
|
116
|
+
3. Remove associated tests, documentation, and configuration
|
|
117
|
+
4. Remove the deprecation notices
|
|
118
|
+
5. Celebrate — removing code is an achievement
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Migration Patterns
|
|
122
|
+
|
|
123
|
+
### Strangler Pattern
|
|
124
|
+
|
|
125
|
+
Run old and new systems in parallel. Route traffic incrementally from old to new. When the old system handles 0% of traffic, remove it.
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Phase 1: New system handles 0%, old handles 100%
|
|
129
|
+
Phase 2: New system handles 10% (canary)
|
|
130
|
+
Phase 3: New system handles 50%
|
|
131
|
+
Phase 4: New system handles 100%, old system idle
|
|
132
|
+
Phase 5: Remove old system
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Adapter Pattern
|
|
136
|
+
|
|
137
|
+
Create an adapter that translates calls from the old interface to the new implementation. Consumers keep using the old interface while you migrate the backend.
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// Adapter: old interface, new implementation
|
|
141
|
+
class LegacyTaskService implements OldTaskAPI {
|
|
142
|
+
constructor(private newService: NewTaskService) {}
|
|
143
|
+
|
|
144
|
+
// Old method signature, delegates to new implementation
|
|
145
|
+
getTask(id: number): OldTask {
|
|
146
|
+
const task = this.newService.findById(String(id));
|
|
147
|
+
return this.toOldFormat(task);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Feature Flag Migration
|
|
153
|
+
|
|
154
|
+
Use feature flags to switch consumers from old to new system one at a time:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
function getTaskService(userId: string): TaskService {
|
|
158
|
+
if (featureFlags.isEnabled("new-task-service", { userId })) {
|
|
159
|
+
return new NewTaskService();
|
|
160
|
+
}
|
|
161
|
+
return new LegacyTaskService();
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Zombie Code
|
|
166
|
+
|
|
167
|
+
Zombie code is code that nobody owns but everybody depends on. It's not actively maintained, has no clear owner, and accumulates security vulnerabilities and compatibility issues. Signs:
|
|
168
|
+
|
|
169
|
+
- No commits in 6+ months but active consumers exist
|
|
170
|
+
- No assigned maintainer or team
|
|
171
|
+
- Failing tests that nobody fixes
|
|
172
|
+
- Dependencies with known vulnerabilities that nobody updates
|
|
173
|
+
- Documentation that references systems that no longer exist
|
|
174
|
+
|
|
175
|
+
**Response:** Either assign an owner and maintain it properly, or deprecate it with a concrete migration plan. Zombie code cannot stay in limbo — it either gets investment or removal.
|
|
176
|
+
|
|
177
|
+
## Common Rationalizations
|
|
178
|
+
|
|
179
|
+
| Rationalization | Reality |
|
|
180
|
+
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
181
|
+
| "It still works, why remove it?" | Working code that nobody maintains accumulates security debt and complexity. Maintenance cost grows silently. |
|
|
182
|
+
| "Someone might need it later" | If it's needed later, it can be rebuilt. Keeping unused code "just in case" costs more than rebuilding. |
|
|
183
|
+
| "The migration is too expensive" | Compare migration cost to ongoing maintenance cost over 2-3 years. Migration is usually cheaper long-term. |
|
|
184
|
+
| "We'll deprecate it after we finish the new system" | Deprecation planning starts at design time. By the time the new system is done, you'll have new priorities. Plan now. |
|
|
185
|
+
| "Users will migrate on their own" | They won't. Provide tooling, documentation, and incentives — or do the migration yourself (the Churn Rule). |
|
|
186
|
+
| "We can maintain both systems indefinitely" | Two systems doing the same thing is double the maintenance, testing, documentation, and onboarding cost. |
|
|
187
|
+
|
|
188
|
+
## Red Flags
|
|
189
|
+
|
|
190
|
+
- Deprecated systems with no replacement available
|
|
191
|
+
- Deprecation announcements with no migration tooling or documentation
|
|
192
|
+
- "Soft" deprecation that's been advisory for years with no progress
|
|
193
|
+
- Zombie code with no owner and active consumers
|
|
194
|
+
- New features added to a deprecated system (invest in the replacement instead)
|
|
195
|
+
- Deprecation without measuring current usage
|
|
196
|
+
- Removing code without verifying zero active consumers
|
|
197
|
+
|
|
198
|
+
## Verification
|
|
199
|
+
|
|
200
|
+
After completing a deprecation:
|
|
201
|
+
|
|
202
|
+
- [ ] Replacement is production-proven and covers all critical use cases
|
|
203
|
+
- [ ] Migration guide exists with concrete steps and examples
|
|
204
|
+
- [ ] All active consumers have been migrated (verified by metrics/logs)
|
|
205
|
+
- [ ] Old code, tests, documentation, and configuration are fully removed
|
|
206
|
+
- [ ] No references to the deprecated system remain in the codebase
|
|
207
|
+
- [ ] Deprecation notices are removed (they served their purpose)
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-and-adrs
|
|
3
|
+
description: Records decisions and documentation. Use when making architectural decisions, changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation and ADRs
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Document decisions, not just code. The most valuable documentation captures the _why_ — the context, constraints, and trade-offs that led to a decision. Code shows _what_ was built; documentation explains _why it was built this way_ and _what alternatives were considered_. This context is essential for future humans and agents working in the codebase.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Making a significant architectural decision
|
|
15
|
+
- Choosing between competing approaches
|
|
16
|
+
- Adding or changing a public API
|
|
17
|
+
- Shipping a feature that changes user-facing behavior
|
|
18
|
+
- Onboarding new team members (or agents) to the project
|
|
19
|
+
- When you find yourself explaining the same thing repeatedly
|
|
20
|
+
|
|
21
|
+
**When NOT to use:** Don't document obvious code. Don't add comments that restate what the code already says. Don't write docs for throwaway prototypes.
|
|
22
|
+
|
|
23
|
+
## Architecture Decision Records (ADRs)
|
|
24
|
+
|
|
25
|
+
ADRs capture the reasoning behind significant technical decisions. They're the highest-value documentation you can write.
|
|
26
|
+
|
|
27
|
+
### When to Write an ADR
|
|
28
|
+
|
|
29
|
+
- Choosing a framework, library, or major dependency
|
|
30
|
+
- Designing a data model or database schema
|
|
31
|
+
- Selecting an authentication strategy
|
|
32
|
+
- Deciding on an API architecture (REST vs. GraphQL vs. tRPC)
|
|
33
|
+
- Choosing between build tools, hosting platforms, or infrastructure
|
|
34
|
+
- Any decision that would be expensive to reverse
|
|
35
|
+
|
|
36
|
+
### ADR Template
|
|
37
|
+
|
|
38
|
+
Store ADRs in `docs/decisions/` with sequential numbering:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
# ADR-001: Use PostgreSQL for primary database
|
|
42
|
+
|
|
43
|
+
## Status
|
|
44
|
+
|
|
45
|
+
Accepted | Superseded by ADR-XXX | Deprecated
|
|
46
|
+
|
|
47
|
+
## Date
|
|
48
|
+
|
|
49
|
+
2025-01-15
|
|
50
|
+
|
|
51
|
+
## Context
|
|
52
|
+
|
|
53
|
+
We need a primary database for the task management application. Key requirements:
|
|
54
|
+
|
|
55
|
+
- Relational data model (users, tasks, teams with relationships)
|
|
56
|
+
- ACID transactions for task state changes
|
|
57
|
+
- Support for full-text search on task content
|
|
58
|
+
- Managed hosting available (for small team, limited ops capacity)
|
|
59
|
+
|
|
60
|
+
## Decision
|
|
61
|
+
|
|
62
|
+
Use PostgreSQL with Prisma ORM.
|
|
63
|
+
|
|
64
|
+
## Alternatives Considered
|
|
65
|
+
|
|
66
|
+
### MongoDB
|
|
67
|
+
|
|
68
|
+
- Pros: Flexible schema, easy to start with
|
|
69
|
+
- Cons: Our data is inherently relational; would need to manage relationships manually
|
|
70
|
+
- Rejected: Relational data in a document store leads to complex joins or data duplication
|
|
71
|
+
|
|
72
|
+
### SQLite
|
|
73
|
+
|
|
74
|
+
- Pros: Zero configuration, embedded, fast for reads
|
|
75
|
+
- Cons: Limited concurrent write support, no managed hosting for production
|
|
76
|
+
- Rejected: Not suitable for multi-user web application in production
|
|
77
|
+
|
|
78
|
+
### MySQL
|
|
79
|
+
|
|
80
|
+
- Pros: Mature, widely supported
|
|
81
|
+
- Cons: PostgreSQL has better JSON support, full-text search, and ecosystem tooling
|
|
82
|
+
- Rejected: PostgreSQL is the better fit for our feature requirements
|
|
83
|
+
|
|
84
|
+
## Consequences
|
|
85
|
+
|
|
86
|
+
- Prisma provides type-safe database access and migration management
|
|
87
|
+
- We can use PostgreSQL's full-text search instead of adding Elasticsearch
|
|
88
|
+
- Team needs PostgreSQL knowledge (standard skill, low risk)
|
|
89
|
+
- Hosting on managed service (Supabase, Neon, or RDS)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### ADR Lifecycle
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
PROPOSED → ACCEPTED → (SUPERSEDED or DEPRECATED)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- **Don't delete old ADRs.** They capture historical context.
|
|
99
|
+
- When a decision changes, write a new ADR that references and supersedes the old one.
|
|
100
|
+
|
|
101
|
+
## Inline Documentation
|
|
102
|
+
|
|
103
|
+
### When to Comment
|
|
104
|
+
|
|
105
|
+
Comment the _why_, not the _what_:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// BAD: Restates the code
|
|
109
|
+
// Increment counter by 1
|
|
110
|
+
counter += 1;
|
|
111
|
+
|
|
112
|
+
// GOOD: Explains non-obvious intent
|
|
113
|
+
// Rate limit uses a sliding window — reset counter at window boundary,
|
|
114
|
+
// not on a fixed schedule, to prevent burst attacks at window edges
|
|
115
|
+
if (now - windowStart > WINDOW_SIZE_MS) {
|
|
116
|
+
counter = 0;
|
|
117
|
+
windowStart = now;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### When NOT to Comment
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Don't comment self-explanatory code
|
|
125
|
+
function calculateTotal(items: CartItem[]): number {
|
|
126
|
+
return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Don't leave TODO comments for things you should just do now
|
|
130
|
+
// TODO: add error handling ← Just add it
|
|
131
|
+
|
|
132
|
+
// Don't leave commented-out code
|
|
133
|
+
// const oldImplementation = () => { ... } ← Delete it, git has history
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Document Known Gotchas
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
/**
|
|
140
|
+
* IMPORTANT: This function must be called before the first render.
|
|
141
|
+
* If called after hydration, it causes a flash of unstyled content
|
|
142
|
+
* because the theme context isn't available during SSR.
|
|
143
|
+
*
|
|
144
|
+
* See ADR-003 for the full design rationale.
|
|
145
|
+
*/
|
|
146
|
+
export function initializeTheme(theme: Theme): void {
|
|
147
|
+
// ...
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## API Documentation
|
|
152
|
+
|
|
153
|
+
For public APIs (REST, GraphQL, library interfaces):
|
|
154
|
+
|
|
155
|
+
### Inline with Types (Preferred for TypeScript)
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new task.
|
|
160
|
+
*
|
|
161
|
+
* @param input - Task creation data (title required, description optional)
|
|
162
|
+
* @returns The created task with server-generated ID and timestamps
|
|
163
|
+
* @throws {ValidationError} If title is empty or exceeds 200 characters
|
|
164
|
+
* @throws {AuthenticationError} If the user is not authenticated
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* const task = await createTask({ title: 'Buy groceries' });
|
|
168
|
+
* console.log(task.id); // "task_abc123"
|
|
169
|
+
*/
|
|
170
|
+
export async function createTask(input: CreateTaskInput): Promise<Task> {
|
|
171
|
+
// ...
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### OpenAPI / Swagger for REST APIs
|
|
176
|
+
|
|
177
|
+
```yaml
|
|
178
|
+
paths:
|
|
179
|
+
/api/tasks:
|
|
180
|
+
post:
|
|
181
|
+
summary: Create a task
|
|
182
|
+
requestBody:
|
|
183
|
+
required: true
|
|
184
|
+
content:
|
|
185
|
+
application/json:
|
|
186
|
+
schema:
|
|
187
|
+
$ref: "#/components/schemas/CreateTaskInput"
|
|
188
|
+
responses:
|
|
189
|
+
"201":
|
|
190
|
+
description: Task created
|
|
191
|
+
content:
|
|
192
|
+
application/json:
|
|
193
|
+
schema:
|
|
194
|
+
$ref: "#/components/schemas/Task"
|
|
195
|
+
"422":
|
|
196
|
+
description: Validation error
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## README Structure
|
|
200
|
+
|
|
201
|
+
Every project should have a README that covers:
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
# Project Name
|
|
205
|
+
|
|
206
|
+
One-paragraph description of what this project does.
|
|
207
|
+
|
|
208
|
+
## Quick Start
|
|
209
|
+
|
|
210
|
+
1. Clone the repo
|
|
211
|
+
2. Install dependencies: `npm install`
|
|
212
|
+
3. Set up environment: `cp .env.example .env`
|
|
213
|
+
4. Run the dev server: `npm run dev`
|
|
214
|
+
|
|
215
|
+
## Commands
|
|
216
|
+
|
|
217
|
+
| Command | Description |
|
|
218
|
+
| --------------- | ------------------------ |
|
|
219
|
+
| `npm run dev` | Start development server |
|
|
220
|
+
| `npm test` | Run tests |
|
|
221
|
+
| `npm run build` | Production build |
|
|
222
|
+
| `npm run lint` | Run linter |
|
|
223
|
+
|
|
224
|
+
## Architecture
|
|
225
|
+
|
|
226
|
+
Brief overview of the project structure and key design decisions.
|
|
227
|
+
Link to ADRs for details.
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
How to contribute, coding standards, PR process.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Changelog Maintenance
|
|
235
|
+
|
|
236
|
+
For shipped features:
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
# Changelog
|
|
240
|
+
|
|
241
|
+
## [1.2.0] - 2025-01-20
|
|
242
|
+
|
|
243
|
+
### Added
|
|
244
|
+
|
|
245
|
+
- Task sharing: users can share tasks with team members (#123)
|
|
246
|
+
- Email notifications for task assignments (#124)
|
|
247
|
+
|
|
248
|
+
### Fixed
|
|
249
|
+
|
|
250
|
+
- Duplicate tasks appearing when rapidly clicking create button (#125)
|
|
251
|
+
|
|
252
|
+
### Changed
|
|
253
|
+
|
|
254
|
+
- Task list now loads 50 items per page (was 20) for better UX (#126)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Documentation for Agents
|
|
258
|
+
|
|
259
|
+
Special consideration for AI agent context:
|
|
260
|
+
|
|
261
|
+
- **CLAUDE.md / rules files** — Document project conventions so agents follow them
|
|
262
|
+
- **Spec files** — Keep specs updated so agents build the right thing
|
|
263
|
+
- **ADRs** — Help agents understand why past decisions were made (prevents re-deciding)
|
|
264
|
+
- **Inline gotchas** — Prevent agents from falling into known traps
|
|
265
|
+
|
|
266
|
+
## Common Rationalizations
|
|
267
|
+
|
|
268
|
+
| Rationalization | Reality |
|
|
269
|
+
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
270
|
+
| "The code is self-documenting" | Code shows what. It doesn't show why, what alternatives were rejected, or what constraints apply. |
|
|
271
|
+
| "We'll write docs when the API stabilizes" | APIs stabilize faster when you document them. The doc is the first test of the design. |
|
|
272
|
+
| "Nobody reads docs" | Agents do. Future engineers do. Your 3-months-later self does. |
|
|
273
|
+
| "ADRs are overhead" | A 10-minute ADR prevents a 2-hour debate about the same decision six months later. |
|
|
274
|
+
| "Comments get outdated" | Comments on _why_ are stable. Comments on _what_ get outdated — that's why you only write the former. |
|
|
275
|
+
|
|
276
|
+
## Red Flags
|
|
277
|
+
|
|
278
|
+
- Architectural decisions with no written rationale
|
|
279
|
+
- Public APIs with no documentation or types
|
|
280
|
+
- README that doesn't explain how to run the project
|
|
281
|
+
- Commented-out code instead of deletion
|
|
282
|
+
- TODO comments that have been there for weeks
|
|
283
|
+
- No ADRs in a project with significant architectural choices
|
|
284
|
+
- Documentation that restates the code instead of explaining intent
|
|
285
|
+
|
|
286
|
+
## Verification
|
|
287
|
+
|
|
288
|
+
After documenting:
|
|
289
|
+
|
|
290
|
+
- [ ] ADRs exist for all significant architectural decisions
|
|
291
|
+
- [ ] README covers quick start, commands, and architecture overview
|
|
292
|
+
- [ ] API functions have parameter and return type documentation
|
|
293
|
+
- [ ] Known gotchas are documented inline where they matter
|
|
294
|
+
- [ ] No commented-out code remains
|
|
295
|
+
- [ ] Rules files (CLAUDE.md etc.) are current and accurate
|