@neyugn/agent-kits 0.5.1 → 0.5.4

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.
Files changed (75) hide show
  1. package/common/skills/filter-agent/SKILL.md +33 -45
  2. package/common/skills/filter-skill/SKILL.md +51 -73
  3. package/common/skills/scan-techstack/SKILL.md +30 -36
  4. package/kits/coder/agents/ai-engineer.md +27 -39
  5. package/kits/coder/agents/backend-specialist.md +31 -45
  6. package/kits/coder/agents/cloud-architect.md +31 -45
  7. package/kits/coder/agents/code-reviewer.md +45 -67
  8. package/kits/coder/agents/data-engineer.md +22 -32
  9. package/kits/coder/agents/database-specialist.md +30 -44
  10. package/kits/coder/agents/debugger.md +28 -42
  11. package/kits/coder/agents/devops-engineer.md +35 -53
  12. package/kits/coder/agents/documentation-writer.md +48 -68
  13. package/kits/coder/agents/frontend-specialist.md +30 -46
  14. package/kits/coder/agents/i18n-specialist.md +37 -51
  15. package/kits/coder/agents/integration-specialist.md +38 -54
  16. package/kits/coder/agents/mobile-developer.md +37 -53
  17. package/kits/coder/agents/multi-tenant-architect.md +25 -37
  18. package/kits/coder/agents/orchestrator.md +20 -32
  19. package/kits/coder/agents/performance-analyst.md +43 -65
  20. package/kits/coder/agents/project-planner.md +25 -39
  21. package/kits/coder/agents/queue-specialist.md +26 -38
  22. package/kits/coder/agents/realtime-specialist.md +44 -64
  23. package/kits/coder/agents/security-auditor.md +44 -64
  24. package/kits/coder/agents/test-engineer.md +30 -44
  25. package/kits/coder/agents/ux-researcher.md +26 -38
  26. package/kits/coder/rules/AGENTS.md +3 -1
  27. package/kits/coder/rules/CLAUDE.md +3 -1
  28. package/kits/coder/rules/CURSOR.md +8 -1
  29. package/kits/coder/rules/GEMINI.md +6 -1
  30. package/kits/coder/rules/OPENCODE.md +3 -1
  31. package/kits/coder/rules/sections/classifier.md +11 -7
  32. package/kits/coder/rules/sections/code.md +5 -4
  33. package/kits/coder/rules/sections/routing.md +10 -2
  34. package/kits/coder/rules/sections/universal.md +2 -0
  35. package/kits/coder/skills/accessibility-patterns/SKILL.md +67 -81
  36. package/kits/coder/skills/ai-rag-patterns/SKILL.md +27 -23
  37. package/kits/coder/skills/api-patterns/SKILL.md +40 -43
  38. package/kits/coder/skills/auth-patterns/SKILL.md +47 -51
  39. package/kits/coder/skills/aws-patterns/SKILL.md +52 -57
  40. package/kits/coder/skills/brainstorming/SKILL.md +26 -23
  41. package/kits/coder/skills/clean-code/SKILL.md +74 -90
  42. package/kits/coder/skills/database-design/SKILL.md +32 -31
  43. package/kits/coder/skills/docker-patterns/SKILL.md +46 -49
  44. package/kits/coder/skills/documentation-templates/SKILL.md +21 -13
  45. package/kits/coder/skills/e2e-testing/SKILL.md +52 -58
  46. package/kits/coder/skills/flutter-patterns/SKILL.md +44 -46
  47. package/kits/coder/skills/frontend-design/SKILL.md +28 -24
  48. package/kits/coder/skills/github-actions/SKILL.md +43 -45
  49. package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +35 -33
  50. package/kits/coder/skills/graphql-patterns/SKILL.md +35 -33
  51. package/kits/coder/skills/i18n-localization/SKILL.md +37 -35
  52. package/kits/coder/skills/kubernetes-patterns/SKILL.md +35 -33
  53. package/kits/coder/skills/mermaid-diagrams/SKILL.md +54 -60
  54. package/kits/coder/skills/mobile-design/SKILL.md +51 -61
  55. package/kits/coder/skills/monitoring-observability/SKILL.md +32 -30
  56. package/kits/coder/skills/multi-tenancy/SKILL.md +16 -8
  57. package/kits/coder/skills/nodejs-best-practices/SKILL.md +19 -14
  58. package/kits/coder/skills/performance-profiling/SKILL.md +31 -29
  59. package/kits/coder/skills/plan-writing/SKILL.md +52 -59
  60. package/kits/coder/skills/postgres-patterns/SKILL.md +39 -39
  61. package/kits/coder/skills/prompt-engineering/SKILL.md +40 -42
  62. package/kits/coder/skills/queue-patterns/SKILL.md +22 -16
  63. package/kits/coder/skills/react-native-patterns/SKILL.md +35 -33
  64. package/kits/coder/skills/react-patterns/SKILL.md +46 -52
  65. package/kits/coder/skills/realtime-patterns/SKILL.md +44 -46
  66. package/kits/coder/skills/redis-patterns/SKILL.md +35 -33
  67. package/kits/coder/skills/security-fundamentals/SKILL.md +45 -46
  68. package/kits/coder/skills/seo-patterns/SKILL.md +56 -62
  69. package/kits/coder/skills/systematic-debugging/SKILL.md +38 -39
  70. package/kits/coder/skills/tailwind-patterns/SKILL.md +21 -13
  71. package/kits/coder/skills/terraform-patterns/SKILL.md +53 -57
  72. package/kits/coder/skills/testing-patterns/SKILL.md +42 -47
  73. package/kits/coder/skills/typescript-patterns/SKILL.md +54 -68
  74. package/kits/coder/skills/ui-ux-pro-max/SKILL.md +362 -364
  75. package/package.json +1 -1
