@champpaba/claude-agent-kit 3.0.2 → 3.2.0

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 (51) hide show
  1. package/.claude/CHANGELOG.md +707 -0
  2. package/.claude/CLAUDE.md +128 -613
  3. package/.claude/agents/_shared/pre-work-checklist.md +108 -7
  4. package/.claude/commands/cdev.md +36 -0
  5. package/.claude/commands/csetup.md +292 -1791
  6. package/.claude/commands/cview.md +364 -364
  7. package/.claude/contexts/design/accessibility.md +611 -611
  8. package/.claude/contexts/design/layout.md +400 -400
  9. package/.claude/contexts/design/responsive.md +551 -551
  10. package/.claude/contexts/design/shadows.md +522 -522
  11. package/.claude/contexts/design/typography.md +465 -465
  12. package/.claude/contexts/domain/README.md +164 -164
  13. package/.claude/contexts/patterns/agent-coordination.md +388 -388
  14. package/.claude/contexts/patterns/development-principles.md +513 -513
  15. package/.claude/contexts/patterns/error-handling.md +478 -478
  16. package/.claude/contexts/patterns/logging.md +424 -424
  17. package/.claude/contexts/patterns/tdd-classification.md +516 -516
  18. package/.claude/contexts/patterns/testing.md +413 -413
  19. package/.claude/lib/README.md +3 -3
  20. package/.claude/lib/detailed-guides/taskmaster-analysis.md +1 -1
  21. package/.claude/lib/task-analyzer.md +144 -0
  22. package/.claude/lib/tdd-workflow.md +2 -1
  23. package/.claude/lib/validation-gates.md +484 -484
  24. package/.claude/settings.local.json +42 -42
  25. package/.claude/templates/PROJECT_STATUS.template.yml +16 -41
  26. package/.claude/templates/context-template.md +45 -45
  27. package/.claude/templates/flags-template.json +42 -42
  28. package/.claude/templates/phases-sections/accessibility-test.md +17 -17
  29. package/.claude/templates/phases-sections/api-design.md +37 -37
  30. package/.claude/templates/phases-sections/backend-tests.md +16 -16
  31. package/.claude/templates/phases-sections/backend.md +37 -37
  32. package/.claude/templates/phases-sections/business-logic-validation.md +16 -16
  33. package/.claude/templates/phases-sections/component-tests.md +17 -17
  34. package/.claude/templates/phases-sections/contract-backend.md +16 -16
  35. package/.claude/templates/phases-sections/contract-frontend.md +16 -16
  36. package/.claude/templates/phases-sections/database.md +35 -35
  37. package/.claude/templates/phases-sections/e2e-tests.md +16 -16
  38. package/.claude/templates/phases-sections/fix-implementation.md +17 -17
  39. package/.claude/templates/phases-sections/frontend-integration.md +18 -18
  40. package/.claude/templates/phases-sections/manual-flow-test.md +15 -15
  41. package/.claude/templates/phases-sections/manual-ux-test.md +16 -16
  42. package/.claude/templates/phases-sections/refactor-implementation.md +17 -17
  43. package/.claude/templates/phases-sections/refactor.md +16 -16
  44. package/.claude/templates/phases-sections/regression-tests.md +15 -15
  45. package/.claude/templates/phases-sections/responsive-test.md +16 -16
  46. package/.claude/templates/phases-sections/script-implementation.md +43 -43
  47. package/.claude/templates/phases-sections/test-coverage.md +16 -16
  48. package/.claude/templates/phases-sections/user-approval.md +14 -14
  49. package/LICENSE +21 -21
  50. package/package.json +1 -1
  51. package/.claude/lib/tdd-classifier.md +0 -345
