@codihaus/claude-skills 1.6.6 → 1.6.8

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
@@ -38,166 +38,88 @@ Automated testing using Playwright to verify implementation works correctly.
38
38
  | Visual State | `browser_snapshot` | Render errors, missing elements |
39
39
  | Interactions | `browser_click`, `browser_type` | Form failures, broken buttons |
40
40
 
41
- ## Workflow
41
+ ## Expected Outcome
42
+
43
+ Test report showing whether implementation works correctly.
44
+
45
+ **Report includes:**
46
+ - Overall status (Pass/Fail + issue count)
47
+ - Issues found (critical/warning with location + suggested fix)
48
+ - Test steps executed (which passed/failed)
49
+ - Suggested fixes or next actions
50
+
51
+ ## Success Criteria
52
+
53
+ - No console errors during user flows
54
+ - No network failures (API 4xx/5xx)
55
+ - Expected elements render correctly
56
+ - User interactions work as expected
57
+ - Happy path completes successfully
58
+ - All acceptance criteria from spec verified
59
+
60
+ ## What to Test
61
+
62
+ **From UC spec:**
63
+ - Expected user flows (happy path)
64
+ - Required inputs and outputs
65
+ - Acceptance criteria
66
+ - Error scenarios (if specified)
67
+
68
+ **From recent changes:**
69
+ - Modified components/endpoints
70
+ - New functionality added
71
+
72
+ ## Error Detection
73
+
74
+ | Check | What It Catches |
75
+ |-------|----------------|
76
+ | Console Errors | JS errors, React errors, warnings, unhandled promises |
77
+ | Network Failures | API 4xx/5xx, failed fetches, timeouts |
78
+ | Visual State | Render errors, missing elements, wrong state |
79
+ | Interactions | Form failures, broken buttons, navigation issues |
80
+
81
+ **Error categories:**
82
+ - 🔴 **Critical:** Breaks functionality, must fix
83
+ - 🟡 **Warning:** Should fix, not blocking
84
+
85
+ ## Test Approach
86
+
87
+ **1. Prepare:**
88
+ - Identify what to test (from spec + recent changes)
89
+ - Determine test URL (from spec or default: http://localhost:3000)
90
+ - Verify dev server running (prompt if not)
91
+
92
+ **2. Execute User Flows:**
93
+ - Navigate to page
94
+ - Capture initial state (check page loads, no immediate errors)
95
+ - Execute happy path (fill forms, click buttons, navigate)
96
+ - Wait for expected results
97
+ - Capture final state
98
+
99
+ **3. Collect Errors:**
100
+ - Console messages (errors, warnings)
101
+ - Network requests (find failures)
102
+ - Visual issues (missing elements)
103
+
104
+ **4. Report:**
105
+ - Status (pass/fail + count)
106
+ - Issues with severity, location, suggested fix
107
+ - Test steps executed (which passed/failed)
108
+
109
+ **5. Fix Loop (if --fix):**
110
+ - For each issue: read file, identify fix, apply fix, re-test
111
+ - Continue until fixed or max iterations (3) or needs user input
112
+ - Re-run full test to verify
42
113
 
43
- ### Phase 1: Prepare Test Context
44
-
45
- ```
46
- 1. Identify what to test
47
- → From UC spec: expected flows, inputs, outputs
48
- → From recent changes: modified components/endpoints
49
-
50
- 2. Determine test URL
51
- → From spec or project config
52
- → Default: http://localhost:3000
53
-
54
- 3. Check if dev server running
55
- → Look for existing process on port
56
- → If not, prompt user to start it
57
- ```
58
-
59
- ### Phase 2: Navigate and Capture Initial State
60
-
61
- ```typescript
62
- // Navigate to the page
63
- await mcp__playwright__browser_navigate({
64
- url: 'http://localhost:3000/login'
65
- });
66
-
67
- // Wait for page to stabilize
68
- await mcp__playwright__browser_wait_for({ time: 2 });
69
-
70
- // Capture accessibility snapshot (better than screenshot for analysis)
71
- await mcp__playwright__browser_snapshot({});
72
- ```
73
-
74
- **Check for immediate errors:**
75
- - Page loads without errors
76
- - Expected elements present
77
- - No console errors on load
78
-
79
- ### Phase 3: Test User Flows
80
-
81
- From the UC spec, execute the happy path:
82
-
83
- ```typescript
84
- // Example: Login flow
85
- // Step 1: Fill form
86
- await mcp__playwright__browser_type({
87
- element: 'email input',
88
- ref: 'input-email', // From snapshot
89
- text: 'test@example.com'
90
- });
91
-
92
- await mcp__playwright__browser_type({
93
- element: 'password input',
94
- ref: 'input-password',
95
- text: 'password123'
96
- });
97
-
98
- // Step 2: Submit
99
- await mcp__playwright__browser_click({
100
- element: 'login button',
101
- ref: 'btn-login'
102
- });
103
-
104
- // Step 3: Wait for response
105
- await mcp__playwright__browser_wait_for({
106
- text: 'Dashboard' // Expected after login
107
- });
108
-
109
- // Step 4: Verify result
110
- await mcp__playwright__browser_snapshot({});
111
- ```
112
-
113
- ### Phase 4: Collect Errors
114
-
115
- ```typescript
116
- // Get console messages (errors, warnings)
117
- const console = await mcp__playwright__browser_console_messages({
118
- level: 'error'
119
- });
120
-
121
- // Get network requests (find failures)
122
- const network = await mcp__playwright__browser_network_requests({});
123
-
124
- // Filter for issues:
125
- // - Console: Any error level messages
126
- // - Network: Status >= 400, or failed requests
127
- ```
128
-
129
- **Error Categories:**
130
-
131
- | Category | Source | Examples |
132
- |----------|--------|----------|
133
- | JS Errors | Console | TypeError, ReferenceError, unhandled promise |
134
- | React Errors | Console | Component errors, hooks violations |
135
- | API Errors | Network | 400 Bad Request, 401 Unauthorized, 500 Server Error |
136
- | Network Errors | Network | Failed to fetch, CORS, timeout |
137
- | Render Errors | Snapshot | Missing elements, wrong state |
138
-
139
- ### Phase 5: Generate Report
140
-
141
- ```markdown
142
- ## Test Report
143
-
144
- **Target**: UC-AUTH-001 Login
145
- **URL**: http://localhost:3000/login
146
- **Status**: ❌ Failed (3 issues)
147
-
148
- ### Issues Found
149
-
150
- #### 🔴 Critical
151
-
152
- 1. **API Error**: POST /api/auth/login returned 500
153
- - Response: `{"error":"Internal server error"}`
154
- - Likely cause: Database connection or missing env var
155
- - File: Check `src/app/api/auth/login/route.ts`
156
-
157
- 2. **Console Error**: Unhandled promise rejection
158
- - Message: `Cannot read property 'id' of undefined`
159
- - Stack: `LoginForm.tsx:45`
160
- - Cause: API response handling when login fails
161
-
162
- #### 🟡 Warning
163
-
164
- 3. **Console Warning**: Missing key prop in list
165
- - Component: `ErrorMessages.tsx`
166
- - Not critical but should fix
167
-
168
- ### Test Steps Executed
169
-
170
- | Step | Action | Result |
171
- |------|--------|--------|
172
- | 1 | Navigate to /login | ✓ Page loaded |
173
- | 2 | Fill email | ✓ Input accepted |
174
- | 3 | Fill password | ✓ Input accepted |
175
- | 4 | Click login | ✗ Error occurred |
176
- | 5 | Verify dashboard | ⏭ Skipped |
177
-
178
- ### Suggested Fixes
179
-
180
- 1. Check database connection in backend
181
- 2. Add error handling in LoginForm.tsx:45
182
- 3. Add key prop to ErrorMessages.tsx list items
183
- ```
114
+ ## Test Patterns
184
115
 
185
- ### Phase 6: Fix Loop (if --fix)
116
+ Available as reference in original SKILL.md:
117
+ - Form submission
118
+ - Navigation flow
119
+ - API response validation
120
+ - Error state testing
186
121
 
187
- ```
188
- 1. For each issue:
189
- a. Read the problematic file
190
- b. Identify the fix
191
- c. Apply the fix
192
- d. Re-run failed test step
193
-
194
- 2. Continue until:
195
- - All issues fixed, OR
196
- - Max iterations reached (3), OR
197
- - Issue requires user input
198
-
199
- 3. Re-run full test to verify
200
- ```
122
+ Use Playwright MCP tools to interact with browser.
201
123
 
202
124
  ## Test Patterns
203
125
 
@@ -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
- ```