@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
package/.claude/CLAUDE.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # CLAUDE.md
2
2
 
3
3
  > **Navigation Hub for AI Agents**
4
- > **Template Version:** 3.0.0 - Template-Free Architecture
5
- > **Latest:** Task Analyzer v2.0 - AI-driven analysis, no keyword matching, auto-add best practices
4
+ > **Template Version:** 3.2.0 - Consolidated Pre-Work Context
5
+ > **Latest:** Step 2.6 generates `pre-work-context.md` - single file with all agent context
6
6
 
7
7
  ---
8
8
 
@@ -26,6 +26,7 @@
26
26
  | `README.md` | **Visual design summary** (human-readable) | UI/Frontend phases |
27
27
  | `data.yaml` | Design tokens + psychology (~300 lines) | Quick UI reference |
28
28
  | `page-plan.md` | UI component layout + content strategy | uxui-frontend agent |
29
+ | `pre-work-context.md` | **v3.2.0!** All agent context (best practices, warnings, checklist) | All agents - STEP 0 ✨ |
29
30
  | `phases.md` | Execution plan with agent assignments | All phases |
30
31
  | `flags.json` | Progress tracking | All phases |
31
32
 
@@ -75,6 +76,8 @@ Universal, framework-agnostic template for AI-assisted development.
75
76
  - `@/.claude/contexts/design/index.md` (General design principles - fallback)
76
77
 
77
78
  **Development:**
79
+ - `@/.claude/contexts/patterns/development-principles.md` - **v3.1.0!** SOLID, DRY, KISS, Fail Fast (Level 1 - ALL agents) ✨
80
+ - `@/.claude/contexts/patterns/tdd-classification.md` - TDD workflow classification patterns
78
81
  - `@/.claude/contexts/patterns/task-classification.md` (Agent selection guide)
79
82
  - `@/.claude/contexts/patterns/agent-coordination.md` (When to run agents parallel/sequential)
80
83
  - `@/.claude/contexts/patterns/error-recovery.md` (How agents handle errors & escalate)
@@ -86,7 +89,7 @@ Universal, framework-agnostic template for AI-assisted development.
86
89
  **Project Setup:**
87
90
  - `/extract https://site.com` - Extract design from reference sites
88
91
  - `/designsetup @prd.md` - Interactive design system setup
89
- - `/csetup` - **v3.0.0:** Template-free! AI-driven task analysis, auto-add best practices, incremental milestones
92
+ - `/csetup` - **v3.2.0:** Generates `pre-work-context.md` with best practices, research, warnings, checklists
90
93
 
91
94
  **Page Planning (UI Tasks) - v2.0.0:**
92
95
  - `/pageplan @prd.md @brief.md` - Generate page structure with auto page type detection
@@ -122,30 +125,28 @@ Universal, framework-agnostic template for AI-assisted development.
122
125
  **Implementation Logic:**
123
126
  - `@/.claude/lib/README.md` - Implementation logic overview
124
127
  - `@/.claude/lib/agent-executor.md` - Agent retry & escalation logic (used by /cdev) + Incremental testing execution
125
- - `@/.claude/lib/tdd-classifier.md` - TDD classification logic (used by /csetup)
126
- - `@/.claude/lib/task-analyzer.md` - **v2.0!** Template-free AI-driven task analysis ✨
128
+ - `@/.claude/lib/task-analyzer.md` - **v3.1.0!** Template-free task analysis with TDD classification (Step 2.6)
127
129
  - `@/.claude/lib/flags-updater.md` - Progress tracking protocol (Main Claude updates flags.json)
128
130
  - `@/.claude/lib/agent-router.md` - Mandatory agent routing rules (enforce delegation)
129
131
  - `@/.claude/contexts/patterns/agent-discovery.md` - Shared agent discovery flow
130
132
 
131
133
  ---
132
134
 
133
- ## 📚 Best Practices System (v2.5.0 - Smart Topic Query)
135
+ ## 📚 Best Practices System (v3.2.0 - Consolidated Pre-Work Context)
134
136
 
135
137
  **Quick Summary:**
136
- - `/csetup` **dynamically detects any library** from spec text + package files (no hardcoded mappings)
137
- - **Works with any language:** JavaScript, Python, Rust, Go, PHP, Ruby - automatically
138
- - **Context7 validates** each potential library name and resolves to official docs
139
- - **v2.5.0:** Smart Topic Query includes other library names for cross-library integration docs
140
- - **v2.5.0:** Auto-generates `INTEGRATION_RISKS.md` with detected concerns
141
- - Files created in `.claude/contexts/domain/project/best-practices/`
142
- - **Agents read** best practices + integration risks before coding
138
+ - `/csetup` generates **single `pre-work-context.md`** with ALL agent context
139
+ - **Consolidates:** Best practices, research findings, integration warnings, critical checklists
140
+ - **Context7 validates** each library and fetches best practices
141
+ - **Agents read ONE file** instead of multiple scattered files
142
+ - **File location:** `openspec/changes/{changeId}/pre-work-context.md`
143
143
 
144
144
  **Key Changes:**
145
145
  | Version | Change |
146
146
  |---------|--------|
147
147
  | v2.3.0 | NLP extraction + Context7 resolution (zero maintenance) |
148
148
  | v2.5.0 | Smart Topic Query + Integration Risk Detection |
149
+ | v3.2.0 | **Consolidated `pre-work-context.md`** (single file for all agent context) |
149
150
 