@@ -6,17 +6,25 @@ allowed-tools: Read, Write, Edit, Glob, Grep
6
6
 
7
7
  # React Patterns
8
8
 
9
- > **Philosophy:** Measure first, optimize second. React is about composition - build small, combine thoughtfully.
9
+ ## Quick Reference
10
+
11
+ - **State**: Local → useState · Shared → Context/Zustand · Server → React Query · avoid Redux for new projects
12
+ - **Performance**: `memo` for expensive renders · `useMemo` for costly computations · `useCallback` for stable refs
13
+ - **Hooks rules**: Top-level only · No conditionals · Custom hooks extract logic not UI
14
+ - **Keys**: Stable unique IDs not array index · Missing keys = bugs in list reorder
15
+ - **Async**: React Query for server state · `useEffect` with cleanup for subscriptions · no fire-and-forget
16
+ - **Avoid**: Prop drilling > 2 levels (use context) · useEffect for derived state (useMemo) · `any` in TypeScript
17
+
18
+ ---
19
+
10
20
 
11
21
  ---
12
22
 
13
23
  ## 📑 Content Map
14
24
 
15
- | File | When to Read |
16
- | ------------------------------- | ----------------------------- |
17
- | `references/hook-patterns.md` | Advanced custom hooks |
18
- | `references/performance.md` | Deep performance optimization |
19
- | `references/nextjs-patterns.md` | Next.js App Router specific |
25
+ - `references/hook-patterns.md`: Advanced custom hooks
26
+ - `references/performance.md`: Deep performance optimization
27
+ - `references/nextjs-patterns.md`: Next.js App Router specific
20
28
 
21
29
  ---
22
30
 
@@ -33,12 +41,10 @@ allowed-tools: Read, Write, Edit, Glob, Grep
33
41
 
34
42
  ### Design Rules
35
43
 