@@ -0,0 +1,707 @@
1
+ # Changelog
2
+
3
+ > **Version History for Claude Agent Kit**
4
+ > For current features, see `CLAUDE.md`
5
+
6
+ ---
7
+
8
+ ## v3.2.0: Consolidated Pre-Work Context
9
+
10
+ **Problem Solved:** `/csetup` generated two separate pseudocode outputs (`research-checklist.md` and `INTEGRATION_RISKS.md`) that were never actually created. Agents had to discover context from multiple scattered sources.
11
+
12
+ **Solution:** Consolidated all agent context into a single `pre-work-context.md` file with direct execution instructions. Merged Step 2.7 (Best Practices) into Step 2.6.
13
+
14
+ ### Key Changes
15
+
16
+ | Component | Before | After |
17
+ |-----------|--------|-------|
18
+ | Step 2.6 | ~1000 lines of pseudocode | ~300 lines of direct instructions |
19
+ | Step 2.7 | Separate best practices step | Merged into Step 2.6 |
20
+ | Output files | research-checklist.md + INTEGRATION_RISKS.md + best-practices/*.md | Single `pre-work-context.md` |
21
+ | Agent discovery | Multiple files to read | One file with all context |
22
+
23
+ ### Step 2.6 Structure (New - v3.2.0)
24
+
25
+ ```
26
+ Step 2.6.1: Analyze Change Characteristics (type, complexity, risk)
27
+ Step 2.6.2: Detect Libraries (from package files + specs)
28
+ Step 2.6.3: Fetch Best Practices via Context7 (direct MCP calls)
29
+ Step 2.6.4: Determine Research Layers (adaptive depth)
30
+ Step 2.6.5: Detect Integration Warnings (cross-library)
31
+ Step 2.6.6: Generate Critical Checklist Items (security/compliance)
32
+ Step 2.6.7: Write pre-work-context.md (single consolidated file)
33
+ Step 2.6.8: Output Summary
34
+ Step 2.6.9: Skip Conditions
35
+ ```
36
+
37
+ ### pre-work-context.md Structure
38
+
39
+ ```markdown
40
+ # Pre-Work Context: {changeId}
41
+
42
+ ## 1. Change Analysis (type, complexity, risk)
43
+ ## 2. Library Best Practices (from Context7)
44
+ ## 3. Research Findings (domain knowledge)
45
+ ## 4. Integration Warnings (cross-library concerns)
46
+ ## 5. Critical Checklist (security/compliance must-haves)
47
+ ## 6. Quick Reference (package manager, commands)
48
+ ```
49
+
50
+ ### Agent Pre-Work Checklist Update
51
+
52
+ **Version:** 3.0.0 (Pre-Work Context Integration)
53
+
54
+ - Step 0: Read pre-work-context.md (NEW - primary source)
55
+ - Step 0.1: Library Requirements Check (fallback)
56
+ - Step 0.2: Library Feasibility Validation (was 0.5)
57
+ - Step 0.3: Memory Context Query (was 0.6)
58
+
59
+ ### Files Changed
60
+
61
+ | File | Change |
62
+ |------|--------|
63
+ | `csetup.md` | Rewrote Step 2.6 with direct execution |
64
+ | `csetup.md` | Removed Step 2.7 (merged into 2.6) |
65
+ | `csetup.md` | Renumbered Step 2.8 → Step 2.7 |
66
+ | `pre-work-checklist.md` | Added Step 0 (read pre-work-context.md) |
67
+ | `pre-work-checklist.md` | Renumbered steps (0.5→0.2, 0.6→0.3) |
68
+ | `CLAUDE.md` | Updated to v3.2.0 |
69
+
70
+ ### Why This Matters
71
+
72
+ **Before:**
73
+ - Agents had to read 5+ files to get context
74
+ - research-checklist.md was pseudocode that never executed
75
+ - INTEGRATION_RISKS.md was pseudocode that never executed
76
+ - Context was scattered and inconsistent
77
+
78
+ **After:**
79
+ - Agents read ONE file (`pre-work-context.md`) in STEP 0
80
+ - All context is consolidated and actually generated
81
+ - Main Claude follows direct instructions (not pseudocode)
82
+ - Integration warnings + checklist items in one place
83
+
84
+ ---
85
+
86
+ ## v3.1.1: Direct Best Practices Execution
87
+
88
+ **Problem Solved:** Step 2.7 (Auto-Setup Best Practices) was written as pseudocode with helper functions (`extractLibrariesSemantically`, `parseContext7Response`, etc.) that Main Claude never actually executed. Best practices files were documented but never created.
89
+
90
+ **Solution:** Rewrote Step 2.7 as direct, executable instructions that Main Claude can follow. No more pseudocode - just clear steps with actual MCP tool names.
91
+
92
+ ### Key Changes
93
+
94
+ | Component | Before | After |
95
+ |-----------|--------|-------|
96
+ | Step 2.7 | ~1000 lines of pseudocode | ~130 lines of direct instructions |
97
+ | Helper functions | 6 fake functions | Removed entirely |
98
+ | MCP tool calls | Written as code syntax | Written as clear instructions |
99
+ | Output format | Complex extraction logic | Simple template |
100
+
101
+ ### Step 2.7 Structure (New)
102
+
103
+ ```
104
+ Step 2.7.1: Detect Libraries (from package.json, requirements.txt, spec files)
105
+ Step 2.7.2: Resolve via Context7 (call MCP tools directly)
106
+ Step 2.7.3: Create Best Practices Files (using template)
107
+ Step 2.7.4: Create index.md (registry)
108
+ Step 2.7.5: Output Summary
109
+ Step 2.7.6: Skip Conditions
110
+ ```
111
+
112
+ ### Files Changed
113
+
114
+ | File | Change |
115
+ |------|--------|
116
+ | `csetup.md` | Rewrote Step 2.7, removed ~1000 lines of pseudocode |
117
+ | `csetup.md` | Removed helper functions (extractLibrariesSemantically, etc.) |
118
+ | `csetup.md` | Updated detectAdditionalTech as REMOVED |
119
+ | `CLAUDE.md` | Updated version to 3.1.1 |
120
+
121
+ ### Why This Matters
122
+
123
+ Before: Main Claude would read Step 2.7 as documentation and skip it.
124
+ After: Main Claude follows clear instructions and actually calls Context7.
125
+
126
+ ---
127
+
128
+ ## v3.1.0: TDD Classification + Development Principles Injection
129
+
130
+ **Problem Solved:** TDD classification was a simple one-liner (`risk=HIGH || complexity>=7`) that missed critical patterns like auth, payment, and external integrations. Development principles (SOLID, DRY, KISS) were documented but never injected to agents.
131
+
132
+ **Solution:** Comprehensive TDD classification based on `tdd-classification.md` patterns, integrated into `task-analyzer.md` Step 2.6. Development principles injected to ALL agents via `/cdev`.
133
+
134
+ ### Key Changes
135
+
136
+ | Component | Before | After |
137
+ |-----------|--------|-------|
138
+ | TDD classification | 1-line in csetup.md | Full pattern matching in task-analyzer.md |
139
+ | development-principles.md | Listed but not used | Injected to ALL agents via /cdev |
140
+ | tdd-classifier.md | Duplicate file | Deleted (merged into tdd-classification.md) |
141
+
142
+ ### TDD Classification (Step 2.6)
143
+
144
+ Now classifies based on:
145
+
146
+ | Pattern | Examples | TDD Required |
147
+ |---------|----------|--------------|
148
+ | Security operations | auth, jwt, encrypt, permission | ✅ Always |
149
+ | Financial operations | payment, stripe, calculate, tax | ✅ Always |
150
+ | External integrations | webhook, sendgrid, twilio | ✅ Always |
151
+ | Data transformations | serialize, parse, etl | ✅ Always |
152
+ | Complex UI | multi-step, wizard, keyboard-nav | ✅ Always |
153
+ | Simple CRUD reads | get, list, fetch | ❌ Test-alongside OK |
154
+ | Presentational UI | button, card, modal | ❌ No TDD |
155
+ | Database/Integration | schema, migration, validation | ❌ No TDD |
156
+
157
+ ### Development Principles Injection
158
+
159
+ `/cdev` now injects to ALL agent prompts:
160
+
161
+ ```markdown
162
+ ## 🏛️ Development Principles (Level 1 - ALL Agents)
163
+
164
+ **REQUIRED READING:** @.claude/contexts/patterns/development-principles.md
165
+
166
+ | Principle | Summary |
167
+ |-----------|---------|
168
+ | **KISS** | Choose simple solutions over complex ones |
169
+ | **YAGNI** | Build only what you need now |
170
+ | **SRP** | One responsibility per module |
171
+ | **DRY** | Single source of truth for all knowledge |
172
+ | **Fail Fast** | Detect and raise errors immediately |
173
+ | **Observability** | Log everything that matters |
174
+ ```
175
+
176
+ ### Files Changed
177
+
178
+ | File | Change |
179
+ |------|--------|
180
+ | `task-analyzer.md` | Added Step 2.6 TDD Classification |
181
+ | `csetup.md` | Updated phase generation to use TDD from tasks |
182
+ | `cdev.md` | Added development-principles injection |
183
+ | `tdd-classifier.md` | **DELETED** (merged) |
184
+ | `CLAUDE.md` | Updated references and version |
185
+
186
+ ---
187
+
188
+ ## v3.0.0: Template-Free Architecture (Task Analyzer v2.0)
189
+
190
+ **Problem Solved:** Phase templates (`phase-templates.json`) were limiting and caused task loss. When `tasks.md` had 5 detailed phases but template had only 2, tasks disappeared. Templates overrode the single source of truth.
191
+
192
+ **Solution:** Delete templates entirely. Use AI-driven Task Analyzer to transform `tasks.md` (WHAT) into `phases.md` (HOW).
193
+
194
+ ### Key Changes
195
+
196
+ | Component | Before (v2.x) | After (v3.0) |
197
+ |-----------|---------------|--------------|
198
+ | phases.md source | phase-templates.json | tasks.md (single source of truth) |
199
+ | Agent assignment | Keyword matching | AI context understanding |
200
+ | Missing best practices | Warning prompts | Auto-add automatically |
201
+ | Complex tasks | Same as simple | Incremental milestones |
202
+ | Task filtering | Templates filter tasks | No filtering, ALL tasks kept |
203
+
204
+ ### How It Works
205
+
206
+ ```
207
+ tasks.md (WHAT to build)
208
+
209
+ Step 1: Parse ALL tasks (no filtering)
210
+ Step 2: AI-driven analysis (complexity, risk, agent, dependencies)
211
+ Step 3: Auto-add best practices (no warnings)
212
+ Step 4: Generate incremental milestones
213
+ Step 5: Sort by priority (phase order → dependencies → risk)
214
+
215
+ phases.md (HOW to build incrementally)
216
+ ```
217
+
218
+ ### AI-Driven Analysis (vs Keyword Matching)
219
+
220
+ **Old (keyword matching):**
221
+ ```
222
+ "Create user service that connects to database"
223
+ Keywords: "service" (backend), "connects" (frontend), "database" (database)
224
+ → Conflict! Which agent?
225
+ ```
226
+
227
+ **New (AI decision):**
228
+ ```
229
+ "Create user service that connects to database"
230
+ → AI understands: This is a backend service layer
231
+ → Agent: backend ✓
232
+ ```
233
+
234
+ ### Auto-Add Best Practices (No Warnings)
235
+
236
+ | Condition | Auto-Added Task |
237
+ |-----------|-----------------|
238
+ | HIGH risk task | Checkpoint: Verify before proceeding |
239
+ | External API | Error handling + retry + timeout |
240
+ | Implementation (complexity ≥ 5) | Verification task |
241
+ | Database changes | Backup + rollback test |
242
+ | Security-critical | Security review + log check |
243
+
244
+ ### Incremental Milestones
245
+
246
+ Complex tasks (risk=HIGH OR complexity≥7) get automatic milestones:
247
+
248
+ | Pattern | Strategy | Milestones |
249
+ |---------|----------|------------|
250
+ | Repository/Service | method-by-method | 1 method → half → all |
251
+ | External API | mock-to-real | mock → 1 real → errors → scale |
252
+ | Batch Processing | scale-up | 1 → 5 → 20 → full |
253
+ | Complex Form | field-by-field | architecture → e2e → all fields |
254
+
255
+ ### Files Changed
256
+
257
+ | File | Change |
258
+ |------|--------|
259
+ | `phase-templates.json` | **DELETED** |
260
+ | `task-analyzer.md` | Complete rewrite (v2.0) - 666 lines |
261
+ | `csetup.md` | Remove Steps 3-4 (keyword/template), new Step 3 (Task Analyzer) |
262
+
263
+ ### Migration
264
+
265
+ No migration needed. Just run `/csetup` - it will generate phases.md from tasks.md directly.
266
+
267
+ ---
268
+
269
+ ## v2.8.0: Critical Flow Injection
270
+
271
+ **Problem Solved:** Research layers are flexible and context-dependent, but security/compliance items are non-negotiable. Previously, critical requirements like password hashing, PCI-DSS compliance, or HIPAA regulations could be missed if research didn't surface them.
272
+
273
+ **Solution:** Auto-inject critical required items into research layers based on change analysis.
274
+
275
+ ### How It Works
276
+
277
+ ```
278
+ /csetup analyzes change:
279
+ ├── hasAuth: true → Inject auth security items (7 items)
280
+ ├── hasPayment: true → Inject payment security items (5 items)
281
+ ├── industryContext: healthcare → Inject HIPAA compliance items (5 items)
282
+ └── industryContext: fintech → Inject PCI-DSS compliance items (6 items)
283
+
284
+ Research layers (flexible) + Critical items (non-negotiable)
285
+ ```
286
+
287
+ ### Critical Flow Categories
288
+
289
+ | Flow | Layer | Items | Examples |
290
+ |------|-------|-------|----------|
291
+ | Auth | Security | 7 | Password hashing (bcrypt/argon2), JWT secure storage, session timeout |
292
+ | Payment | Security | 5 | PCI key security, no card storage, webhook signature verification |
293
+ | Healthcare | Compliance | 5 | PHI encryption, role-based access, audit trail, BAA, breach plan |
294
+ | Fintech | Compliance | 6 | Data encryption, key rotation, audit logging, access controls |
295
+ | Sensitive Data | Security + Data Architecture | 6 | Encryption at rest/transit, access logging, backup, retention |
296
+
297
+ ### Item Structure
298
+
299
+ Each critical item has:
300
+ ```javascript
301
+ {
302
+ id: 'auth-password-hash', // Unique identifier
303
+ check: '☐ Password hashing...', // Checklist item
304
+ why: 'Plain text passwords...', // Explanation
305
+ severity: 'critical' // Always 'critical'
306
+ }
307
+ ```
308
+
309
+ ### Files Changed
310
+
311
+ | File | Change |
312
+ |------|--------|
313
+ | `tests/helpers.js` | `CRITICAL_FLOWS` constant + `injectCriticalRequiredItems()` function |
314
+ | `csetup.md` Step 2.6 | Calls `injectCriticalRequiredItems()` for each layer |
315
+
316
+ ---
317
+
318
+ ## v2.7.0: UX Testing Agent (Persona-Based)
319
+
320
+ **Problem Solved:** UI was approved by developers, not real users. No validation that the UI actually converts customers before spending time on backend development.
321
+
322
+ **Solution:** Auto-inject Phase 1.5 (ux-tester) after uxui-frontend with approval gate workflow.
323
+
324
+ ### How It Works
325
+
326
+ ```
327
+ Phase 1: uxui-frontend (build UI)
328
+
329
+ Phase 1.5: ux-tester (approval gate)
330
+ → Auto-generate personas from product context
331
+ → Test each persona via Chrome DevTools
332
+ → Calculate weighted conversion prediction
333
+ → Generate UX test report
334
+ → PAUSE for user approval
335
+
336
+ [User approves] → Phase 2: backend + database
337
+ [User rejects] → Loop back to Phase 1 with feedback
338
+ ```
339
+
340
+ ### Key Features
341
+
342
+ | Feature | Description |
343
+ |---------|-------------|
344
+ | **Auto-Generated Personas** | 3-5 personas with % breakdown based on product context |
345
+ | **Weighted Conversion** | Calculate purchase likelihood weighted by customer % |
346
+ | **Chrome DevTools Testing** | Screenshots, snapshots, click tests, mobile responsive |
347
+ | **Approval Gate** | PAUSE and wait for user approve/reject |
348
+ | **Rejection Loop** | Feedback passed to uxui-frontend, re-run Phase 1 → 1.5 |
349
+
350
+ ### Files Changed
351
+
352
+ | File | Change |
353
+ |------|--------|
354
+ | `.claude/agents/07-ux-tester.md` | New agent for persona-based UX testing |
355
+ | `.claude/templates/phases-sections/ux-testing.md` | Phase template with approval gate |
356
+ | `.claude/lib/task-analyzer.md` | **v2.0:** Complete rewrite - template-free, AI-driven |
357
+ | `.claude/lib/agent-executor.md` | Approval gate execution logic |
358
+ | `.claude/commands/cdev.md` | Step 4.6 approval gate handling |
359
+
360
+ ### UX Test Report Example
361
+
362
+ ```markdown
363
+ # UX Test Report
364
+
365
+ ## Personas Tested
366
+ | Persona | % ลูกค้า | Would Buy | Weighted |
367
+ |---------|----------|-----------|----------|
368
+ | นักศึกษา 18-24 | 40% | Maybe (50%) | +20% |
369
+ | พนักงาน 25-35 | 35% | Yes (100%) | +35% |
370
+ | ผู้สูงวัย 50-65 | 15% | No (0%) | +0% |
371
+ | ผู้ปกครอง 35-50 | 10% | Maybe (50%) | +5% |
372
+
373
+ ## Conversion Prediction: 60%
374
+ ## Potential After Fixes: 92.5%
375
+ ```
376
+
377
+ ---
378
+
379
+ ## v2.5.0: Smart Topic Query + Integration Risk Detection
380
+
381
+ **Problem Solved:** Context7 queries used static topic "best practices" which missed adapter/integration documentation. Example: Drizzle + Auth.js requires specific column naming (snake_case) but this wasn't detected, causing runtime errors.
382
+
383
+ **Solution:** Smart Topic Query includes other library names in topic + automatic integration risk detection.
384
+
385
+ ### How Smart Topic Query Works
386
+
387
+ ```
388
+ Old (v2.4.0):
389
+ topic: "best practices, patterns, anti-patterns, common mistakes"
390
+ → Misses adapter-specific docs
391
+
392
+ New (v2.5.0):
393
+ topic: "best practices, patterns, adapter, integration, schema, {other-lib-names}"
394
+ → Gets cross-library integration docs automatically
395
+ ```
396
+
397
+ ### Key Features
398
+
399
+ | Feature | Description |
400
+ |---------|-------------|
401
+ | **Smart Topic** | Includes other detected library names in Context7 topic |
402
+ | **Bidirectional Query** | Query BOTH libraries (Auth.js → Drizzle, Drizzle → Auth.js) |
403
+ | **Risk Pattern Detection** | Scans docs for adapter, schema, column, sync, webhook patterns |
404
+ | **INTEGRATION_RISKS.md** | Auto-generated summary of detected integration concerns |
405
+ | **Zero Maintenance** | No hardcoded library pairs - works with any combination |
406
+
407
+ ### Integration Risk Patterns Detected
408
+
409
+ | Pattern | Keywords | Example |
410
+ |---------|----------|---------|
411
+ | Adapter | adapter, drizzleadapter, prismaadapter | ORM + Auth integrations |
412
+ | Schema | column, snake_case, camelcase, mapping | Column naming mismatches |
413
+ | Sync | sync, migrate, syncurl, embedded replica | Mobile/Edge data sync |
414
+ | Webhook | webhook, webhookendpoint | Payment/notification handlers |
415
+ | Lifecycle | beforeall, aftereach, setup, teardown | Test configuration |
416
+
417
+ ### Output Files
418
+
419
+ | File | Content |
420
+ |------|---------|
421
+ | `best-practices/{lib}.md` | Library-specific best practices (enhanced with integration docs) |
422
+ | `best-practices/INTEGRATION_RISKS.md` | Cross-library risk summary + checklist |
423
+
424
+ ### Example Flow
425
+
426
+ ```
427
+ Detected: [drizzle, auth.js, stripe]
428
+
429
+ Query drizzle with topic: "best practices, adapter, integration, auth.js, stripe"
430
+ → Gets: Drizzle adapter patterns, column naming
431
+
432
+ Query auth.js with topic: "best practices, adapter, integration, drizzle, stripe"
433
+ → Gets: DrizzleAdapter config, usersTable/accountsTable schema
434
+
435
+ Query stripe with topic: "best practices, adapter, integration, drizzle, auth.js"
436
+ → Gets: Webhook patterns, payment integration
437
+
438
+ Risk Detection:
439
+ → auth.js mentions "drizzleadapter", "userstable" → SCHEMA pattern
440
+ → stripe mentions "webhook", "webhooksecret" → WEBHOOK pattern
441
+
442
+ Output:
443
+ → drizzle.md (with auth.js integration info)
444
+ → auth-js.md (with Drizzle adapter config)
445
+ → stripe.md (with webhook patterns)
446
+ → INTEGRATION_RISKS.md (summary of all detected risks)
447
+ ```
448
+
449
+ ### Files Changed
450
+
451
+ | File | Change |
452
+ |------|--------|
453
+ | `csetup.md` Step 2.7 | Smart Topic Query implementation |
454
+ | `detectIntegrationRisks()` | New: Pattern detection from docs |
455
+ | `generateIntegrationRiskSummary()` | New: INTEGRATION_RISKS.md output |
456
+
457
+ ---
458
+
459
+ ## v2.4.0: Adaptive Depth Research
460
+
461
+ **Problem Solved:** Previous feature detection was hardcoded (only 4 types: auth, payment, fileUpload, apiDesign) and used fixed standards. Missing domain-level best practices like "how to design a good database" or "healthcare compliance requirements."
462
+
463
+ **Solution:** Dynamic research layers that adapt to each change's complexity (0 to 10+ layers).
464
+
465
+ ### Key Principles
466
+
467
+ | Principle | Description |
468
+ |-----------|-------------|
469
+ | L1 = Best Practice (ALWAYS) | "คนอื่นทำกันยังไง?" (How do others do it?) for ALL non-trivial changes |
470
+ | Dynamic Depth | No fixed min/max - truly adaptive (0-10+ layers) |
471
+ | Separation of Concerns | Visual (/designsetup) is STATIC, Strategy (research) is DYNAMIC |
472
+ | Per-Change Output | Generates `research-checklist.md` for each change |
473
+ | Design Conflict Warnings | Warns if industry practice conflicts with user's design choices |
474
+
475
+ ### Layer Examples by Change Type
476
+
477
+ | Change Type | Layers | Example Layers |
478
+ |-------------|--------|----------------|
479
+ | Typo fix, debug log | 0 | None needed |
480
+ | Simple API endpoint | 2 | Best Practice, API Design |
481
+ | Auth system | 4 | Best Practice, Security, API Design, Testing |
482
+ | E-commerce checkout | 7 | Best Practice, Security, UX, Payment, Integration, Performance, Testing |
483
+ | Healthcare portal | 10 | Best Practice, Security, Compliance (HIPAA), UX, Data Architecture, API, Performance, Testing, Integration, Audit |
484
+
485
+ ### Knowledge Sources (Separated)
486
+
487
+ | Step | Knowledge Type | Source | Example |
488
+ |------|----------------|--------|---------|
489
+ | **2.6** | Domain (HOW to design) | Claude's Knowledge | Normalization, UX patterns, Security |
490
+ | **2.7** | Stack (HOW to use tool) | Context7 | Prisma, React, Next.js |
491
+
492
+ ### How It Works
493
+
494
+ ```
495
+ 1. Analyze change from proposal.md, tasks.md, design.md
496
+ → Detect: primaryType, complexity, riskLevel, domains, features
497
+
498
+ 2. Determine research layers dynamically:
499
+ - Trivial (complexity ≤ 1, no UI/API/DB) → 0 layers
500
+ - Non-trivial → L1 Best Practice + context-specific layers
501
+
502
+ 3. Execute research per layer using Claude's knowledge:
503
+ - Claude knows: UX (Nielsen Norman, Baymard), DB (Codd), Security (OWASP)
504
+ - No static files needed - Claude reasons from training
505
+ - No WebSearch needed - domain knowledge is stable
506
+
507
+ 4. Generate research-checklist.md with:
508
+ - Key questions per layer
509
+ - Best practices (from Claude's knowledge)
510
+ - Anti-patterns to avoid
511
+ - Trade-offs explained
512
+ - Recommendations specific to THIS change
513
+
514
+ 5. Agents read research-checklist.md before implementing
515
+ ```
516
+
517
+ **WHY Claude's Knowledge?**
518
+ - Domain principles rarely change (Normalization = 50 years, REST = 20 years)
519
+ - No maintenance needed (no static files to update)
520
+ - Context-aware (Claude applies principles to YOUR specific change)
521
+ - Stack knowledge goes to Context7 (Step 2.7) which has live docs
522
+
523
+ ### Available Research Layers
524
+
525
+ | Layer | Triggered By |
526
+ |-------|--------------|
527
+ | Best Practice / Industry Standard | Always (non-trivial changes) |
528
+ | Security Requirements | hasAuth, hasPayment, hasSensitiveData |
529
+ | {Industry} Compliance | healthcare, fintech, or other regulated industries |
530
+ | User Experience Patterns | isExternalFacing + hasUI |
531
+ | Conversion Psychology | marketing/sales pages |
532
+ | Content Strategy | marketing/content pages |
533
+ | Data Architecture | hasDatabase, data-intensive |
534
+ | API Design | hasAPI |
535
+ | Multi-tenancy Patterns | SaaS with tenant isolation |
536
+ | Real-time Architecture | WebSocket, collaboration features |
537
+ | Performance Optimization | external-facing OR complexity ≥ 6 |
538
+ | Integration Patterns | external APIs, webhooks |
539
+ | Testing Strategy | HIGH risk OR complexity ≥ 7 |
540
+
541
+ ### Files Changed
542
+
543
+ | File | Change |
544
+ |------|--------|
545
+ | `csetup.md` Step 2.6 | Complete rewrite - Adaptive Depth Research |
546
+ | `analyzeChangeCharacteristics()` | New: semantic analysis of change context |
547
+ | `determineResearchLayers()` | New: dynamic layer selection |
548
+ | `executeLayerResearch()` | New: Context7 + semantic research |
549
+ | `generateResearchChecklist()` | New: markdown output per change |
550
+ | `checkDesignConflicts()` | New: warns on design vs industry fit |
551
+
552
+ ---
553
+
554
+ ## v2.3.0: Zero-Maintenance Tech Stack Detection
555
+
556
+ **Problem Solved:** Previously, `/csetup` required hardcoded regex patterns and Context7 ID mappings for each library. Adding support for new libraries (like SQLAlchemy, Pydantic, Rust crates) required code changes.
557
+
558
+ **Solution:** Dynamic detection that works with any library in any language without maintenance.
559
+
560
+ ### How It Works
561
+
562
+ ```
563
+ 1. Extract potential library names from ALL text sources:
564
+ - Spec files (proposal.md, design.md, tasks.md)
565
+ - Package files (package.json, requirements.txt, Cargo.toml, go.mod, etc.)
566
+ - Import statements in code snippets
567
+ - Prose mentions ("using FastAPI", "with Prisma")
568
+
569
+ 2. Send each candidate to Context7 resolve-library-id:
570
+ - If Context7 recognizes it → confirmed library ✅
571
+ - If not recognized → not a library, skip ❌
572
+
573
+ 3. For confirmed libraries, fetch best practices:
574
+ - Context7 get-library-docs with "best practices" topic
575
+ - Generate .md file with patterns, anti-patterns, checklist
576
+
577
+ 4. Result: Best practices for ANY library, automatically!
578
+ ```
579
+
580
+ ### Benefits
581
+
582
+ | Aspect | Before (v1.8.0) | After (v2.3.0) |
583
+ |--------|-----------------|----------------|
584
+ | New library support | Manual code change | Automatic |
585
+ | Python stack | Partial (FastAPI, Django only) | Full (SQLAlchemy, Pydantic, Click, etc.) |
586
+ | Rust support | None | Automatic |
587
+ | Go support | None | Automatic |
588
+ | Maintenance | Required for each library | Zero |
589
+
590
+ ### Files Changed
591
+
592
+ | File | Change |
593
+ |------|--------|
594
+ | `csetup.md` Step 2.7 | Complete rewrite with dynamic detection |
595
+ | `extractPotentialLibraryNames()` | New helper for NLP extraction |
596
+ | `parseContext7Response()` | New helper for Context7 response parsing |
597
+ | `generateBestPracticesFile()` | Updated signature, includes Context7 ID |
598
+ | `detectAdditionalTech()` | Deprecated, delegates to new system |
599
+
600
+ ---
601
+
602
+ ## v2.2.0: claude-mem Integration
603
+
604
+ **What is claude-mem?** A Claude Code plugin that automatically captures tool usage observations and provides persistent memory across sessions.
605
+
606
+ ### Division of Responsibilities
607
+
608
+ | Data Type | Source | How to Access |
609
+ |-----------|--------|---------------|
610
+ | Past decisions | claude-mem (auto) | Ask: "what decisions about X?" |
611
+ | Past learnings | claude-mem (auto) | Ask: "what did we learn about X?" |
612
+ | Past bugs/fixes | claude-mem (auto) | Ask: "what bugs with X?" |
613
+ | Future ideas | claude-mem (auto) | Ask: "what ideas for X?" |
614
+ | **Blockers** | PROJECT_STATUS.yml | Read file (requires human decision) |
615
+ | **Priorities** | PROJECT_STATUS.yml | Read file (requires human decision) |
616
+ | **Tech debt** | PROJECT_STATUS.yml | Read file (actionable items) |
617
+ | What to build | tasks.md → phases.md | /csetup generates |
618
+ | How to build | Agents | /cdev executes |
619
+
620
+ ### PROJECT_STATUS.yml Changes
621
+
622
+ - **REMOVED:** `decisions`, `notes`, `future_ideas` → claude-mem handles automatically
623
+ - **KEPT:** `blockers`, `next_priorities`, `technical_debt` → requires human decision
624
+ - **Query past context:** Just ask naturally → mem-search skill auto-invoked
625
+
626
+ ---
627
+
628
+ ## v2.1.0: Design System v2 + Context Optimization
629
+
630
+ ### Design System v2 (YAML-based)
631
+
632
+ - `/extract https://site.com` → Extracts design from reference site
633
+ - `/designsetup @prd.md` → Interactive 3-round loop with theme selection
634
+ - Generates: `data.yaml` (~800 lines) + `README.md` (~100 lines)
635
+
636
+ ### Context Optimization
637
+
638
+ - **Problem:** Multiple files read by different commands/agents
639
+ - **Solution:** `data.yaml` = SINGLE SOURCE for all agents
640
+
641
+ ### Cross-Session Context
642
+
643
+ - `PROJECT_STATUS.yml` provides quick context snapshot for new sessions
644
+ - Contains: infrastructure state, blockers, completed work, next priorities
645
+
646
+ ---
647
+
648
+ ## v2.0.0: Claude 4.5 Optimization
649
+
650
+ **Based on:** [Claude 4 Best Practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices)
651
+
652
+ ### Changes Applied
653
+
654
+ | Before | After | WHY |
655
+ |--------|-------|-----|
656
+ | "MUST", "WILL BE REJECTED" | Professional tone | Claude 4.5 works better with respectful instructions |
657
+ | "Don't do X", "Never Y" | "Use X instead" | Positive instructions are clearer |
658
+ | Rules without context | Rules with WHY | Claude applies rules more intelligently |
659
+ | Duplicated content (6x) | Shared `_shared/` folder | 83% token reduction |
660
+ | ~1000 lines per agent | ~250-350 lines | 65% smaller |
661
+
662
+ ### New Shared Components
663
+
664
+ ```
665
+ .claude/agents/_shared/
666
+ ├── pre-work-checklist.md # Common validation steps
667
+ ├── package-manager.md # Package manager protocol
668
+ ├── documentation-policy.md # What files to create
669
+ ├── agent-boundaries.md # When to use which agent
670
+ └── README.md # Overview
671
+ ```
672
+
673
+ ### Token Savings
674
+
675
+ | Agent | Before | After | Reduction |
676
+ |-------|--------|-------|-----------|
677
+ | uxui-frontend | ~1037 | ~375 | 64% |
678
+ | integration | ~600 | ~210 | 65% |
679
+ | backend | ~700 | ~244 | 65% |
680
+ | database | ~680 | ~273 | 60% |
681
+ | frontend | ~650 | ~296 | 54% |
682
+ | test-debug | ~580 | ~252 | 57% |
683
+ | **Total** | **~4247** | **~1650** | **61%** |
684
+
685
+ Plus ~500 tokens in shared files = **~2150 total** (was ~4247)
686
+
687
+ ### Files Refactored
688
+
689
+ **Implementation Logic (lib/):** agent-router.md, agent-executor.md, context-loading-protocol.md, flags-updater.md, document-loader.md, detailed-guides/agent-system.md
690
+
691
+ **Commands:** cdev.md, csetup.md, pageplan.md, designsetup.md
692
+
693
+ **Patterns (contexts/patterns/):** validation-framework.md, error-recovery.md, ui-component-consistency.md, task-breakdown.md, agent-discovery.md, code-standards.md, animation-patterns.md, frontend-component-strategy.md, performance-optimization.md, change-workflow.md, task-classification.md
694
+
695
+ **Design (contexts/design/):** index.md, box-thinking.md
696
+
697
+ **Templates:** phases-sections/frontend-mockup.md, design-context-template.md, STYLE_GUIDE.template.md
698
+
699
+ ---
700
+
701
+ ## Earlier Versions
702
+
703
+ - **v1.8.0** - File Creation Policy
704
+ - **v1.6.0** - Incremental Testing
705
+ - **v1.3.0** - TaskMaster-style Analysis
706
+
707
+ See git history for details.