150
151
  **Detection Sources:**
151
152
  | Source | Examples |
@@ -158,23 +159,22 @@ Universal, framework-agnostic template for AI-assisted development.
158
159
  | PHP | composer.json |
159
160
  | Ruby | Gemfile |
160
161
 
161
- **Flow (v2.5.0):**
162
+ **Flow (v3.2.0):**
162
163
  ```
163
- /csetup → extract potential library names from ALL text sources
164
- Context7 resolve-library-id (validates if real library)
165
- → Context7 get-library-docs (Smart Topic Query with other lib names)
166
- detect integration risks from docs content
167
- generate .md files for each verified library
168
- → generate INTEGRATION_RISKS.md if risks detected
169
- /cdev inject paths into prompt → agent reads → validation checks
164
+ /csetup → analyze change (type, complexity, risk)
165
+ detect libraries from spec + package files
166
+ → Context7 resolve + fetch best practices
167
+ determine research layers
168
+ detect integration warnings
169
+ → generate critical checklist items
170
+ write pre-work-context.md (single file)
171
+ /cdev → agents read pre-work-context.md in STEP 0
170
172
  ```
171
173
 
172
- **Output Files:**
173
- | File | Content |
174
- |------|---------|
175
- | `{lib}.md` | Library best practices with integration info |
176
- | `INTEGRATION_RISKS.md` | Cross-library risks + checklist (if any detected) |
177
- | `index.md` | Registry of all best practices files |
174
+ **Output File:**
175
+ | File | Sections |
176
+ |------|----------|
177
+ | `pre-work-context.md` | 1. Change Analysis, 2. Library Best Practices, 3. Research Findings, 4. Integration Warnings, 5. Critical Checklist, 6. Quick Reference |
178
178
 
179
179
  ---
180
180
 
@@ -302,558 +302,38 @@ User: "Build login system"
302
302
 
303
303
  ---
304
304
 
305
- ## 🆕 v3.0.0: Template-Free Architecture (Task Analyzer v2.0)
305
+ ## 📜 Version History
306
306
 
307
- **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.
307
+ > **Full changelog with technical details, code examples, and migration guides:**
308
+ > See [`.claude/CHANGELOG.md`](./CHANGELOG.md)
308
309
 
309
- **Solution:** Delete templates entirely. Use AI-driven Task Analyzer to transform `tasks.md` (WHAT) into `phases.md` (HOW).
310
-
311
- ### Key Changes
312
-
313
- | Component | Before (v2.x) | After (v3.0) |
314
- |-----------|---------------|--------------|
315
- | phases.md source | phase-templates.json | tasks.md (single source of truth) |
316
- | Agent assignment | Keyword matching | AI context understanding |
317
- | Missing best practices | Warning prompts | Auto-add automatically |
318
- | Complex tasks | Same as simple | Incremental milestones |
319
- | Task filtering | Templates filter tasks | No filtering, ALL tasks kept |
320
-
321
- ### How It Works
322
-
323
- ```
324
- tasks.md (WHAT to build)
325
-
326
- Step 1: Parse ALL tasks (no filtering)
327
- Step 2: AI-driven analysis (complexity, risk, agent, dependencies)
328
- Step 3: Auto-add best practices (no warnings)
329
- Step 4: Generate incremental milestones
330
- Step 5: Sort by priority (phase order → dependencies → risk)
331
-
332
- phases.md (HOW to build incrementally)
333
- ```
334
-
335
- ### AI-Driven Analysis (vs Keyword Matching)
336
-
337
- **Old (keyword matching):**
338
- ```
339
- "Create user service that connects to database"
340
- Keywords: "service" (backend), "connects" (frontend), "database" (database)
341
- → Conflict! Which agent?
342
- ```
343
-
344
- **New (AI decision):**
345
- ```
346
- "Create user service that connects to database"
347
- → AI understands: This is a backend service layer
348
- → Agent: backend ✓
349
- ```
350
-
351
- ### Auto-Add Best Practices (No Warnings)
352
-
353
- | Condition | Auto-Added Task |
354
- |-----------|-----------------|
355
- | HIGH risk task | Checkpoint: Verify before proceeding |
356
- | External API | Error handling + retry + timeout |
357
- | Implementation (complexity ≥ 5) | Verification task |
358
- | Database changes | Backup + rollback test |
359
- | Security-critical | Security review + log check |
360
-
361
- ### Incremental Milestones
362
-
363
- Complex tasks (risk=HIGH OR complexity≥7) get automatic milestones:
364
-
365
- | Pattern | Strategy | Milestones |
366
- |---------|----------|------------|
367
- | Repository/Service | method-by-method | 1 method → half → all |
368
- | External API | mock-to-real | mock → 1 real → errors → scale |
369
- | Batch Processing | scale-up | 1 → 5 → 20 → full |
370
- | Complex Form | field-by-field | architecture → e2e → all fields |
371
-
372
- ### Files Changed
373
-
374
- | File | Change |
375
- |------|--------|
376
- | `phase-templates.json` | **DELETED** |
377
- | `task-analyzer.md` | Complete rewrite (v2.0) - 666 lines |
378
- | `csetup.md` | Remove Steps 3-4 (keyword/template), new Step 3 (Task Analyzer) |
379
-
380
- ### Migration
381
-
382
- No migration needed. Just run `/csetup` - it will generate phases.md from tasks.md directly.
383
-
384
- ---
385
-
386
- ## 🆕 v2.8.0: Critical Flow Injection
387
-
388
- **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.
389
-
390
- **Solution:** Auto-inject critical required items into research layers based on change analysis.
391
-
392
- ### How It Works
393
-
394
- ```
395
- /csetup analyzes change:
396
- ├── hasAuth: true → Inject auth security items (7 items)
397
- ├── hasPayment: true → Inject payment security items (5 items)
398
- ├── industryContext: healthcare → Inject HIPAA compliance items (5 items)
399
- └── industryContext: fintech → Inject PCI-DSS compliance items (6 items)
400
-
401
- Research layers (flexible) + Critical items (non-negotiable)
402
- ```
403
-
404
- ### Critical Flow Categories
405
-
406
- | Flow | Layer | Items | Examples |
407
- |------|-------|-------|----------|
408
- | Auth | Security | 7 | Password hashing (bcrypt/argon2), JWT secure storage, session timeout |
409
- | Payment | Security | 5 | PCI key security, no card storage, webhook signature verification |
410
- | Healthcare | Compliance | 5 | PHI encryption, role-based access, audit trail, BAA, breach plan |
411
- | Fintech | Compliance | 6 | Data encryption, key rotation, audit logging, access controls |
412
- | Sensitive Data | Security + Data Architecture | 6 | Encryption at rest/transit, access logging, backup, retention |
413
-
414
- ### Item Structure
415
-
416
- Each critical item has:
417
- ```javascript
418
- {
419
- id: 'auth-password-hash', // Unique identifier
420
- check: '☐ Password hashing...', // Checklist item
421
- why: 'Plain text passwords...', // Explanation
422
- severity: 'critical' // Always 'critical'
423
- }
424
- ```
425
-
426
- ### Files Changed
427
-
428
- | File | Change |
429
- |------|--------|
430
- | `tests/helpers.js` | `CRITICAL_FLOWS` constant + `injectCriticalRequiredItems()` function |
431
- | `csetup.md` Step 2.6 | Calls `injectCriticalRequiredItems()` for each layer |
432
-
433
- ---
434
-
435
- ## 🆕 v2.7.0: UX Testing Agent (Persona-Based)
436
-
437
- **Problem Solved:** UI was approved by developers, not real users. No validation that the UI actually converts customers before spending time on backend development.
438
-
439
- **Solution:** Auto-inject Phase 1.5 (ux-tester) after uxui-frontend with approval gate workflow.
440
-
441
- ### How It Works
442
-
443
- ```
444
- Phase 1: uxui-frontend (build UI)
445
-
446
- Phase 1.5: ux-tester (approval gate)
447
- → Auto-generate personas from product context
448
- → Test each persona via Chrome DevTools
449
- → Calculate weighted conversion prediction
450
- → Generate UX test report
451
- → PAUSE for user approval
452
-
453
- [User approves] → Phase 2: backend + database
454
- [User rejects] → Loop back to Phase 1 with feedback
455
- ```
456
-
457
- ### Key Features
458
-
459
- | Feature | Description |
310
+ **Recent versions:**
311
+ | Version | Key Feature |
460
312
  |---------|-------------|