36
- | Rule | Rationale |
37
- | ---------------------------- | -------------------------------- |
38
- | One responsibility | Easier testing, reuse |
39
- | Props down, events up | Predictable data flow |
40
- | Composition over inheritance | Flexibility, avoid prop drilling |
41
- | Small, focused components | Better tree shaking, readability |
44
+ - One responsibility: Easier testing, reuse
45
+ - Props down, events up: Predictable data flow
46
+ - Composition over inheritance: Flexibility, avoid prop drilling
47
+ - Small, focused components: Better tree shaking, readability
42
48
 
43
49
  ---
44
50
 
@@ -46,23 +52,19 @@ allowed-tools: Read, Write, Edit, Glob, Grep
46
52
 
47
53
  ### When to Extract Custom Hooks
48
54
 
49
- | Pattern | Extract When |
50
- | ----------------- | -------------------------------------- |
51
- | `useLocalStorage` | Same storage logic needed |
52
- | `useDebounce` | Multiple debounced values |
53
- | `useFetch` | Repeated fetch patterns |
54
- | `useForm` | Complex form state |
55
- | `useClickOutside` | Multiple modal/dropdown components |
56
- | `usePrevious` | Need previous value in multiple places |
55
+ - `useLocalStorage`: Same storage logic needed
56
+ - `useDebounce`: Multiple debounced values
57
+ - `useFetch`: Repeated fetch patterns
58
+ - `useForm`: Complex form state
59
+ - `useClickOutside`: Multiple modal/dropdown components
60
+ - `usePrevious`: Need previous value in multiple places
57
61
 
58
62
  ### Hook Rules (CRITICAL)
59
63
 
60
- | Rule | Violation Consequence |
61
- | ----------------------- | -------------------------------- |
62
- | Top level only | Inconsistent state |
63
- | Same order every render | React loses track of state |
64
- | Prefix with "use" | Lint error, convention violation |
65
- | Clean up effects | Memory leaks, stale closures |
64
+ - Top level only: Inconsistent state
65
+ - Same order every render: React loses track of state
66
+ - Prefix with "use": Lint error, convention violation
67
+ - Clean up effects: Memory leaks, stale closures
66
68
 
67
69
  ### React 19 New Hooks
68
70
 
@@ -182,12 +184,10 @@ State scope?
182
184
 
183
185
  ### Recovery Pattern
184
186
 
185
- | Step | Action |
186
- | ---- | ------------------------------ |
187
- | 1 | Show fallback UI |
188
- | 2 | Log error (Sentry, DataDog) |
189
- | 3 | Offer retry option |
190
- | 4 | Preserve user data if possible |
187
+ - 1: Show fallback UI
188
+ - 2: Log error (Sentry, DataDog)
189
+ - 3: Offer retry option
190
+ - 4: Preserve user data if possible
191
191
 
192
192
  ---
193
193
 
@@ -203,12 +203,10 @@ State scope?
203
203
 
204
204
  ### Essential Types
205
205
 
206
- | Need | Type |
207
- | ------------- | ------------------------ |
208
- | Children | `ReactNode` |
209
- | Event handler | `MouseEventHandler<T>` |
210
- | Ref | `RefObject<Element>` |
211
- | Component ref | `ComponentRef<typeof X>` |
206
+ - Children: `ReactNode`
207
+ - Event handler: `MouseEventHandler<T>`
208
+ - Ref: `RefObject<Element>`
209
+ - Component ref: `ComponentRef<typeof X>`
212
210
 
213
211
  ---
214
212
 
@@ -261,13 +259,11 @@ Does component need...?
261
259
 
262
260
  ### File Conventions
263
261
 
264
- | File | Purpose |
265
- | --------------- | ---------------- |
266
- | `page.tsx` | Route UI |
267
- | `layout.tsx` | Shared layout |
268
- | `loading.tsx` | Loading skeleton |
269
- | `error.tsx` | Error boundary |
270
- | `not-found.tsx` | 404 page |
262
+ - `page.tsx`: Route UI
263
+ - `layout.tsx`: Shared layout
264
+ - `loading.tsx`: Loading skeleton
265
+ - `error.tsx`: Error boundary
266
+ - `not-found.tsx`: 404 page
271
267
 
