@codihaus/claude-skills 1.6.5 → 1.6.7
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 +2 -2
- package/package.json +1 -1
- package/skills/dev-coding/SKILL.md +190 -667
- package/skills/dev-coding/references/backend-principles.md +130 -0
- package/skills/dev-coding/references/frontend-principles.md +212 -0
- package/skills/dev-scout/SKILL.md +122 -873
- package/skills/dev-scout/references/output-template.md +231 -0
- package/skills/dev-specs/SKILL.md +104 -598
- package/skills/dev-specs/references/spec-template.md +146 -0
- package/src/utils/config.js +17 -18
- package/templates/HOOK_TRIGGER_TEST.md +4 -4
- package/templates/hooks-guide.md +24 -24
- package/templates/scripts/safe-graph-update.sh +3 -1
- package/skills/dev-coding-backend/SKILL.md +0 -240
- package/skills/dev-coding-backend/references/fundamentals.md +0 -428
- package/skills/dev-coding-frontend/SKILL.md +0 -296
- package/skills/dev-coding-frontend/references/fundamentals.md +0 -577
- package/skills/dev-scout/references/feature-patterns.md +0 -210
- package/skills/dev-scout/references/file-patterns.md +0 -252
- package/skills/dev-scout/references/stack-patterns.md +0 -371
- package/skills/dev-scout/references/tech-detection.md +0 -211
- package/skills/dev-specs/references/checklist.md +0 -176
- package/skills/dev-specs/references/spec-templates.md +0 -460
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# Spec Completeness Checklist
|
|
2
|
-
|
|
3
|
-
Use this to verify specs are implementation-ready.
|
|
4
|
-
|
|
5
|
-
## Shared Specs
|
|
6
|
-
|
|
7
|
-
### data-model.md
|
|
8
|
-
|
|
9
|
-
- [ ] All new entities defined with fields
|
|
10
|
-
- [ ] Field types specified
|
|
11
|
-
- [ ] Constraints documented (NOT NULL, UNIQUE, FK)
|
|
12
|
-
- [ ] Relationships described
|
|
13
|
-
- [ ] Migrations provided (up + down)
|
|
14
|
-
- [ ] Indexes identified
|
|
15
|
-
- [ ] Seed data (if applicable)
|
|
16
|
-
|
|
17
|
-
### patterns.md
|
|
18
|
-
|
|
19
|
-
- [ ] Code style conventions listed
|
|
20
|
-
- [ ] File naming conventions
|
|
21
|
-
- [ ] Error handling patterns
|
|
22
|
-
- [ ] Logging patterns
|
|
23
|
-
- [ ] API patterns (if applicable)
|
|
24
|
-
- [ ] State patterns (if applicable)
|
|
25
|
-
- [ ] Links to existing examples in codebase
|
|
26
|
-
|
|
27
|
-
### security.md
|
|
28
|
-
|
|
29
|
-
- [ ] Authentication requirements
|
|
30
|
-
- [ ] Authorization/permission model
|
|
31
|
-
- [ ] Input validation rules
|
|
32
|
-
- [ ] Sensitive data handling
|
|
33
|
-
- [ ] Rate limiting (if applicable)
|
|
34
|
-
- [ ] Audit logging (if applicable)
|
|
35
|
-
|
|
36
|
-
## Per-UC Specs
|
|
37
|
-
|
|
38
|
-
### README.md (Implementation Plan)
|
|
39
|
-
|
|
40
|
-
**Context:**
|
|
41
|
-
- [ ] Links to BRD use case
|
|
42
|
-
- [ ] Links to feature scout
|
|
43
|
-
- [ ] Status marked
|
|
44
|
-
|
|
45
|
-
**Requirements:**
|
|
46
|
-
- [ ] Business requirements summarized
|
|
47
|
-
- [ ] Acceptance criteria listed
|
|
48
|
-
- [ ] Business rules included
|
|
49
|
-
|
|
50
|
-
**Current State:**
|
|
51
|
-
- [ ] What exists documented
|
|
52
|
-
- [ ] Gaps identified
|
|
53
|
-
|
|
54
|
-
**Implementation:**
|
|
55
|
-
- [ ] Step-by-step plan
|
|
56
|
-
- [ ] Clear sequence
|
|
57
|
-
- [ ] No ambiguity
|
|
58
|
-
|
|
59
|
-
**API Contract (if applicable):**
|
|
60
|
-
- [ ] Method and endpoint
|
|
61
|
-
- [ ] Request format with example
|
|
62
|
-
- [ ] Response format with example
|
|
63
|
-
- [ ] All error codes listed
|
|
64
|
-
- [ ] Authentication requirements
|
|
65
|
-
|
|
66
|
-
**UI (if applicable):**
|
|
67
|
-
- [ ] Components listed
|
|
68
|
-
- [ ] Props defined
|
|
69
|
-
- [ ] State described
|
|
70
|
-
- [ ] User interactions mapped
|
|
71
|
-
|
|
72
|
-
**Edge Cases:**
|
|
73
|
-
- [ ] Edge cases identified
|
|
74
|
-
- [ ] Handling described for each
|
|
75
|
-
|
|
76
|
-
**Dependencies:**
|
|
77
|
-
- [ ] Dependencies on other UCs listed
|
|
78
|
-
- [ ] Dependencies on shared specs listed
|
|
79
|
-
- [ ] External dependencies noted
|
|
80
|
-
|
|
81
|
-
**Acceptance Mapping:**
|
|
82
|
-
- [ ] Each BRD criterion mapped to implementation
|
|
83
|
-
|
|
84
|
-
### changes.md
|
|
85
|
-
|
|
86
|
-
- [ ] All new files listed with purpose
|
|
87
|
-
- [ ] All modified files listed with change
|
|
88
|
-
- [ ] File paths are correct
|
|
89
|
-
- [ ] File tree preview included
|
|
90
|
-
- [ ] Nothing missing
|
|
91
|
-
|
|
92
|
-
### tests.md
|
|
93
|
-
|
|
94
|
-
**Coverage:**
|
|
95
|
-
- [ ] Unit tests planned
|
|
96
|
-
- [ ] Integration tests planned
|
|
97
|
-
- [ ] E2E tests planned (if applicable)
|
|
98
|
-
|
|
99
|
-
**Test Cases:**
|
|
100
|
-
- [ ] Happy path covered
|
|
101
|
-
- [ ] Error cases covered
|
|
102
|
-
- [ ] Edge cases covered
|
|
103
|
-
- [ ] Auth/permission cases (if applicable)
|
|
104
|
-
|
|
105
|
-
**Test Data:**
|
|
106
|
-
- [ ] Sample data provided
|
|
107
|
-
- [ ] Mock data defined
|
|
108
|
-
|
|
109
|
-
**Coverage Target:**
|
|
110
|
-
- [ ] Target defined
|
|
111
|
-
- [ ] Realistic for scope
|
|
112
|
-
|
|
113
|
-
## Specs Index (README.md)
|
|
114
|
-
|
|
115
|
-
- [ ] All UCs listed
|
|
116
|
-
- [ ] Implementation order defined
|
|
117
|
-
- [ ] Dependencies shown
|
|
118
|
-
- [ ] Mermaid graph (if complex)
|
|
119
|
-
- [ ] Summary metrics
|
|
120
|
-
- [ ] Notes/risks documented
|
|
121
|
-
|
|
122
|
-
## Quality Checks
|
|
123
|
-
|
|
124
|
-
### Clarity
|
|
125
|
-
- [ ] Can be understood without additional context
|
|
126
|
-
- [ ] No ambiguous language ("maybe", "probably", "might")
|
|
127
|
-
- [ ] Technical terms defined or linked
|
|
128
|
-
|
|
129
|
-
### Completeness
|
|
130
|
-
- [ ] All acceptance criteria addressed
|
|
131
|
-
- [ ] No TODOs or placeholders
|
|
132
|
-
- [ ] All edge cases considered
|
|
133
|
-
|
|
134
|
-
### Consistency
|
|
135
|
-
- [ ] Naming matches codebase conventions
|
|
136
|
-
- [ ] Matches patterns from scout
|
|
137
|
-
- [ ] File paths follow project structure
|
|
138
|
-
|
|
139
|
-
### Feasibility
|
|
140
|
-
- [ ] No impossible requirements
|
|
141
|
-
- [ ] Dependencies are available
|
|
142
|
-
- [ ] Aligns with existing architecture
|
|
143
|
-
|
|
144
|
-
## Red Flags
|
|
145
|
-
|
|
146
|
-
Watch for these issues:
|
|
147
|
-
|
|
148
|
-
| Issue | Problem |
|
|
149
|
-
|-------|---------|
|
|
150
|
-
| "TBD" or "TODO" | Incomplete spec |
|
|
151
|
-
| No error handling | Missing edge cases |
|
|
152
|
-
| No tests planned | Quality risk |
|
|
153
|
-
| Circular dependencies | Architecture issue |
|
|
154
|
-
| No acceptance mapping | Requirements disconnect |
|
|
155
|
-
| Hardcoded values | Config missing |
|
|
156
|
-
| No validation | Security risk |
|
|
157
|
-
|
|
158
|
-
## Review Questions
|
|
159
|
-
|
|
160
|
-
Before finalizing, answer:
|
|
161
|
-
|
|
162
|
-
1. **Can an engineer implement this without asking questions?**
|
|
163
|
-
2. **Are all acceptance criteria traceable to implementation?**
|
|
164
|
-
3. **Is the scope clear - what's in/out?**
|
|
165
|
-
4. **Are dependencies identified and available?**
|
|
166
|
-
5. **Will tests verify the requirements?**
|
|
167
|
-
6. **Are edge cases and errors handled?**
|
|
168
|
-
|
|
169
|
-
## Approval Checklist
|
|
170
|
-
|
|
171
|
-
| Role | Check |
|
|
172
|
-
|------|-------|
|
|
173
|
-
| Author | All sections complete |
|
|
174
|
-
| Tech Lead | Architecture aligned |
|
|
175
|
-
| Product | Requirements mapped |
|
|
176
|
-
| QA | Tests adequate |
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
# Spec Templates
|
|
2
|
-
|
|
3
|
-
Templates for different implementation types.
|
|
4
|
-
|
|
5
|
-
## Backend API Spec
|
|
6
|
-
|
|
7
|
-
For API/service implementations:
|
|
8
|
-
|
|
9
|
-
```markdown
|
|
10
|
-
# UC-{GROUP}-{NNN}: {Title}
|
|
11
|
-
|
|
12
|
-
> **Type**: Backend API
|
|
13
|
-
> **BRD**: [→](../../../brd/use-cases/UC-XXX-NNN.md)
|
|
14
|
-
|
|
15
|
-
## Endpoint
|
|
16
|
-
|
|
17
|
-
`{METHOD} /api/{path}`
|
|
18
|
-
|
|
19
|
-
## Authentication
|
|
20
|
-
- [ ] Public
|
|
21
|
-
- [ ] Requires auth token
|
|
22
|
-
- [ ] Requires specific role: {role}
|
|
23
|
-
|
|
24
|
-
## Request
|
|
25
|
-
|
|
26
|
-
### Headers
|
|
27
|
-
| Header | Value | Required |
|
|
28
|
-
|--------|-------|----------|
|
|
29
|
-
| Authorization | Bearer {token} | Yes |
|
|
30
|
-
| Content-Type | application/json | Yes |
|
|
31
|
-
|
|
32
|
-
### Body
|
|
33
|
-
```json
|
|
34
|
-
{
|
|
35
|
-
"field": "string",
|
|
36
|
-
"field2": 123
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Validation Rules
|
|
41
|
-
| Field | Rules |
|
|
42
|
-
|-------|-------|
|
|
43
|
-
| field | required, string, max:255 |
|
|
44
|
-
| field2 | required, integer, min:0 |
|
|
45
|
-
|
|
46
|
-
## Response
|
|
47
|
-
|
|
48
|
-
### Success (200)
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"success": true,
|
|
52
|
-
"data": {}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Errors
|
|
57
|
-
| Status | Code | Message | When |
|
|
58
|
-
|--------|------|---------|------|
|
|
59
|
-
| 400 | VALIDATION_ERROR | Invalid input | Validation fails |
|
|
60
|
-
| 401 | UNAUTHORIZED | Not authenticated | No/invalid token |
|
|
61
|
-
| 403 | FORBIDDEN | Not authorized | Wrong permissions |
|
|
62
|
-
| 404 | NOT_FOUND | Resource not found | ID doesn't exist |
|
|
63
|
-
| 500 | SERVER_ERROR | Internal error | Unexpected error |
|
|
64
|
-
|
|
65
|
-
## Database Operations
|
|
66
|
-
- [ ] Read only
|
|
67
|
-
- [ ] Creates records
|
|
68
|
-
- [ ] Updates records
|
|
69
|
-
- [ ] Deletes records
|
|
70
|
-
- [ ] Transaction required
|
|
71
|
-
|
|
72
|
-
### Queries
|
|
73
|
-
```sql
|
|
74
|
-
-- Main query
|
|
75
|
-
SELECT * FROM {table} WHERE ...
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Business Logic
|
|
79
|
-
|
|
80
|
-
1. Validate input
|
|
81
|
-
2. Check permissions
|
|
82
|
-
3. {Core logic}
|
|
83
|
-
4. Return response
|
|
84
|
-
|
|
85
|
-
## Edge Cases
|
|
86
|
-
- {Edge case 1}: {How to handle}
|
|
87
|
-
- {Edge case 2}: {How to handle}
|
|
88
|
-
|
|
89
|
-
## Tests
|
|
90
|
-
|
|
91
|
-
### Unit
|
|
92
|
-
- [ ] Validation: valid input accepted
|
|
93
|
-
- [ ] Validation: invalid input rejected
|
|
94
|
-
- [ ] Logic: {core logic test}
|
|
95
|
-
|
|
96
|
-
### Integration
|
|
97
|
-
- [ ] Success path
|
|
98
|
-
- [ ] Auth required
|
|
99
|
-
- [ ] Error cases
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Frontend Component Spec
|
|
103
|
-
|
|
104
|
-
For UI implementations:
|
|
105
|
-
|
|
106
|
-
```markdown
|
|
107
|
-
# UC-{GROUP}-{NNN}: {Title}
|
|
108
|
-
|
|
109
|
-
> **Type**: Frontend UI
|
|
110
|
-
> **BRD**: [→](../../../brd/use-cases/UC-XXX-NNN.md)
|
|
111
|
-
|
|
112
|
-
## Component
|
|
113
|
-
|
|
114
|
-
**Name**: `{ComponentName}`
|
|
115
|
-
**Location**: `src/components/{path}/{ComponentName}.tsx`
|
|
116
|
-
|
|
117
|
-
## Props
|
|
118
|
-
|
|
119
|
-
| Prop | Type | Required | Default | Description |
|
|
120
|
-
|------|------|----------|---------|-------------|
|
|
121
|
-
| prop1 | string | Yes | - | Description |
|
|
122
|
-
| prop2 | number | No | 0 | Description |
|
|
123
|
-
| onSubmit | (data) => void | Yes | - | Callback |
|
|
124
|
-
|
|
125
|
-
## State
|
|
126
|
-
|
|
127
|
-
| State | Type | Purpose |
|
|
128
|
-
|-------|------|---------|
|
|
129
|
-
| isLoading | boolean | Loading indicator |
|
|
130
|
-
| error | string | null | Error message |
|
|
131
|
-
| data | T | null | Fetched data |
|
|
132
|
-
|
|
133
|
-
## API Integration
|
|
134
|
-
|
|
135
|
-
| Action | Endpoint | When |
|
|
136
|
-
|--------|----------|------|
|
|
137
|
-
| Fetch | GET /api/x | On mount |
|
|
138
|
-
| Submit | POST /api/x | On form submit |
|
|
139
|
-
|
|
140
|
-
## UI Elements
|
|
141
|
-
|
|
142
|
-
| Element | Type | Behavior |
|
|
143
|
-
|---------|------|----------|
|
|
144
|
-
| Email input | text | Required, email validation |
|
|
145
|
-
| Submit button | button | Disabled while loading |
|
|
146
|
-
| Error alert | alert | Shows on error |
|
|
147
|
-
|
|
148
|
-
## User Interactions
|
|
149
|
-
|
|
150
|
-
| Interaction | Result |
|
|
151
|
-
|-------------|--------|
|
|
152
|
-
| Click submit | Validate → Call API → Show result |
|
|
153
|
-
| Input change | Update state, clear errors |
|
|
154
|
-
|
|
155
|
-
## Loading States
|
|
156
|
-
- Initial load: Show skeleton
|
|
157
|
-
- Submitting: Disable form, show spinner
|
|
158
|
-
- Error: Show error message, enable retry
|
|
159
|
-
|
|
160
|
-
## Error Handling
|
|
161
|
-
|
|
162
|
-
| Error | Display |
|
|
163
|
-
|-------|---------|
|
|
164
|
-
| Validation | Inline field errors |
|
|
165
|
-
| API error | Toast notification |
|
|
166
|
-
| Network error | Retry banner |
|
|
167
|
-
|
|
168
|
-
## Accessibility
|
|
169
|
-
- [ ] Keyboard navigation
|
|
170
|
-
- [ ] Screen reader labels
|
|
171
|
-
- [ ] Focus management
|
|
172
|
-
- [ ] Error announcements
|
|
173
|
-
|
|
174
|
-
## Tests
|
|
175
|
-
|
|
176
|
-
### Unit
|
|
177
|
-
- [ ] Renders correctly
|
|
178
|
-
- [ ] Props work as expected
|
|
179
|
-
- [ ] State changes correctly
|
|
180
|
-
|
|
181
|
-
### Integration
|
|
182
|
-
- [ ] Form submission
|
|
183
|
-
- [ ] Error handling
|
|
184
|
-
- [ ] Loading states
|
|
185
|
-
|
|
186
|
-
### E2E
|
|
187
|
-
- [ ] Full user flow
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Full-Stack Spec
|
|
191
|
-
|
|
192
|
-
For features spanning frontend and backend:
|
|
193
|
-
|
|
194
|
-
```markdown
|
|
195
|
-
# UC-{GROUP}-{NNN}: {Title}
|
|
196
|
-
|
|
197
|
-
> **Type**: Full-Stack
|
|
198
|
-
> **BRD**: [→](../../../brd/use-cases/UC-XXX-NNN.md)
|
|
199
|
-
|
|
200
|
-
## Overview
|
|
201
|
-
{What this implements end-to-end}
|
|
202
|
-
|
|
203
|
-
## Data Flow
|
|
204
|
-
|
|
205
|
-
```mermaid
|
|
206
|
-
sequenceDiagram
|
|
207
|
-
User->>Frontend: Action
|
|
208
|
-
Frontend->>API: Request
|
|
209
|
-
API->>Database: Query
|
|
210
|
-
Database-->>API: Result
|
|
211
|
-
API-->>Frontend: Response
|
|
212
|
-
Frontend-->>User: Update UI
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## Backend
|
|
216
|
-
|
|
217
|
-
### Endpoint
|
|
218
|
-
`{METHOD} /api/{path}`
|
|
219
|
-
|
|
220
|
-
### Handler
|
|
221
|
-
```
|
|
222
|
-
File: src/api/{path}.ts
|
|
223
|
-
Function: handle{Action}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Database
|
|
227
|
-
```
|
|
228
|
-
Table: {table}
|
|
229
|
-
Operation: {read/write/update/delete}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
## Frontend
|
|
233
|
-
|
|
234
|
-
### Component
|
|
235
|
-
```
|
|
236
|
-
File: src/components/{path}.tsx
|
|
237
|
-
Name: {ComponentName}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### State Management
|
|
241
|
-
```
|
|
242
|
-
Store: {store/context}
|
|
243
|
-
Actions: {actions used}
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Implementation Sequence
|
|
247
|
-
|
|
248
|
-
1. [ ] Database: Add migration
|
|
249
|
-
2. [ ] Backend: Create endpoint
|
|
250
|
-
3. [ ] Backend: Add tests
|
|
251
|
-
4. [ ] Frontend: Create component
|
|
252
|
-
5. [ ] Frontend: Integrate API
|
|
253
|
-
6. [ ] Frontend: Add tests
|
|
254
|
-
7. [ ] E2E: Add test
|
|
255
|
-
|
|
256
|
-
## Shared Dependencies
|
|
257
|
-
- {Shared types}
|
|
258
|
-
- {Shared validation}
|
|
259
|
-
- {Shared utilities}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Mobile App Spec
|
|
263
|
-
|
|
264
|
-
For mobile implementations:
|
|
265
|
-
|
|
266
|
-
```markdown
|
|
267
|
-
# UC-{GROUP}-{NNN}: {Title}
|
|
268
|
-
|
|
269
|
-
> **Type**: Mobile
|
|
270
|
-
> **BRD**: [→](../../../brd/use-cases/UC-XXX-NNN.md)
|
|
271
|
-
|
|
272
|
-
## Screen
|
|
273
|
-
|
|
274
|
-
**Name**: `{ScreenName}`
|
|
275
|
-
**Location**: `src/screens/{path}/{ScreenName}.tsx`
|
|
276
|
-
|
|
277
|
-
## Navigation
|
|
278
|
-
- **From**: {Previous screen}
|
|
279
|
-
- **To**: {Next screen(s)}
|
|
280
|
-
- **Params**: {Route params}
|
|
281
|
-
|
|
282
|
-
## Layout
|
|
283
|
-
|
|
284
|
-
```
|
|
285
|
-
┌─────────────────────┐
|
|
286
|
-
│ Header │
|
|
287
|
-
├─────────────────────┤
|
|
288
|
-
│ │
|
|
289
|
-
│ Content │
|
|
290
|
-
│ │
|
|
291
|
-
├─────────────────────┤
|
|
292
|
-
│ Footer │
|
|
293
|
-
└─────────────────────┘
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
## Components
|
|
297
|
-
|
|
298
|
-
| Component | Purpose |
|
|
299
|
-
|-----------|---------|
|
|
300
|
-
| {Name} | {Purpose} |
|
|
301
|
-
|
|
302
|
-
## API Calls
|
|
303
|
-
|
|
304
|
-
| Action | Endpoint | Trigger |
|
|
305
|
-
|--------|----------|---------|
|
|
306
|
-
| Load | GET /api/x | Screen focus |
|
|
307
|
-
| Submit | POST /api/x | Button press |
|
|
308
|
-
|
|
309
|
-
## Offline Handling
|
|
310
|
-
- [ ] Works offline
|
|
311
|
-
- [ ] Requires network
|
|
312
|
-
- [ ] Queues for sync
|
|
313
|
-
|
|
314
|
-
## Platform-Specific
|
|
315
|
-
|
|
316
|
-
| iOS | Android |
|
|
317
|
-
|-----|---------|
|
|
318
|
-
| {Specific} | {Specific} |
|
|
319
|
-
|
|
320
|
-
## Performance
|
|
321
|
-
- [ ] List virtualization
|
|
322
|
-
- [ ] Image optimization
|
|
323
|
-
- [ ] Memoization
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
## Data Model Spec
|
|
327
|
-
|
|
328
|
-
For database/schema changes:
|
|
329
|
-
|
|
330
|
-
```markdown
|
|
331
|
-
# Data Model: {Feature}
|
|
332
|
-
|
|
333
|
-
## New Entities
|
|
334
|
-
|
|
335
|
-
### {EntityName}
|
|
336
|
-
|
|
337
|
-
| Field | Type | Constraints | Description |
|
|
338
|
-
|-------|------|-------------|-------------|
|
|
339
|
-
| id | uuid | PK | Primary key |
|
|
340
|
-
| createdAt | timestamp | NOT NULL | Creation time |
|
|
341
|
-
| updatedAt | timestamp | NOT NULL | Last update |
|
|
342
|
-
| {field} | {type} | {constraints} | {description} |
|
|
343
|
-
|
|
344
|
-
### Relationships
|
|
345
|
-
|
|
346
|
-
```mermaid
|
|
347
|
-
erDiagram
|
|
348
|
-
ENTITY1 ||--o{ ENTITY2 : has
|
|
349
|
-
ENTITY2 }|--|| ENTITY3 : belongs
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
## Migrations
|
|
353
|
-
|
|
354
|
-
### Migration 001: {name}
|
|
355
|
-
|
|
356
|
-
```sql
|
|
357
|
-
-- Up
|
|
358
|
-
CREATE TABLE {table} (
|
|
359
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
360
|
-
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
361
|
-
...
|
|
362
|
-
);
|
|
363
|
-
|
|
364
|
-
CREATE INDEX idx_{table}_{field} ON {table}({field});
|
|
365
|
-
|
|
366
|
-
-- Down
|
|
367
|
-
DROP TABLE {table};
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### Migration 002: {name}
|
|
371
|
-
|
|
372
|
-
```sql
|
|
373
|
-
-- Up
|
|
374
|
-
ALTER TABLE {table} ADD COLUMN {column} {type};
|
|
375
|
-
|
|
376
|
-
-- Down
|
|
377
|
-
ALTER TABLE {table} DROP COLUMN {column};
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
## Indexes
|
|
381
|
-
|
|
382
|
-
| Table | Index | Columns | Purpose |
|
|
383
|
-
|-------|-------|---------|---------|
|
|
384
|
-
| {table} | idx_xxx | {cols} | {why} |
|
|
385
|
-
|
|
386
|
-
## Seed Data
|
|
387
|
-
|
|
388
|
-
```sql
|
|
389
|
-
INSERT INTO {table} (col1, col2) VALUES
|
|
390
|
-
('val1', 'val2'),
|
|
391
|
-
('val3', 'val4');
|
|
392
|
-
```
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
## Service/Worker Spec
|
|
396
|
-
|
|
397
|
-
For background jobs, services:
|
|
398
|
-
|
|
399
|
-
```markdown
|
|
400
|
-
# UC-{GROUP}-{NNN}: {Title}
|
|
401
|
-
|
|
402
|
-
> **Type**: Service/Worker
|
|
403
|
-
> **BRD**: [→](../../../brd/use-cases/UC-XXX-NNN.md)
|
|
404
|
-
|
|
405
|
-
## Service
|
|
406
|
-
|
|
407
|
-
**Name**: `{ServiceName}`
|
|
408
|
-
**Location**: `src/services/{path}.ts`
|
|
409
|
-
|
|
410
|
-
## Trigger
|
|
411
|
-
|
|
412
|
-
- [ ] Scheduled (cron)
|
|
413
|
-
- [ ] Event-driven
|
|
414
|
-
- [ ] Queue-based
|
|
415
|
-
- [ ] Manual
|
|
416
|
-
|
|
417
|
-
### Schedule
|
|
418
|
-
```
|
|
419
|
-
Cron: 0 * * * * # Every hour
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
### Event
|
|
423
|
-
```
|
|
424
|
-
Topic: {event.topic}
|
|
425
|
-
Payload: { ... }
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
## Logic
|
|
429
|
-
|
|
430
|
-
1. {Step 1}
|
|
431
|
-
2. {Step 2}
|
|
432
|
-
3. {Step 3}
|
|
433
|
-
|
|
434
|
-
## Dependencies
|
|
435
|
-
|
|
436
|
-
| Service | Purpose |
|
|
437
|
-
|---------|---------|
|
|
438
|
-
| Database | Read/write data |
|
|
439
|
-
| Queue | Publish events |
|
|
440
|
-
| External API | {Purpose} |
|
|
441
|
-
|
|
442
|
-
## Error Handling
|
|
443
|
-
|
|
444
|
-
| Error | Action |
|
|
445
|
-
|-------|--------|
|
|
446
|
-
| Retryable | Retry with backoff |
|
|
447
|
-
| Fatal | Log, alert, skip |
|
|
448
|
-
|
|
449
|
-
## Monitoring
|
|
450
|
-
|
|
451
|
-
| Metric | Type | Alert |
|
|
452
|
-
|--------|------|-------|
|
|
453
|
-
| Execution time | gauge | > 5min |
|
|
454
|
-
| Error rate | counter | > 5% |
|
|
455
|
-
| Queue depth | gauge | > 1000 |
|
|
456
|
-
|
|
457
|
-
## Idempotency
|
|
458
|
-
- [ ] Safe to retry
|
|
459
|
-
- [ ] Deduplication key: {key}
|
|
460
|
-
```
|