461
- | **Auto-Generated Personas** | 3-5 personas with % breakdown based on product context |
462
- | **Weighted Conversion** | Calculate purchase likelihood weighted by customer % |
463
- | **Chrome DevTools Testing** | Screenshots, snapshots, click tests, mobile responsive |
464
- | **Approval Gate** | PAUSE and wait for user approve/reject |
465
- | **Rejection Loop** | Feedback passed to uxui-frontend, re-run Phase 1 → 1.5 |
466
-
467
- ### Files Changed
468
-
469
- | File | Change |
470
- |------|--------|
471
- | `.claude/agents/07-ux-tester.md` | New agent for persona-based UX testing |
472
- | `.claude/templates/phases-sections/ux-testing.md` | Phase template with approval gate |
473
- | `.claude/lib/task-analyzer.md` | **v2.0:** Complete rewrite - template-free, AI-driven |
474
- | `.claude/lib/agent-executor.md` | Approval gate execution logic |
475
- | `.claude/commands/cdev.md` | Step 4.6 approval gate handling |
476
-
477
- ### UX Test Report Example
478
-
479
- ```markdown
480
- # UX Test Report
481
-
482
- ## Personas Tested
483
- | Persona | % ลูกค้า | Would Buy | Weighted |
484
- |---------|----------|-----------|----------|
485
- | นักศึกษา 18-24 | 40% | Maybe (50%) | +20% |
486
- | พนักงาน 25-35 | 35% | Yes (100%) | +35% |
487
- | ผู้สูงวัย 50-65 | 15% | No (0%) | +0% |
488
- | ผู้ปกครอง 35-50 | 10% | Maybe (50%) | +5% |
489
-
490
- ## Conversion Prediction: 60%
491
- ## Potential After Fixes: 92.5%
492
- ```
493
-
494
- ---
495
-
496
- ## 🆕 v2.5.0: Smart Topic Query + Integration Risk Detection
497
-
498
- **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.
499
-
500
- **Solution:** Smart Topic Query includes other library names in topic + automatic integration risk detection.
501
-
502
- ### How Smart Topic Query Works
503
-
504
- ```
505
- Old (v2.4.0):
506
- topic: "best practices, patterns, anti-patterns, common mistakes"
507
- → Misses adapter-specific docs
508
-
509
- New (v2.5.0):
510
- topic: "best practices, patterns, adapter, integration, schema, {other-lib-names}"
511
- → Gets cross-library integration docs automatically
512
- ```
513
-
514
- ### Key Features
515
-
516
- | Feature | Description |
517
- |---------|-------------|
518
- | **Smart Topic** | Includes other detected library names in Context7 topic |
519
- | **Bidirectional Query** | Query BOTH libraries (Auth.js → Drizzle, Drizzle → Auth.js) |
520
- | **Risk Pattern Detection** | Scans docs for adapter, schema, column, sync, webhook patterns |
521
- | **INTEGRATION_RISKS.md** | Auto-generated summary of detected integration concerns |
522
- | **Zero Maintenance** | No hardcoded library pairs - works with any combination |
523
-
524
- ### Integration Risk Patterns Detected
525
-
526
- | Pattern | Keywords | Example |
527
- |---------|----------|---------|
528
- | Adapter | adapter, drizzleadapter, prismaadapter | ORM + Auth integrations |
529
- | Schema | column, snake_case, camelcase, mapping | Column naming mismatches |
530
- | Sync | sync, migrate, syncurl, embedded replica | Mobile/Edge data sync |
531
- | Webhook | webhook, webhookendpoint | Payment/notification handlers |
532
- | Lifecycle | beforeall, aftereach, setup, teardown | Test configuration |
533
-
534
- ### Output Files
535
-
536
- | File | Content |
537
- |------|---------|
538
- | `best-practices/{lib}.md` | Library-specific best practices (enhanced with integration docs) |
539
- | `best-practices/INTEGRATION_RISKS.md` | Cross-library risk summary + checklist |
540
-
541
- ### Example Flow
542
-
543
- ```
544
- Detected: [drizzle, auth.js, stripe]
545
-
546
- Query drizzle with topic: "best practices, adapter, integration, auth.js, stripe"
547
- → Gets: Drizzle adapter patterns, column naming
548
-
549
- Query auth.js with topic: "best practices, adapter, integration, drizzle, stripe"
550
- → Gets: DrizzleAdapter config, usersTable/accountsTable schema
551
-
552
- Query stripe with topic: "best practices, adapter, integration, drizzle, auth.js"
553
- → Gets: Webhook patterns, payment integration
554
-
555
- Risk Detection:
556
- → auth.js mentions "drizzleadapter", "userstable" → SCHEMA pattern
557
- → stripe mentions "webhook", "webhooksecret" → WEBHOOK pattern
558
-
559
- Output:
560
- → drizzle.md (with auth.js integration info)
561
- → auth-js.md (with Drizzle adapter config)
562
- → stripe.md (with webhook patterns)
563
- → INTEGRATION_RISKS.md (summary of all detected risks)
564
- ```
565
-
566
- ### Files Changed
567
-
568
- | File | Change |
569
- |------|--------|
570
- | `csetup.md` Step 2.7 | Smart Topic Query implementation |
571
- | `detectIntegrationRisks()` | New: Pattern detection from docs |
572
- | `generateIntegrationRiskSummary()` | New: INTEGRATION_RISKS.md output |
573
-
574
- ---
575
-
576
- ## 🆕 v2.4.0: Adaptive Depth Research
577
-
578
- **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."
579
-
580
- **Solution:** Dynamic research layers that adapt to each change's complexity (0 to 10+ layers).
581
-
582
- ### Key Principles
583
-
584
- | Principle | Description |
585
- |-----------|-------------|
586
- | L1 = Best Practice (ALWAYS) | "คนอื่นทำกันยังไง?" (How do others do it?) for ALL non-trivial changes |
587
- | Dynamic Depth | No fixed min/max - truly adaptive (0-10+ layers) |
588
- | Separation of Concerns | Visual (/designsetup) is STATIC, Strategy (research) is DYNAMIC |
589
- | Per-Change Output | Generates `research-checklist.md` for each change |
590
- | Design Conflict Warnings | Warns if industry practice conflicts with user's design choices |
591
-
592
- ### Layer Examples by Change Type
593
-
594
- | Change Type | Layers | Example Layers |
595
- |-------------|--------|----------------|
596
- | Typo fix, debug log | 0 | None needed |
597
- | Simple API endpoint | 2 | Best Practice, API Design |
598
- | Auth system | 4 | Best Practice, Security, API Design, Testing |
599
- | E-commerce checkout | 7 | Best Practice, Security, UX, Payment, Integration, Performance, Testing |
600
- | Healthcare portal | 10 | Best Practice, Security, Compliance (HIPAA), UX, Data Architecture, API, Performance, Testing, Integration, Audit |
601
-
602
- ### Knowledge Sources (Separated)
603
-
604
- | Step | Knowledge Type | Source | Example |
605
- |------|----------------|--------|---------|
606
- | **2.6** | Domain (HOW to design) | Claude's Knowledge | Normalization, UX patterns, Security |
607
- | **2.7** | Stack (HOW to use tool) | Context7 | Prisma, React, Next.js |
608
-
609
- ### How It Works
610
-
611
- ```
612
- 1. Analyze change from proposal.md, tasks.md, design.md
613
- → Detect: primaryType, complexity, riskLevel, domains, features
614
-
615
- 2. Determine research layers dynamically:
616
- - Trivial (complexity ≤ 1, no UI/API/DB) → 0 layers
617
- - Non-trivial → L1 Best Practice + context-specific layers
618
-
619
- 3. Execute research per layer using Claude's knowledge:
620
- - Claude knows: UX (Nielsen Norman, Baymard), DB (Codd), Security (OWASP)
621
- - No static files needed - Claude reasons from training
622
- - No WebSearch needed - domain knowledge is stable
623
-
624
- 4. Generate research-checklist.md with:
625
- - Key questions per layer
626
- - Best practices (from Claude's knowledge)
627
- - Anti-patterns to avoid
628
- - Trade-offs explained
629
- - Recommendations specific to THIS change
630
-
631
- 5. Agents read research-checklist.md before implementing
632
- ```
633
-
634
- **WHY Claude's Knowledge?**
635
- - Domain principles rarely change (Normalization = 50 years, REST = 20 years)
636
- - No maintenance needed (no static files to update)
637
- - Context-aware (Claude applies principles to YOUR specific change)
638
- - Stack knowledge goes to Context7 (Step 2.7) which has live docs
639
-
640
- ### Available Research Layers
641
-
642
- | Layer | Triggered By |
643
- |-------|--------------|
644
- | Best Practice / Industry Standard | Always (non-trivial changes) |
645
- | Security Requirements | hasAuth, hasPayment, hasSensitiveData |
646
- | {Industry} Compliance | healthcare, fintech, or other regulated industries |
647
- | User Experience Patterns | isExternalFacing + hasUI |
648
- | Conversion Psychology | marketing/sales pages |
649
- | Content Strategy | marketing/content pages |
650
- | Data Architecture | hasDatabase, data-intensive |
651
- | API Design | hasAPI |
652
- | Multi-tenancy Patterns | SaaS with tenant isolation |
653
- | Real-time Architecture | WebSocket, collaboration features |
654
- | Performance Optimization | external-facing OR complexity ≥ 6 |
655
- | Integration Patterns | external APIs, webhooks |
656
- | Testing Strategy | HIGH risk OR complexity ≥ 7 |
657
-
658
- ### Files Changed
659
-
660
- | File | Change |
661
- |------|--------|
662
- | `csetup.md` Step 2.6 | Complete rewrite - Adaptive Depth Research |
663
- | `analyzeChangeCharacteristics()` | New: semantic analysis of change context |
664
- | `determineResearchLayers()` | New: dynamic layer selection |
665
- | `executeLayerResearch()` | New: Context7 + semantic research |
666
- | `generateResearchChecklist()` | New: markdown output per change |
667
- | `checkDesignConflicts()` | New: warns on design vs industry fit |
668
-
669
- ### Output Example
670
-
671
- ```markdown
672
- # Research Checklist: healthcare-portal
673
-
674
- > Generated by Adaptive Depth Research (v2.4.0)
675
- > Complexity: 9/10 | Risk: HIGH
676
-
677
- ## Summary
678
-
679
- | Layer | Focus | Status |
680
- |-------|-------|--------|
681
- | L1: Best Practice | How do others implement healthcare? | ⏳ Pending |
682
- | L2: Security Requirements | What security measures? | ⏳ Pending |
683
- | L3: Healthcare Compliance | What HIPAA regulations? | ⏳ Pending |
684
- ...
685
-
686
- ## L1: Best Practice / Industry Standard
687
-
688
- **Focus:** How do others implement healthcare portals?
689
-
690
- ### Key Questions
691
- - [ ] What is the industry standard for healthcare portals?
692
- - [ ] What are common patterns and anti-patterns?
693
- ...
694
- ```
695
-
696
- ---
697
-
698
- ## 🆕 v2.3.0: Zero-Maintenance Tech Stack Detection
699
-
700
- **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.
701
-
702
- **Solution:** Dynamic detection that works with any library in any language without maintenance.
703
-
704
- ### How It Works
705
-
706
- ```
707
- 1. Extract potential library names from ALL text sources:
708
- - Spec files (proposal.md, design.md, tasks.md)
709
- - Package files (package.json, requirements.txt, Cargo.toml, go.mod, etc.)
710
- - Import statements in code snippets
711
- - Prose mentions ("using FastAPI", "with Prisma")
712
-
713
- 2. Send each candidate to Context7 resolve-library-id:
714
- - If Context7 recognizes it → confirmed library ✅
715
- - If not recognized → not a library, skip ❌
716
-
717
- 3. For confirmed libraries, fetch best practices:
718
- - Context7 get-library-docs with "best practices" topic
719
- - Generate .md file with patterns, anti-patterns, checklist
720
-
721
- 4. Result: Best practices for ANY library, automatically!
722
- ```
723
-
724
- ### Benefits
725
-
726
- | Aspect | Before (v1.8.0) | After (v2.3.0) |
727
- |--------|-----------------|----------------|
728
- | New library support | Manual code change | Automatic |
729
- | Python stack | Partial (FastAPI, Django only) | Full (SQLAlchemy, Pydantic, Click, etc.) |
730
- | Rust support | None | Automatic |
731
- | Go support | None | Automatic |
732
- | Maintenance | Required for each library | Zero |
733
-
734
- ### Files Changed
735
-
736
- | File | Change |
737
- |------|--------|
738
- | `csetup.md` Step 2.7 | Complete rewrite with dynamic detection |
739
- | `extractPotentialLibraryNames()` | New helper for NLP extraction |
740
- | `parseContext7Response()` | New helper for Context7 response parsing |
741
- | `generateBestPracticesFile()` | Updated signature, includes Context7 ID |
742
- | `detectAdditionalTech()` | Deprecated, delegates to new system |
743
-
744
- ---
745
-
746
- ## 🆕 v2.0.0: Claude 4.5 Optimization + Design System v2.0
747
-
748
- **Based on:** [Claude 4 Best Practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices)
749
-
750
- ### Claude 4.5 Changes Applied
751
-
752
- | Before | After | WHY |
753
- |--------|-------|-----|
754
- | "MUST", "WILL BE REJECTED" | Professional tone | Claude 4.5 works better with respectful instructions |
755
- | "Don't do X", "Never Y" | "Use X instead" | Positive instructions are clearer |
756
- | Rules without context | Rules with WHY | Claude applies rules more intelligently |
757
- | Duplicated content (6x) | Shared `_shared/` folder | 83% token reduction |
758
- | ~1000 lines per agent | ~250-350 lines | 65% smaller |
759
-
760
- ### New Shared Components
761
-
762
- ```
763
- .claude/agents/_shared/
764
- ├── pre-work-checklist.md # Common validation steps
765
- ├── package-manager.md # Package manager protocol
766
- ├── documentation-policy.md # What files to create
767
- ├── agent-boundaries.md # When to use which agent
768
- └── README.md # Overview
769
- ```
770
-
771
- ### Token Savings
772
-
773
- | Agent | Before | After | Reduction |
774
- |-------|--------|-------|-----------|
775
- | uxui-frontend | ~1037 | ~375 | 64% |
776
- | integration | ~600 | ~210 | 65% |
777
- | backend | ~700 | ~244 | 65% |
778
- | database | ~680 | ~273 | 60% |
779
- | frontend | ~650 | ~296 | 54% |
780
- | test-debug | ~580 | ~252 | 57% |
781
- | **Total** | **~4247** | **~1650** | **61%** |
782
-
783
- Plus ~500 tokens in shared files = **~2150 total** (was ~4247)
784
-
785
- ### Best Practices Applied
786
-
787
- 1. **Tone Calibration** - Professional, direct (not aggressive)
788
- 2. **Action Orientation** - Explicit "Write code" vs "Consider"
789
- 3. **Prevent Overengineering** - Clear boundaries
790
- 4. **Encourage Exploration** - Read before implementing
791
- 5. **Rich Output When Needed** - Specify requirements
792
- 6. **Context for Rules** - Explain WHY
793
- 7. **Positive Instructions** - "Use X" not "Don't Y"
794
-
795
- ### Additional Files Refactored
796
-
797
- Beyond the 6 agent files, these supporting files were also updated:
798
-
799
- **Implementation Logic (lib/):**
800
- | File | Changes |
801
- |------|---------|
802
- | `agent-router.md` | Routing table format, removed "CANNOT/forbidden" language |
803
- | `agent-executor.md` | Professional rejection messages, table format |
804
- | `context-loading-protocol.md` | WHY explanations, removed "CRITICAL" warnings |
805
- | `flags-updater.md` | Best practices table, removed "Step 3 CANNOT be skipped" |
806
- | `document-loader.md` | Table format for DO/DON'T sections |
807
- | `detailed-guides/agent-system.md` | Compact table format, shared file references |
808
-
809
- **Commands:**
810
- | File | Changes |
811
- |------|---------|
812
- | `cdev.md` | WHY context for best practices, softer tone |
813
- | `csetup.md` | Best Practices / Anti-Patterns format |
814
- | `pageplan.md` | "Guidelines" instead of "CRITICAL Rules" |
815
- | `designsetup.md` | "Follow this format" instead of "EXACT format" |
816
-
817
- **Patterns (contexts/patterns/):**
818
- | File | Changes |
819
- |------|---------|
820
- | `validation-framework.md` | WHY explanations, removed "🚨" symbols |
821
- | `error-recovery.md` | "⚠️" instead of "🚨", professional escalation format |
822
- | `ui-component-consistency.md` | "Common Issues" instead of "Red Flags" |
823
- | `task-breakdown.md` | Positive framing for incremental approach |
824
- | `agent-discovery.md` | Softer language, "⚠️ Fallback" instead of "🚨" |
825
- | `code-standards.md` | "File Creation Policy" with WHY table |
826
- | `animation-patterns.md` | "⚠️ Common Mistakes" instead of "🚨" |
827
- | `frontend-component-strategy.md` | "⚠️ Anti-Patterns" instead of "🚨" |
828
- | `performance-optimization.md` | "⚠️ Common Mistakes" instead of "🚨" |
829
- | `change-workflow.md` | Table format for read-only files |
830
- | `task-classification.md` | "Agent Capabilities Reference" section title |
831
-
832
- **Design (contexts/design/):**
833
- | File | Changes |
834
- |------|---------|
835
- | `index.md` | "should check" instead of "MUST check" |
836
- | `box-thinking.md` | "⚠️ Common Mistakes" instead of "🚨" |
837
-
838
- **Templates:**
839
- | File | Changes |
840
- |------|---------|
841
- | `phases-sections/frontend-mockup.md` | Table with WHY for design rules |
842
- | `design-context-template.md` | "⚠️ Design Rules" instead of "🚨 Critical" |
843
- | `STYLE_GUIDE.template.md` | "🔧 Troubleshooting" instead of "🚨" |
844
-
845
- **Other lib files:**
846
- | File | Changes |
847
- |------|---------|
848
- | `lib/README.md` | Softer descriptions, "📌 Important" |
849
- | `detailed-guides/taskmaster-analysis.md` | "🔴 HIGH" instead of "🚨 HIGH" |
313
+ | v3.2.0 | Consolidated Pre-Work Context (single `pre-work-context.md` for agents) |
314
+ | v3.1.1 | Direct Best Practices Execution (Step 2.7 rewritten, no pseudocode) |
315
+ | v3.1.0 | TDD Classification + Development Principles Injection |
316
+ | v3.0.0 | Template-Free Architecture (AI-driven Task Analyzer v2.0) |
317
+ | v2.8.0 | Critical Flow Injection (auto-inject security/compliance items) |
318
+ | v2.7.0 | UX Testing Agent (persona-based, approval gate) |
319
+ | v2.5.0 | Smart Topic Query + Integration Risk Detection |
320
+ | v2.4.0 | Adaptive Depth Research (0-10+ dynamic layers) |
321
+ | v2.3.0 | Zero-Maintenance Tech Stack Detection |
322
+ | v2.2.0 | claude-mem Integration |
323
+ | v2.1.0 | Design System v2 (YAML-based) |
324
+ | v2.0.0 | Claude 4.5 Optimization (61% token reduction) |
850
325
 
