@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,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/