@neyugn/agent-kits 0.5.0 → 0.5.3

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 (72) hide show
  1. package/README.md +66 -81
  2. package/README.vi.md +79 -52
  3. package/README.zh.md +69 -88
  4. package/common/skills/filter-agent/SKILL.md +33 -45
  5. package/common/skills/filter-skill/SKILL.md +51 -73
  6. package/common/skills/scan-techstack/SKILL.md +30 -36
  7. package/dist/cli.js +85 -0
  8. package/kits/coder/agents/ai-engineer.md +27 -39
  9. package/kits/coder/agents/backend-specialist.md +31 -45
  10. package/kits/coder/agents/cloud-architect.md +31 -45
  11. package/kits/coder/agents/code-reviewer.md +45 -67
  12. package/kits/coder/agents/data-engineer.md +22 -32
  13. package/kits/coder/agents/database-specialist.md +30 -44
  14. package/kits/coder/agents/debugger.md +28 -42
  15. package/kits/coder/agents/devops-engineer.md +35 -53
  16. package/kits/coder/agents/documentation-writer.md +48 -68
  17. package/kits/coder/agents/frontend-specialist.md +30 -46
  18. package/kits/coder/agents/i18n-specialist.md +37 -51
  19. package/kits/coder/agents/integration-specialist.md +38 -54
  20. package/kits/coder/agents/mobile-developer.md +37 -53
  21. package/kits/coder/agents/multi-tenant-architect.md +25 -37
  22. package/kits/coder/agents/orchestrator.md +20 -32
  23. package/kits/coder/agents/performance-analyst.md +43 -65
  24. package/kits/coder/agents/project-planner.md +25 -39
  25. package/kits/coder/agents/queue-specialist.md +26 -38
  26. package/kits/coder/agents/realtime-specialist.md +44 -64
  27. package/kits/coder/agents/security-auditor.md +44 -64
  28. package/kits/coder/agents/test-engineer.md +30 -44
  29. package/kits/coder/agents/ux-researcher.md +26 -38
  30. package/kits/coder/rules/sections/classifier.md +11 -7
  31. package/kits/coder/rules/sections/code.md +5 -4
  32. package/kits/coder/skills/accessibility-patterns/SKILL.md +67 -81
  33. package/kits/coder/skills/ai-rag-patterns/SKILL.md +27 -23
  34. package/kits/coder/skills/api-patterns/SKILL.md +40 -43
  35. package/kits/coder/skills/auth-patterns/SKILL.md +47 -51
  36. package/kits/coder/skills/aws-patterns/SKILL.md +52 -57
  37. package/kits/coder/skills/brainstorming/SKILL.md +26 -23
  38. package/kits/coder/skills/clean-code/SKILL.md +74 -90
  39. package/kits/coder/skills/database-design/SKILL.md +32 -31
  40. package/kits/coder/skills/docker-patterns/SKILL.md +46 -49
  41. package/kits/coder/skills/documentation-templates/SKILL.md +21 -13
  42. package/kits/coder/skills/e2e-testing/SKILL.md +52 -58
  43. package/kits/coder/skills/flutter-patterns/SKILL.md +44 -46
  44. package/kits/coder/skills/frontend-design/SKILL.md +28 -24
  45. package/kits/coder/skills/github-actions/SKILL.md +43 -45
  46. package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +35 -33
  47. package/kits/coder/skills/graphql-patterns/SKILL.md +35 -33
  48. package/kits/coder/skills/i18n-localization/SKILL.md +37 -35
  49. package/kits/coder/skills/kubernetes-patterns/SKILL.md +35 -33
  50. package/kits/coder/skills/mermaid-diagrams/SKILL.md +54 -60
  51. package/kits/coder/skills/mobile-design/SKILL.md +51 -61
  52. package/kits/coder/skills/monitoring-observability/SKILL.md +32 -30
  53. package/kits/coder/skills/multi-tenancy/SKILL.md +16 -8
  54. package/kits/coder/skills/nodejs-best-practices/SKILL.md +19 -14
  55. package/kits/coder/skills/performance-profiling/SKILL.md +31 -29
  56. package/kits/coder/skills/plan-writing/SKILL.md +52 -59
  57. package/kits/coder/skills/postgres-patterns/SKILL.md +39 -39
  58. package/kits/coder/skills/prompt-engineering/SKILL.md +40 -42
  59. package/kits/coder/skills/queue-patterns/SKILL.md +22 -16
  60. package/kits/coder/skills/react-native-patterns/SKILL.md +35 -33
  61. package/kits/coder/skills/react-patterns/SKILL.md +46 -52
  62. package/kits/coder/skills/realtime-patterns/SKILL.md +44 -46
  63. package/kits/coder/skills/redis-patterns/SKILL.md +35 -33
  64. package/kits/coder/skills/security-fundamentals/SKILL.md +45 -46
  65. package/kits/coder/skills/seo-patterns/SKILL.md +56 -62
  66. package/kits/coder/skills/systematic-debugging/SKILL.md +38 -39
  67. package/kits/coder/skills/tailwind-patterns/SKILL.md +21 -13
  68. package/kits/coder/skills/terraform-patterns/SKILL.md +53 -57
  69. package/kits/coder/skills/testing-patterns/SKILL.md +42 -47
  70. package/kits/coder/skills/typescript-patterns/SKILL.md +54 -68
  71. package/kits/coder/skills/ui-ux-pro-max/SKILL.md +362 -364
  72. package/package.json +1 -1