851
326
  ---
852
327
 
853
- ## 📊 PROJECT_STATUS.yml Protocol (v2.1.0)
328
+ ## 📊 PROJECT_STATUS.yml Protocol (v2.2.0 - claude-mem Integration)
854
329
 
855
330
  **WHY this exists:** New Claude sessions lose context about infrastructure state, blockers, and priorities. This file provides a quick snapshot.
856
331
 
332
+ **v2.2.0 Changes (claude-mem integration):**
333
+ - **REMOVED:** `decisions`, `notes`, `future_ideas` → claude-mem handles automatically
334
+ - **KEPT:** `blockers`, `next_priorities`, `technical_debt` → requires human decision
335
+ - **Query past context:** Just ask naturally → mem-search skill auto-invoked
336
+
857
337
  ### Session Start Behavior
858
338
 
859
339
  If `PROJECT_STATUS.yml` exists in project root:
@@ -873,15 +353,13 @@ Prompt "Update PROJECT_STATUS.yml?" when detecting these patterns:
873
353
  | Infrastructure change (deploy, tunnel, DB migration) | Update `infrastructure` |
874
354
  | User discusses priority shift | Update `next_priorities` |
875
355
  | `/csetup {change-id}` started | Update `current_focus` + **check `pending_followups` for related items** |
