@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,130 @@
1
+ # Backend Principles
2
+
3
+ Universal backend engineering principles. Combine with tech-context.md for project-specific implementation.
4
+
5
+ ## API Design
6
+
7
+ ### Request/Response
8
+ - Clear endpoint naming (resource-based, action verbs for non-CRUD)
9
+ - Consistent response structure
10
+ - Appropriate HTTP methods (GET, POST, PUT, DELETE, PATCH)
11
+ - Meaningful status codes (200, 201, 400, 401, 403, 404, 500)
12
+
13
+ ### Validation
14
+ - Validate all inputs at API boundary
15
+ - Fail fast with clear error messages
16
+ - Type checking for strong-typed languages
17
+ - Sanitize inputs to prevent injection
18
+
19
+ ### Error Handling
20
+ - Never expose internal errors to clients
21
+ - Consistent error response format
22
+ - Log errors with context (not just message)
23
+ - Distinguish client errors (4xx) from server errors (5xx)
24
+
25
+ ### Authentication & Authorization
26
+ - Authenticate at entry point (middleware/guard)
27
+ - Separate authentication (who you are) from authorization (what you can do)
28
+ - Never trust client-provided identity
29
+ - Token expiration and refresh strategy
30
+
31
+ ## Data Access
32
+
33
+ ### Queries
34
+ - Fetch only what you need (select specific fields)
35
+ - Use indexes for frequently queried fields
36
+ - Pagination for list endpoints (don't return unlimited results)
37
+ - Avoid N+1 queries (use joins or batch loading)
38
+
39
+ ### Transactions
40
+ - Use transactions for multi-step operations
41
+ - Keep transactions short (acquire late, release early)
42
+ - Handle rollback on failure
43
+ - Idempotency for critical operations
44
+
45
+ ### Data Integrity
46
+ - Validate at database level (constraints, foreign keys)
47
+ - Handle concurrent updates (optimistic/pessimistic locking)
48
+ - Soft deletes for critical data (deletedAt, not DELETE)
49
+ - Audit trails for sensitive operations
50
+
51
+ ## Security
52
+
53
+ ### Input Validation
54
+ - Whitelist valid inputs (not blacklist)
55
+ - Validate type, format, range, length
56
+ - Escape/sanitize for context (SQL, HTML, shell)
57
+ - Rate limiting for public endpoints
58
+
59
+ ### Secrets Management
60
+ - Never commit secrets to code
61
+ - Use environment variables or secret managers
62
+ - Rotate secrets regularly
63
+ - Different secrets per environment
64
+
65
+ ### Data Protection
66
+ - Encrypt sensitive data at rest
67
+ - Hash passwords (bcrypt, argon2 - never plain text)
68
+ - Use HTTPS for data in transit
69
+ - Minimize PII collection and storage
70
+
71
+ ## Performance
72
+
73
+ ### Caching
74
+ - Cache expensive computations
75
+ - Cache at appropriate level (CDN, app, database)
76
+ - Invalidation strategy (TTL, event-based)
77
+ - Don't cache sensitive/user-specific data without care
78
+
79
+ ### Async Operations
80
+ - Long-running tasks → background jobs
81
+ - Don't block request/response for slow operations
82
+ - Use queues for reliability
83
+ - Status endpoints for async tasks
84
+
85
+ ### Resource Management
86
+ - Connection pooling for databases
87
+ - Timeouts on external calls
88
+ - Graceful degradation on external service failure
89
+ - Circuit breakers for cascading failures
90
+
91
+ ## Code Organization
92
+
93
+ ### Structure
94
+ - Separate concerns (routes, business logic, data access)
95
+ - Thin controllers/handlers (orchestration only)
96
+ - Business logic in service layer
97
+ - Data access in repository/DAO layer
98
+
99
+ ### Modularity
100
+ - Single responsibility per module/function
101
+ - Dependencies injected (not hard-coded)
102
+ - Testable units (pure functions where possible)
103
+ - Clear interfaces/contracts
104
+
105
+ ### Error Propagation
106
+ - Let errors bubble up with context
107
+ - Handle at appropriate level (not everywhere)
108
+ - Distinguish recoverable vs fatal errors
109
+ - Structured logging for debugging
110
+
111
+ ## Testing
112
+
113
+ ### What to Test
114
+ - Business logic (unit tests)
115
+ - API contracts (integration tests)
116
+ - Error paths (especially edge cases)
117
+ - Security constraints (auth, validation)
118
+
119
+ ### Test Strategy
120
+ - Fast tests in inner layers (business logic)
121
+ - Slower tests at boundaries (API, database)
122
+ - Mock external dependencies
123
+ - Test data isolation (no shared state)
124
+
125
+ ## Remember
126
+
127
+ These are universal principles. Your project implements them specifically:
128
+ - Check tech-context.md for HOW your project does these
129
+ - Example: "API validation" → project uses Zod schemas in schemas/
130
+ - Example: "Data access" → project uses Directus SDK, not raw SQL
@@ -0,0 +1,212 @@
1
+ # Frontend Principles
2
+
3
+ Universal frontend engineering principles. Combine with tech-context.md for project-specific implementation.
4
+
5
+ ## Component Design
6
+
7
+ ### Structure
8
+ - Single responsibility (one job per component)
9
+ - Composition over inheritance
10
+ - Props for configuration, not implementation details
11
+ - Clear component boundaries
12
+
13
+ ### Reusability
14
+ - Generic components (Button, Input) for reuse
15
+ - Feature components (LoginForm) for specific use cases
16
+ - Avoid premature abstraction (3 uses before extracting)
17
+ - Props API for flexibility
18
+
19
+ ### State
20
+ - Local state for UI-only concerns
21
+ - Shared state for cross-component data
22
+ - Lift state up when needed, not preemptively
23
+ - Derive computed values (don't duplicate state)
24
+
25
+ ## Data Fetching
26
+
27
+ ### Loading States
28
+ - Show loading indicators for async operations
29
+ - Skeleton loaders for expected content
30
+ - Don't block UI while fetching
31
+ - Handle slow networks gracefully
32
+
33
+ ### Error Handling
34
+ - Display errors to users (don't fail silently)
35
+ - Retry strategies for transient failures
36
+ - Fallback UI for critical errors
37
+ - Clear error messages (not technical jargon)
38
+
39
+ ### Caching
40
+ - Cache fetched data (avoid re-fetching)
41
+ - Invalidate on mutations
42
+ - Stale-while-revalidate pattern
43
+ - Consider server state libraries
44
+
45
+ ## Forms & Validation
46
+
47
+ ### Validation Timing
48
+ - Validate on blur (not on every keystroke)
49
+ - Show errors after user interaction
50
+ - Re-validate on change after first error
51
+ - Block submit if invalid
52
+
53
+ ### User Experience
54
+ - Clear labels and placeholders
55
+ - Inline validation messages
56
+ - Disable submit during submission
57
+ - Show success feedback
58
+ - Preserve form data on error
59
+
60
+ ### Data Flow
61
+ - Controlled components (single source of truth)
62
+ - Schema-based validation (define once, use everywhere)
63
+ - Handle server-side validation errors
64
+ - Optimistic updates with rollback
65
+
66
+ ## Performance
67
+
68
+ ### Rendering
69
+ - Avoid unnecessary re-renders
70
+ - Memoize expensive computations
71
+ - Virtualize long lists
72
+ - Lazy load below-the-fold content
73
+
74
+ ### Bundle Size
75
+ - Code splitting for routes
76
+ - Lazy load heavy components
77
+ - Tree-shake unused code
78
+ - Optimize images and assets
79
+
80
+ ### User Perception
81
+ - Perceived performance > actual performance
82
+ - Instant feedback on interaction
83
+ - Optimistic UI updates
84
+ - Progressive enhancement
85
+
86
+ ## Accessibility
87
+
88
+ ### Semantics
89
+ - Use semantic HTML (button, nav, main, etc.)
90
+ - Proper heading hierarchy (h1 → h6)
91
+ - Label form inputs (for/id association)
92
+ - Alt text for images
93
+
94
+ ### Keyboard Navigation
95
+ - All interactive elements keyboard accessible
96
+ - Logical tab order
97
+ - Visible focus indicators
98
+ - Keyboard shortcuts for power users
99
+
100
+ ### Screen Readers
101
+ - ARIA labels when semantic HTML insufficient
102
+ - Announce dynamic content changes
103
+ - Skip links for navigation
104
+ - Test with actual screen readers
105
+
106
+ ## State Management
107
+
108
+ ### When to Use
109
+ - Cross-component data → shared state
110
+ - UI-only state → local state
111
+ - Server data → server state library
112
+ - URL state → query parameters
113
+
114
+ ### Patterns
115
+ - Single source of truth (no duplication)
116
+ - Unidirectional data flow
117
+ - Immutable updates
118
+ - Clear action/mutation names
119
+
120
+ ### Avoid
121
+ - Global state for everything (over-engineering)
122
+ - Prop drilling (use context or state library)
123
+ - Mixing server and client state
124
+ - State synchronization bugs
125
+
126
+ ## Security
127
+
128
+ ### XSS Prevention
129
+ - Never use dangerouslySetInnerHTML without sanitization
130
+ - Escape user content before rendering
131
+ - Use framework's built-in escaping
132
+ - Content Security Policy headers
133
+
134
+ ### Sensitive Data
135
+ - Don't store secrets in frontend code
136
+ - Don't expose tokens in URLs
137
+ - Clear sensitive data on logout
138
+ - HTTPS only for auth
139
+
140
+ ### Authentication
141
+ - Check auth state before sensitive operations
142
+ - Handle token expiration gracefully
143
+ - Redirect to login on 401
144
+ - Secure token storage (httpOnly cookies preferred)
145
+
146
+ ## Code Organization
147
+
148
+ ### File Structure
149
+ - Colocate related files (component + styles + tests)
150
+ - Feature-based or type-based folders (pick one)
151
+ - Index files for clean imports
152
+ - Clear naming conventions
153
+
154
+ ### Separation of Concerns
155
+ - Presentation components (dumb, UI only)
156
+ - Container components (smart, data fetching)
157
+ - Utility functions (pure, testable)
158
+ - Business logic separate from UI
159
+
160
+ ### Dependencies
161
+ - Minimize external dependencies
162
+ - Use established libraries for complex problems
163
+ - Avoid deprecated/unmaintained packages
164
+ - Regular dependency updates
165
+
166
+ ## Testing
167
+
168
+ ### What to Test
169
+ - User interactions (click, type, submit)
170
+ - Component rendering with props
171
+ - Error states
172
+ - Accessibility (ARIA, keyboard navigation)
173
+
174
+ ### Test Strategy
175
+ - Unit tests for utility functions
176
+ - Component tests for behavior
177
+ - Integration tests for user flows
178
+ - Visual regression for styling
179
+
180
+ ### Avoid
181
+ - Testing implementation details
182
+ - Brittle selectors (use test IDs or ARIA labels)
183
+ - Testing library code
184
+ - Slow E2E tests for everything
185
+
186
+ ## User Experience
187
+
188
+ ### Feedback
189
+ - Instant response to user actions
190
+ - Progress indicators for long operations
191
+ - Success/error notifications
192
+ - Undo for destructive actions
193
+
194
+ ### Consistency
195
+ - Consistent patterns across app
196
+ - Familiar UI paradigms
197
+ - Predictable navigation
198
+ - Reusable components for consistency
199
+
200
+ ### Responsiveness
201
+ - Mobile-first or desktop-first (pick one)
202
+ - Touch targets minimum 44x44px
203
+ - Readable text size (16px minimum)
204
+ - Works on slow connections
205
+
206
+ ## Remember
207
+
208
+ These are universal principles. Your project implements them specifically:
209
+ - Check tech-context.md for HOW your project does these
210
+ - Example: "Data fetching" → project uses composables in composables/
211
+ - Example: "Validation" → project uses Zod schemas + react-hook-form
212
+ - Example: "State" → project uses Pinia stores in stores/
@@ -69,250 +69,75 @@ Reviews can be based on:
69
69
  - Clean separation of concerns
70
70
  ```
71
71
 
72
- ## Workflow
72
+ ## Expected Outcome
73
+
74
+ Review report with verdict and categorized issues.
75
+
76
+ **Report includes:**
77
+ - Verdict (Approve/Request Changes/Needs Discussion)
78
+ - Issues found (by severity: critical/important/suggestion)
79
+ - Issues by file
80
+ - Positives (acknowledge good work)
81
+ - Spec compliance (if UC provided)
82
+
83
+ ## Success Criteria
84
+
85
+ - Security risks identified
86
+ - Quality issues found
87
+ - Spec compliance verified
88
+ - Conventions checked
89
+ - Constructive feedback with suggested fixes
90
+ - Clear verdict given
91
+
92
+ ## Review Focus Areas
93
+
94
+ ### Security
95
+ - Input validation (sanitized, injection prevented, XSS prevented)
96
+ - Authentication (required where needed, tokens validated, sessions secure)
97
+ - Authorization (permissions checked, data access restricted, admin protected)
98
+ - Data protection (passwords hashed, sensitive data not logged, no secrets in code)
99
+ - API security (rate limiting, CORS, no sensitive data in URLs)
100
+
101
+ ### Quality
102
+ - Error handling (caught, user-friendly messages, logged, not swallowed)
103
+ - Performance (no N+1 queries, pagination on lists, async heavy ops, no memory leaks)
104
+ - Maintainability (readable, functions not too long, no magic values, DRY)
105
+ - Testing (new code tested, edge cases covered, meaningful tests)
106
+
107
+ ### Conventions
108
+ - Naming (variables, files, components per scout)
109
+ - Structure (correct location, follows patterns, organized imports)
110
+ - Style (matches configs, consistent, no linting errors)
111
+ - Git (proper commit format, no unrelated changes, no debug code)
73
112
 
74
- ### Phase 1: Gather Context
75
-
76
- ```
77
- 1. Get changes to review
78
- → git diff (uncommitted)
79
- → git diff --staged (staged only)
80
- → Read specific files
81
-
82
- 2. Read project conventions
83
- → plans/scout/README.md (Conventions section)
84
- → CLAUDE.md
85
- → .eslintrc, tsconfig.json
86
-
87
- 3. Read stack.md and stack knowledge
88
- → plans/scout/stack.md
89
- → Check "Stack Knowledge References" section
90
- → Read each referenced knowledge/stacks/*.md file
91
- → Use "For /dev-review" sections for review checklists
92
-
93
- Examples:
94
- - Directus project → Read knowledge/stacks/directus/_index.md
95
- - Nuxt project → Read knowledge/stacks/nuxt/_index.md
96
- - Next.js project → Read knowledge/stacks/nextjs/_index.md
97
-
98
- 4. Read related spec (if UC provided)
99
- → plans/features/{feature}/specs/{UC}/README.md
100
- ```
101
-
102
- ### Phase 1.5: Load Quality Attributes
103
-
104
- Load ALL levels from `_quality-attributes.md` for comprehensive verification:
105
-
106
- ```
107
- 1. Architecture Level
108
- → Were architecture decisions followed?
109
- → Any deviations from architecture.md?
110
-
111
- 2. Specification Level
112
- → Does implementation match spec?
113
- → API patterns correct?
114
-
115
- 3. Implementation Level
116
- → Code quality checks
117
- → Security, performance, reliability
118
-
119
- 4. Review Level (meta)
120
- → Can a new developer understand this?
121
- → Would you want to maintain this?
122
- ```
123
-
124
- ### Phase 2: Analyze Changes
125
-
126
- For each changed file:
127
-
128
- ```
129
- 1. Understand the change
130
- - What was added/modified/removed?
131
- - What is the intent?
132
-
133
- 2. Check against spec (if available)
134
- - Does implementation match spec?
135
- - Any missing requirements?
136
-
137
- 3. Check against architecture (if exists)
138
- - Does it follow architecture.md patterns?
139
- - Any undocumented architecture decisions?
140
-
141
- 4. Run through quality attribute checklists
142
- - Scalability
143
- - Maintainability
144
- - Performance
145
- - Security
146
- - Reliability
147
- - Testability
148
- ```
149
-
150
- ### Phase 3: Security Review
151
-
152
- ```markdown
153
- ## Security Checklist
154
-
155
- [ ] **Input Validation**
156
- - User input sanitized?
157
- - SQL/NoSQL injection prevented?
158
- - XSS prevented (HTML escaped)?
159
-
160
- [ ] **Authentication**
161
- - Auth required where needed?
162
- - Token validated correctly?
163
- - Session handled securely?
164
-
165
- [ ] **Authorization**
166
- - Permissions checked?
167
- - Can't access others' data?
168
- - Admin functions protected?
169
-
170
- [ ] **Data Protection**
171
- - Passwords hashed?
172
- - Sensitive data not logged?
173
- - No secrets in code?
174
-
175
- [ ] **API Security**
176
- - Rate limiting present?
177
- - CORS configured?
178
- - No sensitive data in URLs?
179
- ```
180
-
181
- **Common Security Issues:**
182
-
183
- ```typescript
184
- // BAD: SQL injection
185
- const query = `SELECT * FROM users WHERE id = ${userId}`;
186
-
187
- // GOOD: Parameterized
188
- const query = `SELECT * FROM users WHERE id = $1`;
189
- await db.query(query, [userId]);
190
-
191
- // BAD: XSS vulnerable
192
- element.innerHTML = userInput;
193
-
194
- // GOOD: Escaped
195
- element.textContent = userInput;
196
-
197
- // BAD: Hardcoded secret
198
- const apiKey = "sk-1234567890";
199
-
200
- // GOOD: Environment variable
201
- const apiKey = process.env.API_KEY;
202
- ```
203
-
204
- ### Phase 4: Quality Review
205
-
206
- ```markdown
207
- ## Quality Checklist
208
-
209
- [ ] **Error Handling**
210
- - Errors caught and handled?
211
- - User-friendly error messages?
212
- - Errors logged for debugging?
213
- - No swallowed errors?
214
-
215
- [ ] **Performance**
216
- - No N+1 queries?
217
- - Large lists paginated?
218
- - Heavy operations async?
219
- - No memory leaks?
220
-
221
- [ ] **Maintainability**
222
- - Code readable?
223
- - Functions not too long?
224
- - No magic numbers/strings?
225
- - DRY (no unnecessary duplication)?
226
-
227
- [ ] **Testing**
228
- - New code has tests?
229
- - Edge cases covered?
230
- - Tests actually test something?
231
- ```
232
-
233
- **Common Quality Issues:**
234
-
235
- ```typescript
236
- // BAD: N+1 query
237
- const posts = await getPosts();
238
- for (const post of posts) {
239
- post.author = await getUser(post.authorId); // Query per post!
240
- }
241
-
242
- // GOOD: Batch query
243
- const posts = await getPosts({ include: { author: true } });
244
-
245
- // BAD: Swallowed error
246
- try {
247
- await doSomething();
248
- } catch (e) {
249
- // Nothing - error disappears!
250
- }
251
-
252
- // GOOD: Handle or rethrow
253
- try {
254
- await doSomething();
255
- } catch (e) {
256
- logger.error('Failed to do something', e);
257
- throw new AppError('Operation failed', e);
258
- }
259
-
260
- // BAD: Magic number
261
- if (retries > 3) { ... }
262
-
263
- // GOOD: Named constant
264
- const MAX_RETRIES = 3;
265
- if (retries > MAX_RETRIES) { ... }
266
- ```
267
-
268
- ### Phase 5: Convention Review
269
-
270
- ```markdown
271
- ## Convention Checklist (from scout)
272
-
273
- [ ] **Naming**
274
- - Variables: {convention from scout}
275
- - Files: {convention from scout}
276
- - Components: {convention from scout}
277
-
278
- [ ] **Structure**
279
- - File in correct location?
280
- - Follows project patterns?
281
- - Imports organized?
282
-
283
- [ ] **Style**
284
- - Matches .prettierrc / .eslintrc?
285
- - Consistent with codebase?
286
- - No linting errors?
287
-
288
- [ ] **Git**
289
- - Commit message format correct?
290
- - No unrelated changes?
291
- - No debug code / console.log?
292
- ```
293
-
294
- ### Phase 6: Spec Compliance (if UC provided)
295
-
296
- ```markdown
297
- ## Spec Compliance
113
+ ### Spec Compliance
114
+ - Requirements met (all implemented)
115
+ - Requirements not met (missing items)
116
+ - Not in spec (unauthorized additions)
298
117
 
299
- ### Requirements Met
300
- - [x] Login endpoint created
301
- - [x] Returns token on success
302
- - [x] Returns error on invalid credentials
118
+ ### Stack-Specific
119
+ Read stack knowledge files (knowledge/stacks/) for stack-specific review checklists.
303
120
 
304
- ### Requirements Not Met
305
- - [ ] Rate limiting not implemented (spec said 5 attempts/min)
121
+ Examples:
122
+ - Directus: Check for proper collection usage, field types, permissions
123
+ - Nuxt: Check for composables, server routes, nitro patterns
124
+ - Next.js: Check for App Router patterns, server components, actions
306
125
 
307
- ### Not in Spec
308
- - Added "remember me" checkbox (is this approved?)
309
- ```
126
+ ## Context Sources
310
127
 
311
- ### Phase 7: Generate Review
128
+ **Read to understand what was changed:**
129
+ - git diff (uncommitted or staged)
130
+ - Specific files (if provided)
312
131
 
313
- Compile findings into review output format.
132
+ **Read to understand standards:**
133
+ - tech-context.md - Project conventions
134
+ - stack knowledge files - Stack-specific patterns
135
+ - architecture.md - Architecture decisions
136
+ - spec - Requirements (if UC provided)
137
+ - _quality-attributes.md - ALL levels (Architecture, Specification, Implementation, Review)
138
+ - Config files (.eslintrc, tsconfig.json)
314
139
 
315
- **Severity Levels:**
140
+ ## Severity Levels
316
141
 
317
142
  | Level | Icon | Meaning | Action |
318
143
  |-------|------|---------|--------|
@@ -321,7 +146,7 @@ Compile findings into review output format.
321
146
  | Suggestion | 🔵 | Style, improvements | Nice to have |
322
147
  | Positive | ✅ | Good practice noted | Encouragement |
323
148
 
324
- **Review Verdicts:**
149
+ ## Verdicts
325
150
 
326
151
  | Verdict | When |
327
152
  |---------|------|