@@ -8,19 +8,27 @@ priority: MEDIUM
8
8
 
9
9
  # Accessibility Patterns - Inclusive Design Excellence
10
10
 
11
- > **Philosophy:** Accessibility is not a feature, it's a fundamental requirement. Design for everyone from the start.
11
+ ## Quick Reference
12
+
13
+ - **Semantic HTML**: `<button>` not `<div onClick>` · `<nav>` `<main>` `<aside>` · `<h1>` → `<h6>` hierarchy
14
+ - **ARIA**: Use only when semantic HTML insufficient · `aria-label` for icon buttons · `aria-live` for dynamic content
15
+ - **Keyboard**: All actions reachable via keyboard · Tab order logical · Focus visible always · `Escape` closes modals
16
+ - **Color**: 4.5:1 contrast ratio (normal text) · 3:1 (large text) · Never color as only indicator
17
+ - **Images**: `alt` always · Empty `alt=""` for decorative · Describe the function not appearance
18
+ - **Forms**: Label every input (`for`/`htmlFor`) · Error messages linked with `aria-describedby` · Required marked
19
+
20
+ ---
21
+
12
22
 
13
23
  ---
14
24
 
15
25
  ## 🎯 Core Principles
16
26
 
17
- | Principle | Rule |
18
- | ------------------- | --------------------------------------------- |
19
- | **Perceivable** | Information must be presentable to all senses |
20
- | **Operable** | UI must be operable by all users |
21
- | **Understandable** | Information and UI must be understandable |
22
- | **Robust** | Content must work with assistive technologies |
23
- | **Inclusive First** | Build accessibility in, don't bolt it on |
27
+ - **Perceivable**: Information must be presentable to all senses
28
+ - **Operable**: UI must be operable by all users
29
+ - **Understandable**: Information and UI must be understandable
30
+ - **Robust**: Content must work with assistive technologies
31
+ - **Inclusive First**: Build accessibility in, don't bolt it on
24
32
 
25
33
  ```
26
34
  ❌ WRONG: Build first, add accessibility later
@@ -84,13 +92,11 @@ priority: MEDIUM
84
92
 
85
93
  ### Focus Management
86
94
 
87
- | Rule | Implementation |
88
- | --------------------------- | --------------------------------- |
89
- | All interactive elements | Must be focusable via Tab |
90
- | Logical focus order | Match visual reading order |
91
- | Visible focus indicators | Never `outline: none` without alt |
92
- | Focus trapping in modals | Tab loops within modal |
93
- | Return focus on modal close | Focus returns to trigger element |
95
+ - All interactive elements: Must be focusable via Tab
96
+ - Logical focus order: Match visual reading order
97
+ - Visible focus indicators: Never `outline: none` without alt
98
+ - Focus trapping in modals: Tab loops within modal
99
+ - Return focus on modal close: Focus returns to trigger element
94
100
 
95
101
  ### Focus Indicator Pattern
96
102
 
@@ -137,14 +143,12 @@ button:focus:not(:focus-visible) {
137
143
 
138
144
  ### Semantic HTML
139
145
 
140
- | Use | Not |
141
- | ------------------- | ----------------------- |
142
- | `<button>` | `<div onclick>` |
143
- | `<a href>` | `<span onclick>` |
144
- | `<nav>` | `<div class="nav">` |
145
- | `<main>` | `<div class="main">` |
146
- | `<header>/<footer>` | `<div class="header">` |
147
- | `<article>` | `<div class="article">` |
146
+ - `<button>`: `<div onclick>`
147
+ - `<a href>`: `<span onclick>`
148
+ - `<nav>`: `<div class="nav">`
149
+ - `<main>`: `<div class="main">`
150
+ - `<header>/<footer>`: `<div class="header">`
151
+ - `<article>`: `<div class="article">`
148
152
 
149
153
  ### ARIA Usage Guidelines
150
154
 
@@ -172,11 +176,9 @@ button:focus:not(:focus-visible) {
172
176
  <div role="alert" aria-live="assertive">Error: Unable to save changes</div>
173
177
  ```