876
- | **Future features/ideas:** "อยากให้มี...", "want to add...", "later we should...", "in the future..." | Add to `future_ideas` |
877
356
  | **Technical debt:** "ต้องแก้...", "should refactor...", "tech debt...", "needs cleanup..." | Add to `technical_debt` |
878
- | **Decisions made:** "ตัดสินใจว่า...", "we decided...", "going with...", "chose X over Y" | Add to `decisions` |
879
- | **Learnings/notes:** "พบว่า...", "discovered...", "note:...", "important:..." | Add to `notes` |
880
357
  | **Problems found (by Claude):** "⚠️ ปัญหาที่พบ", "ไม่มี X", "missing X", "not configured" | Add to `technical_debt` or `blockers` |
881
358
  | **Config gaps:** "ไม่ได้ตั้งค่า...", "need to configure...", "should add to CI/CD" | Add to `technical_debt` |
882
359
  | **Sync issues:** "DB not synced", "schema mismatch", "local vs production differs" | Add to `blockers` + `infrastructure` |
883
360
  | **Non-Goal needs follow-up:** design.md has "Non-Goal: X (separate proposal)" | Add to `pending_followups` when archiving |
884
361
  | **Pending resolved:** User creates proposal for pending item | Remove from `pending_followups` |
362
+ | ~~**Future ideas, Decisions, Notes**~~ | **REMOVED** - claude-mem handles automatically |
885
363
 
