@codihaus/claude-skills 1.6.6 → 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.
@@ -0,0 +1,146 @@
1
+ # UC Spec Template
2
+
3
+ ## Principle
4
+
5
+ **Include:** Requirements (testable), technical constraints, acceptance criteria, file checklist
6
+ **Exclude:** Pseudocode, detailed HOW, code examples (reference patterns instead)
7
+ **Length:** ~150 lines max per UC
8
+
9
+ ---
10
+
11
+ ## Structure
12
+
13
+ ```markdown
14
+ # UC-{GROUP}-{NNN}: {Title}
15
+
16
+ > **Feature**: [[feature-{feature}]]
17
+ > **BRD**: [[uc-{group}-{nnn}]]
18
+ > **Status**: Draft
19
+ > **Spec Type**: Lean (Requirements-focused)
20
+
21
+ ## Context
22
+
23
+ {2-3 sentences on what this UC implements and why}
24
+
25
+ **Links:**
26
+ - Use Case: [UC-{GROUP}-{NNN}](../../brd/use-cases/{feature}/UC-{GROUP}-{NNN}-{slug}.md)
27
+ - Codebase Context: [codebase-context.md](../codebase-context.md)
28
+
29
+ ## Requirements
30
+
31
+ **Must Have:**
32
+ - [ ] {testable requirement}
33
+ - [ ] {testable requirement}
34
+
35
+ **Should Have:**
36
+ - [ ] {nice-to-have}
37
+
38
+ **Must Not:**
39
+ - [ ] {what should NOT happen}
40
+
41
+ ## Technical Constraints
42
+
43
+ **Stack & Patterns** (from tech-context.md):
44
+ - API Layer: {use X pattern}
45
+ - Data Access: {use Y method}
46
+ - Client Pattern: {use Z}
47
+ - Validation: {where schemas go}
48
+ - Forms: {which library}
49
+
50
+ **Code Location:**
51
+ - Primary location: `{path}`
52
+ - Related files: `{paths}`
53
+ - Follow pattern: `{reference file}`
54
+
55
+ **External Dependencies:**
56
+ {if applicable}
57
+
58
+ **Constraints:**
59
+ {performance/security/business rules}
60
+
61
+ ## Acceptance Criteria
62
+
63
+ **Happy Path:**
64
+ - [ ] Given {condition}, When {action}, Then {outcome}
65
+
66
+ **Error Cases:**
67
+ - [ ] Given {invalid}, When {action}, Then {error shown}
68
+
69
+ **Edge Cases:**
70
+ - [ ] Given {edge}, When {action}, Then {behavior}
71
+
72
+ ## Files to Modify
73
+
74
+ **New Files:**
75
+ - [ ] `{path}` - {purpose}
76
+
77
+ **Modified Files:**
78
+ - [ ] `{path}` - {what changes}
79
+
80
+ **Reference Pattern:**
81
+ - See `{existing file}` for similar implementation
82
+
83
+ ## API Contract (if applicable)
84
+
85
+ **Endpoint:** `{METHOD} {path}`
86
+
87
+ **Request:**
88
+ ```json
89
+ {
90
+ "field": "type"
91
+ }
92
+ ```
93
+
94
+ **Response (Success):**
95
+ ```json
96
+ {
97
+ "field": "type"
98
+ }
99
+ ```
100
+
101
+ **Response (Error):**
102
+ | Status | Reason | Body |
103
+ |--------|--------|------|
104
+ | 400 | | |
105
+ | 401 | | |
106
+
107
+ ## Test Checklist
108
+
109
+ **Unit Tests:**
110
+ - [ ] {what to test} in `{file}.test.ts`
111
+
112
+ **Integration Tests:**
113
+ - [ ] {scenario} - {expected outcome}
114
+
115
+ **E2E Tests** (if applicable):
116
+ - [ ] {user flow} - {expected result}
117
+
118
+ ## Dependencies
119
+
120
+ **Must Exist Before Implementation:**
121
+ - [ ] {dependency}
122
+
123
+ **Blocks:**
124
+ - [ ] [[uc-{group}-{nnn}]] - {why}
125
+
126
+ ## Implementation Notes
127
+
128
+ **DO:**
129
+ - {guidance}
130
+
131
+ **DON'T:**
132
+ - {anti-pattern}
133
+
134
+ **Watch Out For:**
135
+ - {gotcha}
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Key Rules
141
+
142
+ 1. **No pseudocode** - requirements and constraints only
143
+ 2. **Reference patterns** - don't rewrite them
144
+ 3. **Testable criteria** - every requirement maps to a test
145
+ 4. **Stack-aware** - uses tech-context.md for correct approach
146
+ 5. **Scannable** - read in 2-3 minutes
@@ -49,7 +49,7 @@ const DEFAULT_SETTINGS = {
49
49
  hooks: [
50
50
  {
51
51
  type: "command",
52
- command: "jq -r '.tool_input.file_path // empty' | { read file_path; if [ -n \"$file_path\" ] && echo \"$file_path\" | grep -q 'plans/.*\\.md$'; then bash .claude/scripts/safe-graph-update.sh \"$file_path\" 2>/dev/null || true; fi; }"
52
+ command: "jq -r '.tool_input.file_path // empty' | { read file_path; if [ -n \"$file_path\" ] && echo \"$file_path\" | grep -q 'plans/.*\\.md$'; then python3 .claude/scripts/graph.py --check-path \"$file_path\" 2>/dev/null || true; fi; }"
53
53
  }
54
54
  ]
55
55
  }
@@ -13,7 +13,9 @@ set -e
13
13
 
14
14
  # Configuration
15
15
  TIMEOUT_SECONDS=10
16
- GRAPH_SCRIPT=".claude/scripts/graph.py"
16
+ # Get the directory where this script is located
17
+ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
18
+ GRAPH_SCRIPT="$SCRIPT_DIR/graph.py"
17
19
  MAX_RETRIES=0 # Let Claude Code handle retries
18
20
 
19
21
  # Colors for output (optional)
@@ -1,240 +0,0 @@
1
- ---
2
- name: dev-coding-backend
3
- description: Backend implementation patterns and workflows
4
- version: 2.1.0
5
- ---
6
-
7
- # /dev-coding-backend - Backend Implementation
8
-
9
- > **Loaded by**: `/dev-coding` when API/schema work needed
10
- > **After**: Frontend uses API contract documented here
11
-
12
- Backend-specific workflow for API, schema, and data layer implementation.
13
-
14
- ## Fundamentals (MUST READ FIRST)
15
-
16
- **Before implementing, understand the principles:**
17
-
18
- → Read `references/fundamentals.md`
19
-
20
- This covers:
21
- - **Core Mindset**: "Guardian of truth, trust nothing, enforce rules"
22
- - **7 Principles**: Separation of Concerns, Single Source of Truth, Don't Repeat Work, Don't Make Users Wait, Don't Trust Anyone, Plan for Failure, Stateless Design
23
- - **Pattern Recognition**: When to use Service Layer, Repository, Queue, Cache, Circuit Breaker, etc.
24
- - **Architecture Layers**: Route → Service → Domain → Repository → Infrastructure
25
-
26
- **Key Decision**: For each piece of code, ask "which principle applies?" Then choose the pattern that principle suggests.
27
-
28
- ## Knowledge Loading (CRITICAL)
29
-
30
- Before implementing, load relevant knowledge:
31
-
32
- ```
33
- 1. Read stack.md → plans/scout/stack.md
34
- → Identify: API layer, SDK, data access method
35
-
36
- 2. Load stack knowledge based on detected tech:
37
- | If using... | Read... | Section |
38
- |--------------|-----------------------------------|-------------------|
39
- | Directus | knowledge/stacks/directus/_index.md | "For /dev-coding" |
40
- | Nuxt server | knowledge/stacks/nuxt/_index.md | "Server Routes" |
41
- | Next.js API | knowledge/stacks/nextjs/_index.md | "API Routes" |
42
-
43
- 3. Load domain knowledge (if applicable):
44
- | If domain... | Read... | Section |
45
- |--------------|-----------------------------------|-------------------|
46
- | SaaS | knowledge/domains/saas/_index.md | Billing, Multi-tenant |
47
- | E-commerce | knowledge/domains/ecommerce/_index.md | Orders, Payments |
48
-
49
- 4. Use loaded knowledge for:
50
- → Correct SDK usage (not raw fetch)
51
- → Domain-specific validation rules
52
- → Stack-specific error handling
53
- ```
54
-
55
- ## Workflow
56
-
57
- ### Step 1: Extract Backend Requirements
58
-
59
- From UC spec, identify:
60
-
61
- ```
62
- [ ] Schema changes?
63
- → New collections/tables
64
- → New fields
65
- → Relations
66
-
67
- [ ] API endpoints?
68
- → Method + Path
69
- → Request/Response shape
70
- → Auth required?
71
-
72
- [ ] Business logic?
73
- → Validation rules
74
- → Side effects (emails, webhooks)
75
-
76
- [ ] External integrations?
77
- → Third-party APIs
78
- → File storage
79
- ```
80
-
81
- ### Step 2: Schema First
82
-
83
- **Order:** Schema → API → Logic
84
-
85
- ```
86
- 1. Design schema based on spec
87
- 2. Create/modify collections or tables
88
- 3. Set up relations
89
- 4. Configure permissions
90
- 5. Verify schema works
91
- ```
92
-
93
- ### Step 3: API Implementation
94
-
95
- For each endpoint:
96
-
97
- ```
98
- 1. Create route/handler
99
- 2. Parse request
100
- 3. Validate input
101
- 4. Implement logic
102
- 5. Handle errors
103
- 6. Return response
104
- ```
105
-
106
- **Follow project patterns** from scout (file locations, naming, error format).
107
-
108
- ### Step 4: Essential Patterns
109
-
110
- #### Request Validation (always do this)
111
-
112
- ```typescript
113
- const schema = z.object({
114
- email: z.string().email(),
115
- password: z.string().min(8),
116
- });
117
-
118
- const result = schema.safeParse(req.body);
119
- if (!result.success) {
120
- return res.status(400).json({
121
- error: 'Validation failed',
122
- details: result.error.issues
123
- });
124
- }
125
- ```
126
-
127
- #### Error Response Format
128
-
129
- ```typescript
130
- // Consistent format
131
- { "error": "Message", "code": "ERROR_CODE" }
132
-
133
- // Status codes
134
- 200 - Success 400 - Bad request
135
- 201 - Created 401 - Unauthorized
136
- 403 - Forbidden
137
- 404 - Not found
138
- 500 - Server error
139
- ```
140
-
141
- #### Auth Check
142
-
143
- ```typescript
144
- if (!req.user) {
145
- return res.status(401).json({ error: 'Unauthorized' });
146
- }
147
- if (!hasPermission(req.user, 'create:posts')) {
148
- return res.status(403).json({ error: 'Forbidden' });
149
- }
150
- ```
151
-
152
- ### Step 5: Verify
153
-
154
- ```bash
155
- # Test endpoint
156
- curl -X POST http://localhost:3000/api/auth/login \
157
- -H "Content-Type: application/json" \
158
- -d '{"email":"test@test.com","password":"password123"}'
159
- ```
160
-
161
- Checklist:
162
- ```
163
- [ ] Endpoint responds
164
- [ ] Correct status codes
165
- [ ] Validation rejects bad input
166
- [ ] Auth works correctly
167
- [ ] Response matches spec
168
- ```
169
-
170
- ### Step 6: Document for Frontend
171
-
172
- ```markdown
173
- ## API Ready
174
-
175
- ### POST /api/auth/login
176
- - **Auth**: None
177
- - **Request**: `{ email, password }`
178
- - **Success (200)**: `{ token, user }`
179
- - **Errors**: 400 (invalid), 401 (wrong creds)
180
- ```
181
-
182
- ## Security Checklist
183
-
184
- ```
185
- [ ] Input validated (Zod/Yup)
186
- [ ] Parameterized queries (no SQL injection)
187
- [ ] Auth on protected routes
188
- [ ] Permissions verified
189
- [ ] Passwords hashed
190
- [ ] Secrets in env vars
191
- [ ] No sensitive data in logs
192
- ```
193
-
194
- ## Quick Debugging
195
-
196
- ```bash
197
- # Server running?
198
- curl http://localhost:3000/health
199
-
200
- # Database connected?
201
- npx prisma db pull # or check logs
202
-
203
- # Token valid?
204
- curl http://localhost:3000/api/me -H "Authorization: Bearer $TOKEN"
205
- ```
206
-
207
- ## Stack-Specific Patterns
208
-
209
- **Do not implement generic patterns. Load from stacks/:**
210
-
211
- | Stack | What to load | Key patterns |
212
- |-------|--------------|--------------|
213
- | Directus | `stacks/directus/` | SDK queries, permissions, hooks |
214
- | Prisma | `stacks/prisma/` (future) | ORM patterns, migrations |
215
- | Supabase | `stacks/supabase/` (future) | RLS, auth, realtime |
216
-
217
- **Example - if using Directus:**
218
- ```
219
- 1. Read knowledge/stacks/directus/_index.md
220
- 2. Use ItemsService (not raw SQL)
221
- 3. Follow permission patterns
222
- 4. Use SDK for queries
223
- ```
224
-
225
- ## Domain-Specific Logic
226
-
227
- **Load from domains/ when applicable:**
228
-
229
- | Domain | What to load | Key patterns |
230
- |--------|--------------|--------------|
231
- | SaaS | `domains/saas/_index.md` | Subscription states, billing |
232
- | E-commerce | `domains/ecommerce/_index.md` | Order lifecycle, inventory |
233
-
234
- **Example - SaaS billing endpoint:**
235
- ```
236
- 1. Read knowledge/domains/saas/_index.md
237
- 2. Follow subscription state machine
238
- 3. Handle trial → paid → cancelled states
239
- 4. Validate against billing rules
240
- ```