272
268
  ### Caching Strategy
273
269
 
@@ -306,13 +302,11 @@ Simple local? → useState
306
302
 
307
303
  ## Related Skills
308
304
 
309
- | Need | Skill |
310
- | --------------------- | ----------------------- |
311
- | Styling | `tailwind-patterns` |
312
- | Testing | `testing-patterns` |
313
- | API integration | `api-patterns` |
314
- | TypeScript advanced | `typescript-patterns` |
315
- | Performance deep-dive | `performance-profiling` |
305
+ - Styling: `tailwind-patterns`
306
+ - Testing: `testing-patterns`
307
+ - API integration: `api-patterns`
308
+ - TypeScript advanced: `typescript-patterns`
309
+ - Performance deep-dive: `performance-profiling`
316
310
 
317
311
  ---
318
312
 
@@ -6,7 +6,17 @@ allowed-tools: Read, Write, Edit, Bash
6
6
 
7
7
  # Realtime Patterns - Event-Driven Communication Architecture
8
8
 
9
- > **Philosophy:** Real-time isn't just fast—it's instantaneous perceived response. Design for resilience, not just speed.
9
+ ## Quick Reference
10
+
11
+ - **Protocol selection**: Chat/games → WebSocket · News/notifications → SSE · Simple push → Long-polling
12
+ - **Reconnection**: Exponential backoff (1s → 2s → 4s max 30s) · Client-side always handles reconnect
13
+ - **Rooms/channels**: `socket.join(roomId)` · `io.to(room).emit()` · Clean up on disconnect
14
+ - **Auth**: JWT in handshake query/header (not cookie for WS) · Validate on every connection
15
+ - **Scaling**: Redis adapter for Socket.IO multi-instance · Sticky sessions OR pub/sub architecture
16
+ - **State sync**: Send missed events on reconnect · Event sequence numbers · Client-side reconciliation
17
+
18
+ ---
19
+
10
20
 
11
21
  ---
12
22
 