886
364
  ### Update Protocol
887
365
 
@@ -906,68 +384,105 @@ Claude: "Update PROJECT_STATUS.yml?
906
384
  # After archiving
907
385
  Claude: "Auth-system archived. Add to completed_changes?"
908
386
 
909
- # Casual conversation - future idea
910
- User: "อยากให้มี dark mode ด้วยนะ ไว้ทำทีหลัง"
911
- Claude: "Add to PROJECT_STATUS.yml future_ideas?
912
- - idea: Dark mode support
913
- - context: User requested, low priority"
914
-
915
- # Discussion - technical debt
387
+ # Discussion - technical debt (still tracked in PROJECT_STATUS)
916
388
  User: "ตรงนี้ code มันซ้ำๆ ต้องแก้ทีหลัง"
917
389
  Claude: "Add to PROJECT_STATUS.yml technical_debt?
918
390
  - item: Refactor duplicated code in auth middleware
919
391
  - priority: medium"
920
392
 
921
- # Decision made
922
- User: "ตัดสินใจใช้ Drizzle แทน Prisma แล้ว เพราะ type-safe กว่า"
923
- Claude: "Add to PROJECT_STATUS.yml decisions?
924
- - decision: Use Drizzle over Prisma
925
- - reason: Better type safety"
926
-
927
393
  # Problem found by Claude during analysis