174
178
 
175
- | aria-live Value | Use Case |
176
- | --------------- | ----------------------------------- |
177
- | `polite` | Non-urgent updates (search results) |
178
- | `assertive` | Urgent (errors, alerts) |
179
- | `off` | Don't announce |
179
+ - `polite`: Non-urgent updates (search results)
180
+ - `assertive`: Urgent (errors, alerts)
181
+ - `off`: Don't announce
180
182
 
181
183
  ---
182
184
 
@@ -216,11 +218,9 @@ button:focus:not(:focus-visible) {
216
218
 
217
219
  ### Form Validation Pattern
218
220
 
219
- | When | What |
220
- | --------- | --------------------------------------- |
221
- | On submit | Announce error count, focus first error |
222
- | On blur | Validate individual field |
223
- | On fix | Clear error, don't re-announce success |
221
+ - On submit: Announce error count, focus first error
222
+ - On blur: Validate individual field
223
+ - On fix: Clear error, don't re-announce success
224
224
 
225
225
  ---
226
226
 
@@ -228,12 +228,10 @@ button:focus:not(:focus-visible) {
228
228
 
229
229
  ### Alt Text Guidelines
230
230
 
231
- | Image Type | Alt Text |
232
- | ----------------- | ------------------------------ |
233
- | Informative | Describe content and purpose |
234
- | Decorative | `alt=""` (empty) |
235
- | Functional (link) | Describe destination/action |
236
- | Complex (chart) | Brief alt + longer description |
231
+ - Informative: Describe content and purpose
232
+ - Decorative: `alt=""` (empty)
233
+ - Functional (link): Describe destination/action
234
+ - Complex (chart): Brief alt + longer description
237
235
 
238
236
  ```html
239
237
  <!-- Informative -->
@@ -251,12 +249,10 @@ button:focus:not(:focus-visible) {
251
249
 
252
250
  ### Video Accessibility
253
251
 
254
- | Requirement | Solution |
255
- | --------------- | ---------------------------- |
256
- | Deaf users | Captions (synchronized text) |
257
- | Blind users | Audio descriptions |
258
- | Deafblind users | Transcript |
259
- | Seizure safety | No flashing >3 times/second |
252
+ - Deaf users: Captions (synchronized text)
253
+ - Blind users: Audio descriptions
254
+ - Deafblind users: Transcript
255
+ - Seizure safety: No flashing >3 times/second
260
256
 
261
257
  ---
262
258
 
@@ -264,12 +260,10 @@ button:focus:not(:focus-visible) {
264
260
 
265
261
  ### Touch Target Size
266
262
 
267
- | Standard | Minimum Size |
268
- | --------------- | ------------ |
269
- | WCAG 2.2 AA | 24x24px |
270
- | WCAG 2.2 AAA | 44x44px |
271
- | Apple HIG | 44x44pt |
272
- | Material Design | 48x48dp |
263
+ - WCAG 2.2 AA: 24x24px
264
+ - WCAG 2.2 AAA: 44x44px
265
+ - Apple HIG: 44x44pt
266
+ - Material Design: 48x48dp
273
267
 
274
268
  ### Spacing Between Targets
275
269
 
@@ -287,38 +281,32 @@ button:focus:not(:focus-visible) {
287
281
 
288
282
  ### Automated Testing
289
283
 
290
- | Tool | Use Case |
291
- | ---------------- | ----------------------------------- |
292
- | **axe DevTools** | Browser extension, CI integration |
293
- | **Lighthouse** | Chrome DevTools, performance + a11y |
294
- | **WAVE** | Browser extension, visual feedback |
295
- | **pa11y** | CLI tool for CI/CD |
296
- | **jest-axe** | Unit test accessibility assertions |
284
+ - **axe DevTools**: Browser extension, CI integration
285
+ - **Lighthouse**: Chrome DevTools, performance + a11y
286
+ - **WAVE**: Browser extension, visual feedback
287
+ - **pa11y**: CLI tool for CI/CD
288
+ - **jest-axe**: Unit test accessibility assertions
297
289
 
298
290
  ### Manual Testing
299
291
 
300
- | Test | How |
301
- | -------------- | ------------------------------------ |
302
- | Keyboard only | Unplug mouse, navigate with Tab |
303
- | Screen reader | VoiceOver (Mac), NVDA/JAWS (Windows) |
304
- | Zoom 200% | Browser zoom, check layout |
305
- | Color contrast | Use contrast checker tools |
306
- | Motion reduced | Test `prefers-reduced-motion` |
292
+ - Keyboard only: Unplug mouse, navigate with Tab
293
+ - Screen reader: VoiceOver (Mac), NVDA/JAWS (Windows)
294
+ - Zoom 200%: Browser zoom, check layout
295
+ - Color contrast: Use contrast checker tools
296
+ - Motion reduced: Test `prefers-reduced-motion`
307
297
 
308
298
  ---
309
299
 
310
300
  ## 🚨 Anti-Patterns
311
301
 
312
- | Don't | Do |
313
- | -------------------------------- | ----------------------------------- |
314
- | `outline: none` without alt | Custom focus with adequate contrast |
315
- | Color-only indicators | Multiple visual cues |
316
- | Generic link text ("click here") | Descriptive link text |
317
- | Auto-playing media | User-controlled playback |
318
- | Time limits without extension | Allow time extension or removal |
319
- | Mouse-only interactions | Keyboard equivalent for all actions |
320
- | Missing form labels | Associated labels or aria-label |
321
- | Small touch targets | Minimum 44x44 touch targets |
302
+ - `outline: none` without alt: Custom focus with adequate contrast
303
+ - Color-only indicators: Multiple visual cues
304
+ - Generic link text ("click here"): Descriptive link text
305
+ - Auto-playing media: User-controlled playback
306
+ - Time limits without extension: Allow time extension or removal
307
+ - Mouse-only interactions: Keyboard equivalent for all actions
308
+ - Missing form labels: Associated labels or aria-label
309
+ - Small touch targets: Minimum 44x44 touch targets
322
310
 
323
311
  ---
324
312
 
@@ -360,12 +348,10 @@ button:focus:not(:focus-visible) {
360
348
 
361
349
  ## 🔗 Related Skills
362
350
 
363
- | Need | Skill |
364
- | ------------------ | ----------------------- |
365
- | SEO implementation | `seo-patterns` |
366
- | Frontend design | `frontend-design` |
367
- | UX research | UX researcher agent |
368
- | Performance | `performance-profiling` |
351
+ - SEO implementation: `seo-patterns`
352
+ - Frontend design: `frontend-design`
353
+ - UX research: UX researcher agent
354
+ - Performance: `performance-profiling`
369
355
 
370
356
  ---
371
357
 
@@ -7,19 +7,27 @@ version: 2.0
7
7
 
8
8
  # AI RAG Patterns - Retrieval-Augmented Generation
9
9
 
10
- > **Philosophy:** Retrieval quality determines generation quality. Garbage in, garbage out.
10
+ ## Quick Reference
11
+
12
+ - **Chunking**: 512-1024 tokens optimal · Overlap 20% · Respect document boundaries (headings)
13
+ - **Embeddings**: `text-embedding-3-small` for cost · `text-embedding-3-large` for quality · Normalize vectors
14
+ - **Vector DB**: Pinecone (managed) · Pgvector (Postgres) · Chroma (local) · Weaviate (hybrid)
15
+ - **Retrieval**: Top-k=5-10 · Reranker improves precision · Hybrid (dense+sparse) for best recall
16
+ - **Prompt**: System prompt + context + query · Cap context < model limit - response buffer
17
+ - **Evaluation**: Faithfulness · Answer relevancy · Context recall · Use RAGAS for metrics
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
- | Building Q&A over documents | Pure generative tasks |
19
- | Semantic search implementation | Dataset too small (<100 docs) |
20
- | Reducing LLM hallucinations | Data privacy restrictions |
21
- | Domain-specific knowledge access | Simple keyword search |
22
- | Document processing pipelines | Real-time streaming data |
26
+ - Building Q&A over documents: Pure generative tasks
27
+ - Semantic search implementation: Dataset too small (<100 docs)
28
+ - Reducing LLM hallucinations: Data privacy restrictions
29
+ - Domain-specific knowledge access: Simple keyword search
30
+ - Document processing pipelines: Real-time streaming data
23
31
 
24
32
  ---
25
33
 
@@ -403,15 +411,13 @@ langchain.llm_cache = RedisSemanticCache(
403
411
 
404
412
  ## Anti-Patterns
405
413
 
406
- | Don't | Do |
407
- | ------------------------------ | ----------------------------------- |
408
- | Fixed-size chunking only | Semantic chunking + structure-aware |
409
- | Pure vector search | Hybrid search (dense + sparse) |
410
- | Use first retrieval results | Rerank before generation |
411
- | Same embedding for all content | Evaluate per content type |
412
- | Cram max context into prompt | Use relevance thresholds |
413
- | Measure only final answer | Evaluate retrieval separately |
414
- | Ignore metadata | Add rich metadata for filtering |
414
+ - Fixed-size chunking only: Semantic chunking + structure-aware
415
+ - Pure vector search: Hybrid search (dense + sparse)
416
+ - Use first retrieval results: Rerank before generation
417
+ - Same embedding for all content: Evaluate per content type
418
+ - Cram max context into prompt: Use relevance thresholds
419
+ - Measure only final answer: Evaluate retrieval separately
420
+ - Ignore metadata: Add rich metadata for filtering
415
421
 
416
422
  ---
417
423
 
@@ -432,12 +438,10 @@ Before deployment:
432
438
 
433
439
  ## Related Skills
434
440
 
435
- | Need | Skill |
436
- | -------------------- | -------------------- |
437
- | LLM prompt design | `prompt-engineering` |
438
- | Vector DB (Postgres) | `postgres-patterns` |
439
- | Redis caching | `redis-patterns` |
440
- | API design | `api-patterns` |
441
+ - LLM prompt design: `prompt-engineering`
442
+ - Vector DB (Postgres): `postgres-patterns`
443
+ - Redis caching: `redis-patterns`
444
+ - API design: `api-patterns`
441
445
 
442
446
  ---
443
447
 
@@ -7,7 +7,16 @@ version: 2.0
7
7
 
8
8
  # API Patterns - Design Principles & Decision Making
9
9
 
10
- > **Philosophy:** Choose the right API style for the context. Learn to THINK, not copy fixed patterns.
10
+ ## Quick Reference
11
+
12
+ - **Style selection**: Public API → REST · Complex UI → GraphQL · TS monorepo internal → tRPC
13
+ - **REST naming**: nouns not verbs · `GET /users` not `GET /getUsers` · HTTP method = action
14
+ - **Status codes**: 200 OK · 201 Created · 204 Delete · 400 Bad · 401 Unauth · 403 Forbidden · 404 NotFound · 422 Validation · 429 RateLimit
15
+ - **Pagination**: `< 1000 rows` → offset · `> 10000 rows / infinite scroll` → cursor
16
+ - **Auth**: JWT (15min access + 7d refresh in httpOnly cookie) · Versioning: URI path `/v1/`
17
+ - **Response envelope**: `{ data: {}, meta: { requestId, timestamp } }` · errors: `{ error: { code, message } }`
18
+
19
+ ---
11
20
 
12
21
  ---
13
22
 
@@ -38,13 +47,11 @@ What are your requirements?
38
47
 
39
48
  ### Resource Naming
40
49
 
41
- | Do | Don't |
42
- | ------------------- | ------------------ |
43
- | `GET /users` | `GET /getUsers` |
44
- | `GET /users/:id` | `GET /user?id=123` |
45
- | `POST /users` | `POST /createUser` |
46
- | `DELETE /users/:id` | `POST /deleteUser` |
47
- | `/users/:id/orders` | `/getUserOrders` |
50
+ - `GET /users`: `GET /getUsers`
51
+ - `GET /users/:id`: `GET /user?id=123`
52
+ - `POST /users`: `POST /createUser`
53
+ - `DELETE /users/:id`: `POST /deleteUser`
54
+ - `/users/:id/orders`: `/getUserOrders`
48
55
 
49
56
  ### HTTP Methods
50
57
 
@@ -108,13 +115,11 @@ What are your requirements?
108
115
 
109
116
  ### Error Code Naming
110
117
 
111
- | Pattern | Example |
112
- | ------------------------- | ----------------------------------- |
113
- | `RESOURCE_NOT_FOUND` | `USER_NOT_FOUND`, `ORDER_NOT_FOUND` |
114
- | `RESOURCE_ALREADY_EXISTS` | `EMAIL_ALREADY_EXISTS` |
115
- | `INVALID_FIELD` | `INVALID_EMAIL`, `INVALID_PHONE` |
116
- | `PERMISSION_DENIED` | `PERMISSION_DENIED` |
117
- | `RATE_LIMITED` | `RATE_LIMITED` |
118
+ - `RESOURCE_NOT_FOUND`: `USER_NOT_FOUND`, `ORDER_NOT_FOUND`
119
+ - `RESOURCE_ALREADY_EXISTS`: `EMAIL_ALREADY_EXISTS`
120
+ - `INVALID_FIELD`: `INVALID_EMAIL`, `INVALID_PHONE`
121
+ - `PERMISSION_DENIED`: `PERMISSION_DENIED`
122
+ - `RATE_LIMITED`: `RATE_LIMITED`
118
123
 
119
124
  ---
120
125
 
@@ -161,14 +166,12 @@ Response:
161
166
 
162
167
  ### Decision Matrix
163
168
 
164
- | Use Case | Strategy |
165
- | ------------------------- | -------- |
166
- | Small dataset (<1000) | Offset |
167
- | Large dataset (>10000) | Cursor |
168
- | Frequently changing data | Cursor |
169
- | Random page access needed | Offset |
170
- | Infinite scroll UI | Cursor |
171
- | Table with page numbers | Offset |
169
+ - Small dataset (<1000): Offset
170
+ - Large dataset (>10000): Cursor
171
+ - Frequently changing data: Cursor
172
+ - Random page access needed: Offset
173
+ - Infinite scroll UI: Cursor
174
+ - Table with page numbers: Offset
172
175
 
173
176
  ---
174
177
 
@@ -218,11 +221,9 @@ v1 (retired) → Returns 410 Gone
218
221
 
219
222
  ### Strategies
220
223
 
221
- | Strategy | Description |
222
- | ------------------ | ------------------------------------- |
223
- | **Token Bucket** | Allows bursts, refills over time |
224
- | **Sliding Window** | Smooth rate control |
225
- | **Fixed Window** | Simple but allows burst at boundaries |
224
+ - **Token Bucket**: Allows bursts, refills over time
225
+ - **Sliding Window**: Smooth rate control
226
+ - **Fixed Window**: Simple but allows burst at boundaries
226
227
 
227
228
  ### Response Headers
228
229
 
@@ -274,15 +275,13 @@ When using tRPC (TypeScript-first):
274
275
 
275
276
  ## Anti-Patterns
276
277
 
277
- | Don't | Do |
278
- | ---------------------------- | ----------------------------- |
279
- | Use verbs in REST endpoints | Use nouns + HTTP methods |
280
- | Return 200 for errors | Use appropriate status codes |
281
- | Expose stack traces | Return structured error codes |
282
- | Skip rate limiting | Implement from day 1 |
283
- | Inconsistent response format | Define envelope pattern |
284
- | Version in request body | Version in URL path |
285
- | Return all fields always | Support field selection |
278
+ - Use verbs in REST endpoints: Use nouns + HTTP methods
279
+ - Return 200 for errors: Use appropriate status codes
280
+ - Expose stack traces: Return structured error codes
281
+ - Skip rate limiting: Implement from day 1
282
+ - Inconsistent response format: Define envelope pattern
283
+ - Version in request body: Version in URL path
284
+ - Return all fields always: Support field selection
286
285
 
287
286
  ---
288
287
 
@@ -304,12 +303,10 @@ Before implementing:
304
303
 
305
304
  ## Related Skills
306
305
 
307
- | Need | Skill |
308
- | ---------------------- | ----------------------- |
309
- | Backend implementation | `nodejs-best-practices` |
310
- | Database design | `database-design` |
311
- | Security hardening | `security-fundamentals` |
312
- | Testing APIs | `testing-patterns` |
306
+ - Backend implementation: `nodejs-best-practices`
307
+ - Database design: `database-design`
308
+ - Security hardening: `security-fundamentals`
309
+ - Testing APIs: `testing-patterns`
313
310
 
314
311
  ---
315
312
 
@@ -8,19 +8,27 @@ priority: HIGH
8
8
 
9
9
  # Auth Patterns - Security-First Access Control
10
10
 
11
+ ## ⚡ Quick Reference
12
+
13
+ - **Password**: bcrypt (cost 12) or Argon2id · Never MD5/SHA1 · No plaintext comparison
14
+ - **JWT**: Access 15min · Refresh 7d in httpOnly SameSite=Strict cookie · RS256 for multi-service
15
+ - **OAuth 2.0**: Authorization Code + PKCE for SPA/mobile · Client Credentials for M2M · Never Implicit flow
16
+ - **Session**: Rotate ID after login · Invalidate on logout · SameSite=Strict cookie
17
+ - **MFA**: TOTP (Authenticator) preferred · SMS as fallback only · Rate limit OTP attempts
18
+ - **Rate limiting**: 5 failed logins → lockout 15min · Per-IP + per-account limits
19
+
20
+ ---
11
21
  > **Philosophy:** Authentication answers "Who are you?" Authorization answers "What can you do?" Both must be **server-validated**, never trust the client.
12
22
 
13
23
  ---
14
24
 
15
25
  ## Core Principles
16
26
 
17
- | Principle | Rule |
18
- | -------------------- | --------------------------------------------------------- |
19
- | **Server-side** | All auth checks happen on server, never just client |
20
- | **Defense in depth** | Multiple layers: HTTPS + tokens + validation + rate limit |
21
- | **Least privilege** | Grant minimum permissions needed |
22
- | **Secure defaults** | Default deny, explicitly grant access |
23
- | **Audit everything** | Log auth events for security monitoring |
27
+ - **Server-side**: All auth checks happen on server, never just client
28
+ - **Defense in depth**: Multiple layers: HTTPS + tokens + validation + rate limit
29
+ - **Least privilege**: Grant minimum permissions needed
30
+ - **Secure defaults**: Default deny, explicitly grant access
31
+ - **Audit everything**: Log auth events for security monitoring
24
32
 
25
33
  ---
26
34
 
@@ -124,13 +132,11 @@ async function requireOwnership(req, res, next) {
124
132
 
125
133
  ## Password Security
126
134
 
127
- | Rule | Implementation |
128
- | ----------------------- | ------------------------------------------ |
129
- | **Hash with bcrypt** | Salt rounds: 12+ |
130
- | **Min 12 characters** | + uppercase + lowercase + number + special |
131
- | **Rate limit attempts** | 5 attempts per 15 min |
132
- | **Never log passwords** | Not even errors |
133
- | **Secure reset flow** | Time-limited token via email |
135
+ - **Hash with bcrypt**: Salt rounds: 12+
136
+ - **Min 12 characters**: + uppercase + lowercase + number + special
137
+ - **Rate limit attempts**: 5 attempts per 15 min
138
+ - **Never log passwords**: Not even errors
139
+ - **Secure reset flow**: Time-limited token via email
134
140
 
135
141
  ### Password Flow
136
142
 
@@ -166,11 +172,9 @@ res.cookie("token", accessToken, {
166
172
 
167
173
  ## OAuth2 Simplified
168
174
 
169
- | Flow | Use Case |
170
- | ---------------------- | ---------------------------------- |
171
- | **Authorization Code** | Web apps with backend |
172
- | **PKCE** | SPAs, mobile apps (public clients) |
173
- | **Client Credentials** | Service-to-service |
175
+ - **Authorization Code**: Web apps with backend
176
+ - **PKCE**: SPAs, mobile apps (public clients)
177
+ - **Client Credentials**: Service-to-service
174
178
 
175
179
  ### Basic OAuth2 Flow
176
180
 
@@ -214,53 +218,45 @@ Need access from JavaScript?
214
218
 
215
219
  ## Anti-Patterns (DON'T)
216
220
 
217
- | Anti-Pattern | Correct Approach |
218
- | -------------------------------- | ------------------------------ |
219
- | Store JWT in localStorage | httpOnly cookie or memory |
220
- | Plain text passwords in DB | bcrypt hash with salt |
221
- | Long-lived access tokens (24h+) | 15 min access + 7d refresh |
222
- | Client-only auth checks | Server validates every request |
223
- | Same secret for access & refresh | Separate secrets |
224
- | No rate limiting on login | 5 attempts / 15 min |
225
- | JWT without expiration | Always set `exp` claim |
226
- | Hardcoded secrets in code | Environment variables |
221
+ - Store JWT in localStorage: httpOnly cookie or memory
222
+ - Plain text passwords in DB: bcrypt hash with salt
223
+ - Long-lived access tokens (24h+): 15 min access + 7d refresh
224
+ - Client-only auth checks: Server validates every request
225
+ - Same secret for access & refresh: Separate secrets
226
+ - No rate limiting on login: 5 attempts / 15 min
227
+ - JWT without expiration: Always set `exp` claim
228
+ - Hardcoded secrets in code: Environment variables
227
229
 
228
230
  ---
229
231
 
230
232
  ## Security Checklist
231
233
 
232
- | Category | Check |
233
- | -------------- | ------------------------------------- |
234
- | **Transport** | HTTPS everywhere, HSTS enabled |
235
- | **Passwords** | bcrypt 12+, strong policy enforced |
236
- | **Tokens** | Short-lived, httpOnly, secure cookies |
237
- | **Rate Limit** | Login, registration, password reset |
238
- | **Headers** | CSP, X-Frame-Options, X-Content-Type |
239
- | **Logging** | Auth events logged, no sensitive data |
240
- | **CORS** | Strict origin whitelist |
234
+ - **Transport**: HTTPS everywhere, HSTS enabled
235
+ - **Passwords**: bcrypt 12+, strong policy enforced
236
+ - **Tokens**: Short-lived, httpOnly, secure cookies
237
+ - **Rate Limit**: Login, registration, password reset
238
+ - **Headers**: CSP, X-Frame-Options, X-Content-Type
239
+ - **Logging**: Auth events logged, no sensitive data
240
+ - **CORS**: Strict origin whitelist
241
241
 
242
242
  ---
243
243
 
244
244
  ## 🔴 Self-Check Before Completing
245
245
 
246
- | Check | Question |
247
- | -------------------------- | ------------------------------ |
248
- | ✅ **Server validated?** | All auth happens server-side? |
249
- | ✅ **Tokens secure?** | httpOnly, secure, short-lived? |
250
- | ✅ **Passwords hashed?** | bcrypt with 12+ rounds? |
251
- | ✅ **Rate limited?** | Login endpoint protected? |
252
- | ✅ **HTTPS?** | All traffic encrypted? |
253
- | ✅ **No secrets in code?** | Environment variables only? |
246
+ - **Server validated?**: All auth happens server-side?
247
+ - **Tokens secure?**: httpOnly, secure, short-lived?
248
+ - ✅ **Passwords hashed?**: bcrypt with 12+ rounds?
249
+ - ✅ **Rate limited?**: Login endpoint protected?
250
+ - ✅ **HTTPS?**: All traffic encrypted?
251
+ - ✅ **No secrets in code?**: Environment variables only?
254
252
 
255
253
  ---
256
254
 
257
255
  ## Related Skills
258
256
 
259
- | Need | Skill |
260
- | ----------------- | ----------------------- |
261
- | API design | `api-patterns` |
262
- | Security auditing | `security-fundamentals` |
263
- | Database design | `database-design` |
257
+ - API design: `api-patterns`
258
+ - Security auditing: `security-fundamentals`
259
+ - Database design: `database-design`
264
260
 
265
261
  ---
266
262