@@ -84,12 +94,10 @@ interface ConnectionState {
84
94
 
85
95
  ### Keep-Alive (Heartbeat)
86
96
 
87
- | Aspect | Recommendation |
88
- | ---------------- | ----------------------------------------- |
89
- | **Interval** | 25-30 seconds (under typical 60s timeout) |
90
- | **Pong Timeout** | 5-10 seconds after ping sent |
91
- | **On Timeout** | Trigger reconnection |
92
- | **Payload** | Minimal (empty or timestamp only) |
97
+ - **Interval**: 25-30 seconds (under typical 60s timeout)
98
+ - **Pong Timeout**: 5-10 seconds after ping sent
99
+ - **On Timeout**: Trigger reconnection
100
+ - **Payload**: Minimal (empty or timestamp only)
93
101
 
94
102
  ```typescript
95
103
  // Heartbeat pattern
@@ -313,13 +321,11 @@ io.adapter(createAdapter(pubClient, subClient));
313
321
 
314
322
  ### Scaling Considerations
315
323
 
316
- | Challenge | Solution |
317
- | --------------------- | ----------------------------------------- |
318
- | **Sticky Sessions** | Use consistent hashing or client IP-based |
319
- | **Cross-Server Emit** | Redis Pub/Sub adapter |
320
- | **Connection State** | Store in Redis, not in-memory |
321
- | **N-Squared Problem** | Sharded Redis adapter (Redis 7.0+) |
322
- | **Message Order** | Use sequence numbers or timestamps |
324
+ - **Sticky Sessions**: Use consistent hashing or client IP-based
325
+ - **Cross-Server Emit**: Redis Pub/Sub adapter
326
+ - **Connection State**: Store in Redis, not in-memory
327
+ - **N-Squared Problem**: Sharded Redis adapter (Redis 7.0+)
328
+ - **Message Order**: Use sequence numbers or timestamps
323
329
 
324
330
  ---
325
331
 
@@ -350,14 +356,12 @@ io.use(async (socket, next) => {
350
356
 
351
357
  ### Security Checklist
352
358
 
353
- | Concern | Mitigation |
354
- | ---------------------- | --------------------------------------- |
355
- | **Authentication** | Validate token before accepting socket |
356
- | **Authorization** | Check permissions before joining rooms |
357
- | **Rate Limiting** | Limit events per second per client |
358
- | **Payload Validation** | Validate and sanitize all incoming data |
359
- | **Message Size** | Limit max payload size |
360
- | **Origin Check** | Configure CORS properly |
359
+ - **Authentication**: Validate token before accepting socket
360
+ - **Authorization**: Check permissions before joining rooms
361
+ - **Rate Limiting**: Limit events per second per client
362
+ - **Payload Validation**: Validate and sanitize all incoming data
363
+ - **Message Size**: Limit max payload size
364
+ - **Origin Check**: Configure CORS properly
361
365
 
362
366
  ---
363
367
 
@@ -399,14 +403,12 @@ socket.on("error", (error) => {
399
403
 
400
404
  ### Key Metrics
401
405
 
402
- | Metric | What It Tells You |
403
- | ---------------------- | ----------------------------- |
404
- | **Active Connections** | Current load, scaling needs |
405
- | **Connection Rate** | Traffic patterns, spikes |
406
- | **Reconnection Rate** | Connection stability issues |
407
- | **Message Latency** | System responsiveness |
408
- | **Messages/Second** | Throughput, capacity planning |
409
- | **Error Rate** | System health |
406
+ - **Active Connections**: Current load, scaling needs
407
+ - **Connection Rate**: Traffic patterns, spikes
408
+ - **Reconnection Rate**: Connection stability issues
409
+ - **Message Latency**: System responsiveness
410
+ - **Messages/Second**: Throughput, capacity planning
411
+ - **Error Rate**: System health
410
412
 
411
413
  ### Debugging Tips
412
414
 
@@ -433,16 +435,14 @@ socket.io.on("reconnect_error", (error) => {
433
435
 
434
436
  ## 🚨 Anti-Patterns
435
437
 
436
- | Don't | Do |
437
- | ----------------------------------- | ----------------------------------- |
438
- | Send large objects over socket | Send IDs, fetch data via HTTP |
439
- | Block in event handlers | Process async, return quickly |
440
- | Trust client-sent room names | Validate and authorize room access |
441
- | Reconnect immediately on failure | Use exponential backoff with jitter |
442
- | Store state in single server memory | Use Redis for cross-server state |
443
- | Ignore connection state | Track and display to user |
444
- | Send sensitive data in events | Encrypt or use HTTPS/WSS only |
445
- | Process without validation | Validate all incoming payloads |
438
+ - Send large objects over socket: Send IDs, fetch data via HTTP
439
+ - Block in event handlers: Process async, return quickly
440
+ - Trust client-sent room names: Validate and authorize room access
441
+ - Reconnect immediately on failure: Use exponential backoff with jitter
442
+ - Store state in single server memory: Use Redis for cross-server state
443
+ - Ignore connection state: Track and display to user
444
+ - Send sensitive data in events: Encrypt or use HTTPS/WSS only
445
+ - Process without validation: Validate all incoming payloads
446
446
 
447
447
  ---
448
448
 
@@ -494,12 +494,10 @@ socket.io.on("reconnect_error", (error) => {
494
494
 
495
495
  ## 🔗 Related Skills
496
496
 
497
- | Need | Skill |
498
- | ------------------------- | ----------------------- |
499
- | API design for HTTP calls | `api-patterns` |
500
- | Performance optimization | `performance-profiling` |
501
- | Queue/worker patterns | `queue-patterns` |
502
- | Database for state | `database-design` |
497
+ - API design for HTTP calls: `api-patterns`
498
+ - Performance optimization: `performance-profiling`
499
+ - Queue/worker patterns: `queue-patterns`
500
+ - Database for state: `database-design`
503
501
 
504
502
  ---
505
503
 
@@ -7,21 +7,29 @@ version: 2.0
7
7
 
8
8
  # Redis Patterns - Caching & Real-Time
9
9
 
10
- > **Philosophy:** Redis is not just a cache—it's a data structure server. Use the right structure for the right problem.
10
+ ## Quick Reference
11
+
12
+ - **Structures**: String (simple cache) · Hash (objects) · List (queues/history) · Set (unique items) · Sorted Set (leaderboards/priority)
13
+ - **Expiry**: Always set TTL · `SET key val EX 3600` · no orphaned keys
14
+ - **Key naming**: `tenant:{id}:user:{id}` prefix convention · colon separator · descriptive
15
+ - **Caching**: Cache-aside pattern · Invalidate on write · Short TTL for volatile data
16
+ - **Concurrency**: `INCR` for atomic counters · Lua scripts for multi-key atomicity · `SETNX` for locks
17
+ - **Persistence**: AOF for production · RDB for dev only · `maxmemory-policy allkeys-lru` for cache use
18
+
19
+ ---
20
+
11
21
 
12
22
  ---
13
23
 
14
24
  ## When to Use This Skill
15
25
 
16
- | Use | Don't Use |
17
- | ---------------------- | ---------------------------- |
18
- | Caching strategies | Primary database design |
19
- | Session management | Complex querying |
20
- | Rate limiting | Relational data |
21
- | Pub/Sub messaging | Durable storage requirements |
22
- | Distributed locking | ACID transactions |
23
- | Real-time leaderboards | Large document storage |
24
- | Queue/Job patterns | Complex aggregations |
26
+ - Caching strategies: Primary database design
27
+ - Session management: Complex querying
28
+ - Rate limiting: Relational data
29
+ - Pub/Sub messaging: Durable storage requirements
30
+ - Distributed locking: ACID transactions
31
+ - Real-time leaderboards: Large document storage
32
+ - Queue/Job patterns: Complex aggregations
25
33
 
26
34
  ---
27
35
 
@@ -391,13 +399,11 @@ await redis.expire("leaderboard:weekly", 604800); // 7 days
391
399
 
392
400
  ### Eviction Policies
393
401
 
394
- | Policy | Use Case |
395
- | ---------------- | ----------------------------- |
396
- | `noeviction` | Fail writes when memory full |
397
- | `allkeys-lru` | General caching (recommended) |
398
- | `volatile-lru` | Only evict keys with TTL |
399
- | `allkeys-lfu` | Frequency-based eviction |
400
- | `allkeys-random` | Random eviction |
402
+ - `noeviction`: Fail writes when memory full
403
+ - `allkeys-lru`: General caching (recommended)
404
+ - `volatile-lru`: Only evict keys with TTL
405
+ - `allkeys-lfu`: Frequency-based eviction
406
+ - `allkeys-random`: Random eviction
401
407
 
402
408
  ### Memory Optimization
403
409
 
@@ -442,16 +448,14 @@ Examples:
442
448
 
443
449
  ## Anti-Patterns
444
450
 
445
- | Don't | Do |
446
- | ------------------------------- | ------------------------------------- |
447
- | Store without TTL | Always set expiration |
448
- | Use KEYS in production | Use SCAN for iteration |
449
- | Large values (>1MB) | Split or use different storage |
450
- | Create connection per request | Use connection pooling |
451
- | Use as primary database | Use as cache/session/queue layer |
452
- | Block with BLPOP in main thread | Dedicated subscriber connections |
453
- | Store complex relational data | Use proper database for relations |
454
- | Ignore memory limits | Configure maxmemory + eviction policy |
451
+ - Store without TTL: Always set expiration
452
+ - Use KEYS in production: Use SCAN for iteration
453
+ - Large values (>1MB): Split or use different storage
454
+ - Create connection per request: Use connection pooling
455
+ - Use as primary database: Use as cache/session/queue layer
456
+ - Block with BLPOP in main thread: Dedicated subscriber connections
457
+ - Store complex relational data: Use proper database for relations
458
+ - Ignore memory limits: Configure maxmemory + eviction policy
455
459
 
456
460
  ---
457
461
 
@@ -472,12 +476,10 @@ Before deployment:
472
476
 
473
477
  ## Related Skills
474
478
 
475
- | Need | Skill |
476
- | --------------------- | ----------------------- |
477
- | Message queues | `queue-patterns` |
478
- | Database caching | `database-design` |
479
- | Real-time patterns | `realtime-patterns` |
480
- | Performance profiling | `performance-profiling` |
479
+ - Message queues: `queue-patterns`
480
+ - Database caching: `database-design`
481
+ - Real-time patterns: `realtime-patterns`
482
+ - Performance profiling: `performance-profiling`
481
483
 
482
484
  ---
483
485
 
@@ -6,7 +6,16 @@ allowed-tools: Read, Edit, Glob, Grep
6
6
 
7
7
  # Security Fundamentals - Thinking Like an Attacker
8
8
 
9
- > **Philosophy:** Security is a mindset, not a checklist. Every line of code should assume input is hostile.
9
+ ## Quick Reference
10
+
11
+ - **Zero Trust**: Validate all inputs · No trust by location · Fail secure (deny on error)
12
+ - **OWASP Top 10**: Access Control · Security Misconfig · Supply Chain · Crypto Failures · Injection · Auth Failures
13
+ - **Input**: Validate type+length+format · Parameterized queries (no string concat) · Sanitize HTML output
14
+ - **Auth**: bcrypt/Argon2 for passwords · JWT 15min expiry · httpOnly cookies for refresh · Rate limit login
15
+ - **Secrets**: Never in code/logs · `.env` for local · Vault/SecretsManager for prod · Rotate regularly
16
+ - **HTTPS**: TLS 1.2+ only · HSTS header · CSP header · No mixed content
17
+
18
+ ---
10
19
 
11
20
  ---
12
21
 
@@ -150,18 +159,16 @@ function createUser(input: unknown) {
150
159
 
151
160
  ### Common Validation Rules
152
161
 
153
- | Field Type | Validation Rules |
154
- | ---------- | ------------------------------------------ |
155
- | Username | ^[a-zA-Z0-9_]{3,20}$ |
156
- | Email | RFC 5322 regex + domain check |
157
- | Password | Min 12 chars, complexity rules |
158
- | Phone | Digits only, length 10-15 |
159
- | UUID | ^[0-9a-f]{8}-... pattern |
160
- | URL | Scheme allowlist (https), domain allowlist |
161
- | File | Extension allowlist, magic bytes, max size |
162
- | Date | ISO 8601, reasonable range |
163
- | Number | Min/max bounds, integer vs float |
164
- | Free text | Max length, no control chars |
162
+ - Username: ^[a-zA-Z0-9_]{3,20}$
163
+ - Email: RFC 5322 regex + domain check
164
+ - Password: Min 12 chars, complexity rules
165
+ - Phone: Digits only, length 10-15
166
+ - UUID: ^[0-9a-f]{8}-... pattern
167
+ - URL: Scheme allowlist (https), domain allowlist
168
+ - File: Extension allowlist, magic bytes, max size
169
+ - Date: ISO 8601, reasonable range
170
+ - Number: Min/max bounds, integer vs float
171
+ - Free text: Max length, no control chars
165
172
 
166
173
  ---
167
174
 
@@ -199,14 +206,12 @@ const cleanHTML = DOMPurify.sanitize(dirtyHTML, {
199
206
 
200
207
  ### Output Encoding
201
208
 
202
- | Context | Encoding |
203
- | ----------------- | --------------------------------- |
204
- | HTML body | HTML entity encode (`<` → `&lt;`) |
205
- | HTML attribute | Attribute encode + quote |
206
- | JavaScript string | JS escape + avoid eval |
207
- | CSS value | CSS escape, avoid `url()` |
208
- | URL parameter | URL encode (`%20`) |
209
- | JSON | JSON.stringify (auto-escapes) |
209
+ - HTML body: HTML entity encode (`<` → `&lt;`)
210
+ - HTML attribute: Attribute encode + quote
211
+ - JavaScript string: JS escape + avoid eval
212
+ - CSS value: CSS escape, avoid `url()`
213
+ - URL parameter: URL encode (`%20`)
214
+ - JSON: JSON.stringify (auto-escapes)
210
215
 
211
216
  ---
212
217
 
@@ -223,13 +228,11 @@ Cost factor: ~100ms per hash (adjust for hardware)
223
228
 
224
229
  ### Session Security
225
230
 
226
- | Aspect | Requirement |
227
- | ------------ | ----------------------------------- |
228
- | Session ID | Cryptographically random, 128+ bits |
229
- | Storage | HttpOnly cookie (not localStorage) |
230
- | Transmission | Secure flag (HTTPS only) |
231
- | Expiration | Reasonable timeout, absolute + idle |
232
- | Rotation | New ID after privilege change |
231
+ - Session ID: Cryptographically random, 128+ bits
232
+ - Storage: HttpOnly cookie (not localStorage)
233
+ - Transmission: Secure flag (HTTPS only)
234
+ - Expiration: Reasonable timeout, absolute + idle
235
+ - Rotation: New ID after privilege change
233
236
 
234
237
  ### JWT Security
235
238
 
@@ -292,18 +295,16 @@ const securityHeaders = {
292
295
 
293
296
  ## 🚨 Anti-Patterns
294
297
 
295
- | Don't | Do |
296
- | --------------------------------------- | ---------------------------------- |
297
- | Store passwords in plain text | Use bcrypt/Argon2 with proper cost |
298
- | Concatenate SQL strings | Use parameterized queries |
299
- | Disable SSL verification | Fix certificate issues properly |
300
- | Log sensitive data | Mask/redact before logging |
301
- | Use `eval()` with user input | Find alternative approach |
302
- | Trust client-side validation | Always validate server-side |
303
- | Commit secrets to repo | Use environment variables |
304
- | Use `*` for CORS origin | Explicit domain allowlist |
305
- | Disable security features "temporarily" | Never—find proper solution |
306
- | Roll your own crypto | Use established libraries |
298
+ - Store passwords in plain text: Use bcrypt/Argon2 with proper cost
299
+ - Concatenate SQL strings: Use parameterized queries
300
+ - Disable SSL verification: Fix certificate issues properly
301
+ - Log sensitive data: Mask/redact before logging
302
+ - Use `eval()` with user input: Find alternative approach
303
+ - Trust client-side validation: Always validate server-side
304
+ - Commit secrets to repo: Use environment variables
305
+ - Use `*` for CORS origin: Explicit domain allowlist
306
+ - Disable security features "temporarily": Never—find proper solution
307
+ - Roll your own crypto: Use established libraries
307
308
 
308
309
  ---
309
310
 
@@ -343,12 +344,10 @@ const securityHeaders = {
343
344
 
344
345
  ## 🔗 Related Skills
345
346
 
346
- | Need | Skill |
347
- | --------------------- | ------------------ |
348
- | API design patterns | `api-patterns` |
349
- | Database security | `database-design` |
350
- | Testing for security | `testing-patterns` |
351
- | Clean code principles | `clean-code` |
347
+ - API design patterns: `api-patterns`
348
+ - Database security: `database-design`
349
+ - Testing for security: `testing-patterns`
350
+ - Clean code principles: `clean-code`
352
351
 
353
352
  ---
354
353