928
394
  Claude: "⚠️ ปัญหาที่พบ: ไม่มี migration step ใน CI/CD!"
929
395
  Claude: "Add to PROJECT_STATUS.yml?
930
396
  technical_debt:
931
397
  - item: Add DB migration to CI/CD
932
- - reason: Schema not synced between local and VPS
933
398
  - priority: high"
934
399
 
935
- # Config gap discovered
936
- Claude: "Local DB กับ VPS schema ไม่ sync กัน"
937
- Claude: "Add to PROJECT_STATUS.yml?
938
- blockers:
939
- - id: db-schema-sync
940
- - description: Local and VPS DB schemas out of sync
941
- infrastructure.database:
942
- - status: degraded
943
- - notes: Schema mismatch, need migration"
944
-
945
- # Archive with Non-Goals that need follow-up
946
- Claude: "Archiving add-infrastructure-cicd..."
947
- Claude: *reads design.md, finds Non-Goals: "Database migrations (separate proposal)"*
948
- Claude: "Add to PROJECT_STATUS.yml pending_followups?
949
- - item: Database migration strategy
950
- - from_change: add-infrastructure-cicd
951
- - reason: Non-Goal marked 'separate proposal'
952
- - affects: ['any change with DB schema']"
953
-
954
- # /csetup checks pending_followups (Medium aggressiveness)
400
+ # Query past decisions (claude-mem handles this now!)
401
+ User: "เราตัดสินใจเรื่อง database ว่ายังไงมาก่อน?"
402
+ Claude: *auto-invokes mem-search skill*
403
+ Claude: "จากการค้นหา พบ 2 decisions เกี่ยวกับ database:
404
+ - #12345: Chose Drizzle over Prisma (3 days ago)
405
+ - #12340: PostgreSQL over MongoDB (1 week ago)"
406
+
407
+ # Query past learnings (claude-mem handles this now!)
408
+ User: "เราเคยเจอ bug เกี่ยวกับ auth ไหม?"
409
+ Claude: *auto-invokes mem-search skill*
410
+ Claude: "พบ 1 bugfix เกี่ยวกับ auth:
411
+ - #12330: Fixed token refresh race condition"
412
+
413
+ # /csetup checks pending_followups
955
414
  User: "/csetup add-auth-system"
956
415
  Claude: *reads PROJECT_STATUS.yml pending_followups*
957
416
  Claude: "⚠️ Found related pending follow-up:
958
417
  - 'Database migration strategy' (from add-infrastructure-cicd)
959
- - Affects: 'any change with DB schema'
960
-
961
- This change adds DB tables. The migration strategy hasn't been addressed yet.
962
418
 
963
419
  Options:
964
420
  1. Continue anyway (risk: schema sync issues)
965
- 2. Address migration first (create proposal)
966
- 3. Add migration step to this change's scope
421
+ 2. Address migration first
422
+ 3. Add migration step to this change's scope"
423
+ ```
424
+
425
+ ---
967
426
 
968
- Which approach?"
427
+ ## 🧠 claude-mem Integration (v2.2.0)
428
+
429
+ **What is claude-mem?** A Claude Code plugin that automatically captures tool usage observations and provides persistent memory across sessions.
430
+
431
+ ### Division of Responsibilities
432
+
433
+ | Data Type | Source | How to Access |
434
+ |-----------|--------|---------------|
435
+ | Past decisions | claude-mem (auto) | Ask: "what decisions about X?" |
436
+ | Past learnings | claude-mem (auto) | Ask: "what did we learn about X?" |
437
+ | Past bugs/fixes | claude-mem (auto) | Ask: "what bugs with X?" |
438
+ | Future ideas | claude-mem (auto) | Ask: "what ideas for X?" |
439
+ | **Blockers** | PROJECT_STATUS.yml | Read file (requires human decision) |
440
+ | **Priorities** | PROJECT_STATUS.yml | Read file (requires human decision) |
441
+ | **Tech debt** | PROJECT_STATUS.yml | Read file (actionable items) |
442
+ | What to build | tasks.md → phases.md | /csetup generates |
443
+ | How to build | Agents | /cdev executes |
444
+
445
+ ### How claude-mem Works
446
+
447
+ ```
448
+ 1. You work normally (Read, Write, Edit, Bash, etc.)
449
+ → claude-mem captures tool usage automatically
450
+
451
+ 2. Session ends (/clear or exit)
452
+ → claude-mem generates session summary
453
+
454
+ 3. New session starts
455
+ → claude-mem injects recent observations
456
+
457
+ 4. You ask about past work
458
+ → mem-search skill auto-invoked
969
459
  ```
970
460
 
461
+ ### Query Examples
462
+
463
+ ```
464
+ # Query past decisions
465
+ "เราตัดสินใจเรื่อง authentication ยังไง?"
466
+ → Claude auto-invokes mem-search → shows past decisions
467
+
468
+ # Query past bugs
469
+ "เราเคยแก้ bug เกี่ยวกับ token ไหม?"
470
+ → Claude shows past bugfixes
471
+
472
+ # Query implementation details
473
+ "เราทำ pagination ยังไง?"
474
+ → Claude shows past implementation observations
475
+ ```
476
+
477
+ ### Agent Memory Access
478
+
479
+ Agents query claude-mem in STEP 0 before implementation:
480
+ - Check for past decisions about similar components
481
+ - Find previous solutions to similar problems
482
+ - Avoid repeating past mistakes
483
+
484
+ → See: `.claude/agents/_shared/pre-work-checklist.md` Step 0.6
485
+
971
486
  ---
972
487
 
973
488
  **💡 Remember:** This template is universal. Use Context7 for framework-specific docs!