@champpaba/claude-agent-kit 1.8.0 → 2.0.1

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 (43) hide show
  1. package/.claude/CLAUDE.md +189 -39
  2. package/.claude/agents/01-integration.md +106 -552
  3. package/.claude/agents/02-uxui-frontend.md +188 -850
  4. package/.claude/agents/03-test-debug.md +152 -521
  5. package/.claude/agents/04-frontend.md +169 -549
  6. package/.claude/agents/05-backend.md +132 -661
  7. package/.claude/agents/06-database.md +149 -698
  8. package/.claude/agents/_shared/README.md +57 -0
  9. package/.claude/agents/_shared/agent-boundaries.md +64 -0
  10. package/.claude/agents/_shared/documentation-policy.md +47 -0
  11. package/.claude/agents/_shared/package-manager.md +59 -0
  12. package/.claude/agents/_shared/pre-work-checklist.md +57 -0
  13. package/.claude/commands/cdev.md +36 -61
  14. package/.claude/commands/csetup.md +101 -39
  15. package/.claude/commands/designsetup.md +1402 -337
  16. package/.claude/commands/extract.md +520 -245
  17. package/.claude/commands/pageplan.md +6 -6
  18. package/.claude/contexts/design/box-thinking.md +1 -1
  19. package/.claude/contexts/design/index.md +1 -1
  20. package/.claude/contexts/patterns/agent-discovery.md +2 -2
  21. package/.claude/contexts/patterns/animation-patterns.md +1 -1
  22. package/.claude/contexts/patterns/change-workflow.md +8 -5
  23. package/.claude/contexts/patterns/code-standards.md +10 -8
  24. package/.claude/contexts/patterns/error-recovery.md +4 -4
  25. package/.claude/contexts/patterns/frontend-component-strategy.md +1 -1
  26. package/.claude/contexts/patterns/performance-optimization.md +1 -1
  27. package/.claude/contexts/patterns/task-breakdown.md +2 -2
  28. package/.claude/contexts/patterns/task-classification.md +2 -2
  29. package/.claude/contexts/patterns/ui-component-consistency.md +3 -3
  30. package/.claude/contexts/patterns/validation-framework.md +36 -33
  31. package/.claude/lib/README.md +4 -4
  32. package/.claude/lib/agent-executor.md +31 -40
  33. package/.claude/lib/agent-router.md +91 -213
  34. package/.claude/lib/context-loading-protocol.md +19 -36
  35. package/.claude/lib/detailed-guides/agent-system.md +43 -121
  36. package/.claude/lib/detailed-guides/taskmaster-analysis.md +1 -1
  37. package/.claude/lib/document-loader.md +22 -25
  38. package/.claude/lib/flags-updater.md +24 -32
  39. package/.claude/templates/STYLE_GUIDE.template.md +1 -1
  40. package/.claude/templates/design-context-template.md +1 -1
  41. package/.claude/templates/phases-sections/frontend-mockup.md +8 -5
  42. package/README.md +99 -40
  43. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ # Shared Agent Components
2
+
3
+ > **Version:** 2.0.0 (Claude 4.5 Optimized)
4
+ > **Purpose:** Single source of truth for content shared across all 6 agents
5
+
6
+ ---
7
+
8
+ ## Why This Exists
9
+
10
+ **Before v2.0.0:**
11
+ - Same content duplicated 6 times (once per agent)
12
+ - ~3,000 tokens wasted on duplication
13
+ - Updates required changing 6 files
14
+
15
+ **After v2.0.0:**
16
+ - Shared content in `_shared/` folder
17
+ - Agents reference with 1-line link
18
+ - ~2,500 tokens saved (83% reduction)
19
+ - Updates require changing 1 file
20
+
21
+ ---
22
+
23
+ ## Files in This Folder
24
+
25
+ | File | Purpose | Token Savings |
26
+ |------|---------|---------------|
27
+ | `pre-work-checklist.md` | Validation before implementation | ~200 tokens × 6 |
28
+ | `package-manager.md` | Package manager protocol | ~100 tokens × 6 |
29
+ | `documentation-policy.md` | What files agents can create | ~70 tokens × 6 |
30
+ | `agent-boundaries.md` | When to use which agent | ~80 tokens × 6 |
31
+
32
+ ---
33
+
34
+ ## How Agents Reference
35
+
36
+ Instead of duplicating content, agents use:
37
+
38
+ ```markdown
39
+ ## Pre-Work Checklist
40
+ → See `.claude/agents/_shared/pre-work-checklist.md`
41
+ ```
42
+
43
+ This approach:
44
+ - Saves tokens (1 line vs 30 lines)
45
+ - Ensures consistency (single source of truth)
46
+ - Simplifies maintenance (update once)
47
+
48
+ ---
49
+
50
+ ## Claude 4.5 Optimization Notes
51
+
52
+ These files follow Claude 4.5 best practices:
53
+
54
+ 1. **Professional tone** - No aggressive CAPS or threats
55
+ 2. **Positive instructions** - "Use X" instead of "Don't use Y"
56
+ 3. **WHY context** - Each rule explains its purpose
57
+ 4. **Concise format** - Tables and bullet points, not prose
@@ -0,0 +1,64 @@
1
+ # Agent Boundaries (Shared Reference)
2
+
3
+ > **Purpose:** Clear boundaries prevent agents from doing wrong work
4
+
5
+ ---
6
+
7
+ ## Why Boundaries Matter
8
+
9
+ Without clear boundaries:
10
+ - Agents overlap work (duplicate effort)
11
+ - Wrong agent does wrong task (quality drops)
12
+ - Integration issues (mismatched interfaces)
13
+
14
+ With clear boundaries:
15
+ - Each agent focuses on specialty
16
+ - Clean handoffs between phases
17
+ - Higher quality output
18
+
19
+ ---
20
+
21
+ ## Agent Routing Quick Reference
22
+
23
+ | Task Type | Use Agent | Phase |
24
+ |-----------|-----------|-------|
25
+ | UI components (mock data) | uxui-frontend | 1 |
26
+ | API endpoints | backend | 2 |
27
+ | Database schemas/migrations | database | 2 |
28
+ | Contract validation | integration | 2.5 |
29
+ | Connect UI to API | frontend | 3 |
30
+ | Tests, bugs, debugging | test-debug | 1,3,4 |
31
+
32
+ ---
33
+
34
+ ## Boundary Violations to Avoid
35
+
36
+ **uxui-frontend:**
37
+ - Uses mock data with setTimeout
38
+ - Connect to real APIs → use frontend agent instead
39
+
40
+ **frontend:**
41
+ - Connects existing UI to real APIs
42
+ - Create new UI from scratch → use uxui-frontend instead
43
+
44
+ **backend:**
45
+ - Creates API endpoints with validation
46
+ - Write database queries directly → use database agent instead
47
+
48
+ **database:**
49
+ - Creates schemas, migrations, typed queries
50
+ - Write API logic → use backend agent instead
51
+
52
+ ---
53
+
54
+ ## Why Agent Specialization Works
55
+
56
+ Each agent has deep context for its domain:
57
+ - uxui-frontend: Design patterns, accessibility, visual consistency
58
+ - backend: Security patterns, validation, error handling
59
+ - database: Query optimization, indexes, relationships
60
+ - integration: Contract validation, type safety
61
+ - frontend: State management, API integration, error UI
62
+ - test-debug: Test patterns, debugging, coverage
63
+
64
+ → Full routing rules: `.claude/lib/agent-router.md`
@@ -0,0 +1,47 @@
1
+ # Documentation Policy v1.8.0 (Shared by All Agents)
2
+
3
+ > **Purpose:** Single source of truth for what files agents create
4
+
5
+ ---
6
+
7
+ ## Core Principle
8
+
9
+ Agents create **code files only**. Results go to terminal output.
10
+
11
+ ---
12
+
13
+ ## Allowed Files
14
+
15
+ - Source code (`.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, etc.)
16
+ - Config files (`package.json`, `tsconfig.json`, `.env.example`)
17
+ - Schema files (`schema.prisma`, `models.py`)
18
+ - Test files (`*.test.ts`, `*.spec.ts`, `test_*.py`)
19
+ - Style files (`.css`, `.scss`, `tailwind.config.js`)
20
+
21
+ ---
22
+
23
+ ## Forbidden Files (Auto-Deleted)
24
+
25
+ These files waste tokens and clutter the project:
26
+
27
+ | Pattern | Example | Why Forbidden |
28
+ |---------|---------|---------------|
29
+ | `*_REPORT.md` | `IMPLEMENTATION_REPORT.md` | Use terminal output |
30
+ | `*_SUMMARY.txt` | `PHASE_SUMMARY.txt` | Use terminal output |
31
+ | `PHASE_*.txt` | `PHASE_11_DELIVERY.txt` | Removed in v1.8.0 |
32
+ | ALL_CAPS filenames | `README_FINAL.md` | Usually temp files |
33
+
34
+ ---
35
+
36
+ ## Rule of Thumb
37
+
38
+ > If it wouldn't be committed to git, don't create it.
39
+
40
+ ---
41
+
42
+ ## Why This Matters
43
+
44
+ Token optimization:
45
+ - Report files waste 500-2000 tokens each
46
+ - v1.8.0 removed doc/report phases for 25 min savings
47
+ - Terminal output is sufficient for status updates
@@ -0,0 +1,59 @@
1
+ # Package Manager Protocol (Shared by All Agents)
2
+
3
+ > **Version:** 2.0.0 (Claude 4.5 Optimized)
4
+ > **Purpose:** Single source of truth for package manager usage
5
+
6
+ ---
7
+
8
+ ## Quick Rule
9
+
10
+ Read `tech-stack.md` before ALL install/run commands.
11
+
12
+ ```bash
13
+ # Location:
14
+ .claude/contexts/domain/{project}/tech-stack.md
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Why This Matters
20
+
21
+ Using wrong package manager causes:
22
+ - Duplicate lock files (package-lock.json + pnpm-lock.yaml)
23
+ - CI/CD pipeline failures
24
+ - Version conflicts
25
+ - Incorrect dependency locations
26
+
27
+ ---
28
+
29
+ ## Protocol
30
+
31
+ **Step 1:** Read tech-stack.md
32
+
33
+ **Step 2:** Extract and use detected tool
34
+
35
+ | If Detected | Install Command | Run Command |
36
+ |-------------|-----------------|-------------|
37
+ | pnpm | `pnpm install {pkg}` | `pnpm run {script}` |
38
+ | npm | `npm install {pkg}` | `npm run {script}` |
39
+ | bun | `bun add {pkg}` | `bun run {script}` |
40
+ | uv | `uv pip install {pkg}` | `uv run {script}` |
41
+ | poetry | `poetry add {pkg}` | `poetry run {cmd}` |
42
+
43
+ **Step 3:** Report in validation
44
+
45
+ ```
46
+ Package Manager: pnpm (from tech-stack.md)
47
+ ```
48
+
49
+ ---
50
+
51
+ ## If tech-stack.md Missing
52
+
53
+ ```
54
+ Warning: tech-stack.md not found
55
+ Suggestion: Run /csetup to generate tech-stack.md
56
+ Fallback: Detect from package.json or pyproject.toml
57
+ ```
58
+
59
+ → Full details: `.claude/lib/context-loading-protocol.md#level-0`
@@ -0,0 +1,57 @@
1
+ # Pre-Work Checklist (Shared by All Agents)
2
+
3
+ > **Version:** 2.0.0 (Claude 4.5 Optimized)
4
+ > **Purpose:** Single source of truth for pre-work validation
5
+
6
+ ---
7
+
8
+ ## Pre-Work Steps
9
+
10
+ Complete these steps before implementation to ensure alignment with project standards:
11
+
12
+ 1. **Context Discovery** - Load project context via agent-discovery.md
13
+ 2. **Pattern Loading** - Load relevant patterns for your agent type
14
+ 3. **Validation Report** - Provide pre-implementation validation report
15
+ 4. **Wait for Approval** - Proceed only after orchestrator validation
16
+
17
+ → Details: `.claude/contexts/patterns/validation-framework.md` (agent-specific sections)
18
+
19
+ ---
20
+
21
+ ## Validation Report Template
22
+
23
+ ```markdown
24
+ Pre-Implementation Validation
25
+
26
+ Project Context:
27
+ - Project: {name}
28
+ - Stack: {tech-stack}
29
+ - Package Manager: {pm} (from tech-stack.md)
30
+
31
+ Patterns Loaded:
32
+ - [ ] error-handling.md
33
+ - [ ] logging.md
34
+ - [ ] testing.md
35
+ - [ ] code-standards.md
36
+ - [ ] {agent-specific patterns}
37
+
38
+ Best Practices:
39
+ - [ ] {framework} best practices loaded (from Context7)
40
+
41
+ Ready to Implement:
42
+ - [ ] Task understood
43
+ - [ ] Dependencies identified
44
+ - [ ] Approach planned
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Why This Matters
50
+
51
+ Pre-work validation prevents:
52
+ - Misaligned implementations (wrong patterns, wrong style)
53
+ - Duplicate components (not searching existing code first)
54
+ - Wrong package manager usage (CI/CD breaks)
55
+ - Missing best practices (outdated patterns)
56
+
57
+ → 80% of implementation issues caught at validation stage
@@ -108,7 +108,7 @@ ${changeContext.tasks}
108
108
  ${phase.instructions}
109
109
  `
110
110
 
111
- // 🆕 v1.8.0: Add best-practices reference for ALL agents
111
+ // Add best-practices reference for ALL agents
112
112
  const bpDir = '.claude/contexts/domain/project/best-practices/'
113
113
  if (fileExists(bpDir)) {
114
114
  const bpFiles = listFiles(bpDir).filter(f => f.endsWith('.md') && f !== 'index.md')
@@ -133,24 +133,19 @@ ${phase.instructions}
133
133
 
134
134
  ---
135
135
 
136
- ## 📚 Best Practices (MANDATORY - STEP 0)
136
+ ## 📚 Best Practices (STEP 0)
137
137
 
138
- **YOU MUST READ these files before writing ANY code:**
138
+ Read these files before implementation for quality output:
139
139
 
140
- ${relevantFiles.map(f => `
141
- ### ${f.replace('.md', '')}
142
- \`\`\`
143
- Read: ${bpDir}${f}
144
- \`\`\`
145
- `).join('')}
140
+ ${relevantFiles.map(f => `- Read: ${bpDir}${f}`).join('\n')}
146
141
 
147
- **After reading, REPORT:**
142
+ **Report format:**
148
143
  \`\`\`
149
144
  ✅ Best Practices Loaded
150
145
  ${relevantFiles.map(f => `- ${f.replace('.md', '')} ✓`).join('\n ')}
151
146
  \`\`\`
152
147
 
153
- **If you skip this, your work will be REJECTED!**
148
+ WHY: Best practices ensure consistency with project patterns.
154
149
 
155
150
  ---
156
151
  `
@@ -169,45 +164,29 @@ Read: ${bpDir}${f}
169
164
 
170
165
  ---
171
166
 
172
- ## 🎨 Design System (MANDATORY Reading - STEP 0.5)
173
-
174
- **Required Files (YOU MUST READ in STEP 0.5):**
175
-
176
- ${hasTokens ? `
177
- 1. **STYLE_TOKENS.json** (~500 tokens) REQUIRED
178
- \`\`\`
179
- Read: design-system/STYLE_TOKENS.json
180
- \`\`\`
181
- Contains: Colors, spacing, typography, shadows, borders, animations
182
- ` : ''}
183
-
184
- ${hasStyleGuide ? `
185
- 2. **STYLE_GUIDE.md** (selective sections ~2K tokens) 📖 OPTIONAL
186
- \`\`\`
187
- Read: design-system/STYLE_GUIDE.md
188
- \`\`\`
189
- Load only sections you need:
190
- - Section 6: Component Styles
191
- - Section 15: Layout Patterns
192
- - Section 16: Example Component Reference
193
- ` : ''}
194
-
195
- **Critical Rules:**
196
- - ❌ **NO** hardcoded colors: \`text-gray-500\`, \`#64748b\`
197
- - ✅ **USE** theme tokens: \`text-foreground/70\`, \`bg-muted\`
198
- - ❌ **NO** arbitrary spacing: \`p-5\`, \`gap-7\`
199
- - ✅ **USE** spacing scale: \`p-4\`, \`p-6\`, \`gap-8\`
200
- - ❌ **NO** inconsistent shadows: mixing \`shadow-sm\` and \`shadow-lg\`
201
- - ✅ **USE** consistent patterns: all cards use \`shadow-md\`
202
-
203
- **YOU MUST REPORT:**
167
+ ## 🎨 Design System (STEP 0.5)
168
+
169
+ **Files to read:**
170
+
171
+ ${hasTokens ? `- design-system/STYLE_TOKENS.json (~500 tokens) - Colors, spacing, typography` : ''}
172
+ ${hasStyleGuide ? `- design-system/STYLE_GUIDE.md (selective sections) - Component Styles, Layout Patterns` : ''}
173
+
174
+ **Style Guidelines:**
175
+
176
+ | Instead of | Use | WHY |
177
+ |------------|-----|-----|
178
+ | text-gray-500, #64748b | text-foreground/70, bg-muted | Theme-aware |
179
+ | p-5, gap-7 | p-4, p-6, gap-8 | Spacing scale |
180
+ | mixing shadow-sm/lg | consistent shadow-md | Visual consistency |
181
+
182
+ **Report format:**
204
183
  \`\`\`
205
184
  ✅ Design System Loaded
206
185
  - STYLE_TOKENS.json ✓
207
186
  - Design Tokens Extracted: [list key tokens]
208
187
  \`\`\`
209
188
 
210
- If you skip this, your work will be REJECTED!
189
+ WHY: Design tokens ensure visual consistency across components.
211
190
 
212
191
  ---
213
192
  `
@@ -404,16 +383,18 @@ if (phase.agent === 'uxui-frontend' && hasPagePlan) {
404
383
 
405
384
  ---
406
385
 
407
- ### Step 5: Post-Execution (🆕 MANDATORY FLAGS UPDATE)
386
+ ### Step 5: Post-Execution (Flags Update)
387
+
388
+ **Main Claude updates flags.json after each phase completion.**
408
389
 
409
- **⚠️ CRITICAL: Main Claude MUST update flags.json after EVERY phase completion**
390
+ See: `.claude/lib/flags-updater.md` for complete protocol
410
391
 
411
- See: `.claude/lib/flags-updater.md` for complete protocol
392
+ WHY: Immediate updates ensure /cstatus shows accurate progress.
412
393
 
413
- **Execution Order (MUST follow this sequence):**
394
+ **Execution Order:**
414
395
 
415
396
  ```typescript
416
- // 1. MANDATORY: Update flags.json
397
+ // 1. Update flags.json
417
398
  output(`\n🔄 Updating progress tracking...`)
418
399
 
419
400
  // See flags-updater.md for updateFlagsAfterPhase() implementation
@@ -516,19 +497,13 @@ if (flags.ready_to_archive) {
516
497
  }
517
498
  ```
518
499
 
519
- **Rules:**
520
- - Main Claude updates flags.json (NOT sub-agent)
521
- - Update happens IMMEDIATELY after sub-agent responds successfully
522
- - Update happens BEFORE asking user to continue
523
- - ✅ Progress is reported to user after EVERY update
524
- - ✅ No exceptions - even if agent "says" it updated flags
500
+ **Key points:**
501
+ - Main Claude updates flags.json (sub-agents don't have access)
502
+ - Update happens immediately after sub-agent responds
503
+ - Update happens before asking user to continue
525
504
 
526
- **Common Mistake:**
527
- ```typescript
528
- ❌ WRONG:
529
- Agent completes → Ask user to continue → (flags.json never updated)
530
-
531
- ✅ CORRECT:
505
+ **Correct flow:**
506
+ ```
532
507
  Agent completes → Update flags.json → Report progress → Ask user to continue
533
508
  ```
534
509
 
@@ -44,23 +44,54 @@ Read in order:
44
44
 
45
45
  ---
46
46
 
47
- ### Step 2.5: Validate Design System (Context Optimization v1.2.0)
47
+ ### Step 2.5: Validate Design System & Page Plan (v2.0.0)
48
48
 
49
- > **New:** Validate design files exist for UI work
49
+ > **Updated v2.0.0:** Validate design files + read page-plan.md if exists
50
50
 
51
51
  ```typescript
52
52
  // Detect if change involves UI/frontend work
53
53
  const tasksContent = Read('openspec/changes/{change-id}/tasks.md')
54
54
  const hasFrontend = tasksContent.toLowerCase().match(/(ui|component|page|frontend|design|responsive)/i)
55
55
 
56
+ let tokens = null
57
+ let pagePlan = null
58
+ let pageType = 'generic'
59
+
56
60
  if (hasFrontend) {
57
61
  output(`\n🎨 UI work detected - validating design system...`)
58
62
 
59
- const tokensPath = 'design-system/STYLE_TOKENS.json'
63
+ const tokensPath = 'design-system/tokens.json' // v2.0 tokens
60
64
  const styleGuidePath = 'design-system/STYLE_GUIDE.md'
65
+ const pagePlanPath = `openspec/changes/${changeId}/page-plan.md`
61
66
 
62
67
  const hasTokens = fileExists(tokensPath)
63
68
  const hasStyleGuide = fileExists(styleGuidePath)
69
+ const hasPagePlan = fileExists(pagePlanPath)
70
+
71
+ // ========== LOAD tokens.json (v2.0 structure) ==========
72
+ if (hasTokens) {
73
+ tokens = JSON.parse(Read(tokensPath))
74
+ output(`✅ tokens.json Loaded:`)
75
+ output(` - Style: ${tokens.style.name}`)
76
+ output(` - Theme: ${tokens.theme.name}`)
77
+ output(` - Animations: ${tokens.animations.enabled ? 'Enabled' : 'Disabled'}`)
78
+ }
79
+
80
+ // ========== LOAD page-plan.md (if exists) ==========
81
+ if (hasPagePlan) {
82
+ pagePlan = Read(pagePlanPath)
83
+ output(`✅ page-plan.md Found`)
84
+
85
+ // Extract page type from page-plan.md
86
+ const pageTypeMatch = pagePlan.match(/Page Type:\*\*\s*(.*)/i)
87
+ if (pageTypeMatch) {
88
+ pageType = pageTypeMatch[1].trim().toLowerCase()
89
+ output(` - Page Type: ${pageType}`)
90
+ }
91
+ } else {
92
+ output(`ℹ️ page-plan.md not found (optional)`)
93
+ output(` → Run /pageplan first for better component planning`)
94
+ }
64
95
 
65
96
  if (!hasTokens || !hasStyleGuide) {
66
97
  warn(`
@@ -68,7 +99,8 @@ if (hasFrontend) {
68
99
 
69
100
  Found:
70
101
  ${hasStyleGuide ? '✅' : '❌'} STYLE_GUIDE.md
71
- ${hasTokens ? '✅' : '❌'} STYLE_TOKENS.json
102
+ ${hasTokens ? '✅' : '❌'} tokens.json
103
+ ${hasPagePlan ? '✅' : '❌'} page-plan.md
72
104
 
73
105
  This may result in:
74
106
  - Inconsistent colors (random hex codes)
@@ -77,7 +109,8 @@ This may result in:
77
109
 
78
110
  Recommendation:
79
111
  1. Run: /designsetup
80
- 2. Then: /csetup ${changeId}
112
+ 2. Run: /pageplan @prd.md (optional but recommended)
113
+ 3. Then: /csetup ${changeId}
81
114
 
82
115
  Continue anyway? (yes/no)
83
116
  `)
@@ -89,7 +122,8 @@ Continue anyway? (yes/no)
89
122
  } else {
90
123
  output(`✅ Design System Ready`)
91
124
  output(` - STYLE_GUIDE.md ✓`)
92
- output(` - STYLE_TOKENS.json ✓`)
125
+ output(` - tokens.json ✓`)
126
+ if (hasPagePlan) output(` - page-plan.md ✓`)
93
127
  }
94
128
  }
95
129
  ```
@@ -276,13 +310,13 @@ function generateBestPracticesFile(tech: string, context7Docs: string): string {
276
310
 
277
311
  ---
278
312
 
279
- ## ✅ DO (Best Practices)
313
+ ## Best Practices
280
314
 
281
315
  ${extractDos(context7Docs)}
282
316
 
283
317
  ---
284
318
 
285
- ## ❌ DON'T (Anti-Patterns)
319
+ ## Anti-Patterns to Avoid
286
320
 
287
321
  ${extractDonts(context7Docs)}
288
322
 
@@ -295,7 +329,7 @@ ${extractChecklist(context7Docs)}
295
329
 
296
330
  ---
297
331
 
298
- **⚠️ Agents MUST read this file before writing ${tech} code!**
332
+ **Agents read this file in STEP 0 before implementation.**
299
333
  `
300
334
  }
301
335
  ```
@@ -453,7 +487,7 @@ const taskAnalysis = {
453
487
  🟢 LOW: 1 task (Documentation)
454
488
 
455
489
  ⚠️ Risk Assessment:
456
- 🚨 HIGH risk: 2 tasks (Payment integration, Auth system)
490
+ 🔴 HIGH risk: 2 tasks (Payment integration, Auth system)
457
491
  → Mitigation: TDD required, security checklist
458
492
  ⚠️ MEDIUM risk: 3 tasks
459
493
  ✅ LOW risk: 3 tasks
@@ -593,7 +627,7 @@ const allPhases = [...researchPhases, ...phaseSections]
593
627
  - 🟢 LOW: {taskAnalysis.summary.priority.low}
594
628
 
595
629
  **Risk Assessment:**
596
- - 🚨 HIGH risk: {taskAnalysis.summary.risk.high} tasks
630
+ - 🔴 HIGH risk: {taskAnalysis.summary.risk.high} tasks
597
631
  - ⚠️ MEDIUM risk: {taskAnalysis.summary.risk.medium} tasks
598
632
  - ✅ LOW risk: {taskAnalysis.summary.risk.low} tasks
599
633
 
@@ -799,39 +833,67 @@ const projectTech = Read('.claude/contexts/domain/project/tech-stack.md')
799
833
  // Detect additional tech from proposal/tasks
800
834
  const additionalTech = detectAdditionalTech(proposalContent, tasksContent)
801
835
 
802
- // 🆕 Load design info (if UI work)
836
+ // 🆕 Load design info (if UI work) - v2.0.0
803
837
  let designInfo = ''
804
- if (hasFrontend) {
805
- const tokensPath = 'design-system/STYLE_TOKENS.json'
806
-
807
- if (fileExists(tokensPath)) {
808
- const tokens = JSON.parse(Read(tokensPath))
809
-
810
- designInfo = `
811
- ## 🎨 Design System (Context Optimization v1.2.0)
812
-
813
- **Design Files (Token-Efficient):**
814
- - STYLE_TOKENS.json: \`design-system/STYLE_TOKENS.json\` (~500 tokens)
815
- - STYLE_GUIDE.md: \`design-system/STYLE_GUIDE.md\` (~5000 tokens, load selectively)
816
-
817
- **Key Design Tokens:**
818
- - Primary Color: ${tokens.tokens.colors.primary.DEFAULT}
838
+ if (hasFrontend && tokens) {
839
+ designInfo = `
840
+ ## 🎨 Design System (v2.0.0)
841
+
842
+ **Design Files:**
843
+ - tokens.json: \`design-system/tokens.json\` (~800 tokens)
844
+ - patterns/: \`design-system/patterns/*.md\` (selective loading)
845
+ - STYLE_GUIDE.md: \`design-system/STYLE_GUIDE.md\` (human-readable, ~150 lines)
846
+ ${pagePlan ? `- page-plan.md: \`openspec/changes/${changeId}/page-plan.md\` ✅` : ''}
847
+
848
+ **Style Direction:**
849
+ - Style: ${tokens.style.name}
850
+ - Theme: ${tokens.theme.name}
851
+ - Feel: ${tokens.style.feel}
852
+
853
+ **Design Tokens:**
854
+ - Primary Color: ${tokens.colors.primary.DEFAULT}
819
855
  - Component Library: ${tokens.component_library.name}
820
- - Spacing Scale: ${tokens.tokens.spacing.scale.join(', ')}px
821
- - Shadows: ${Object.keys(tokens.tokens.shadows).slice(0, 5).join(', ')}
856
+ - Spacing Scale: ${tokens.spacing.scale.join(', ')}px
857
+ - Animations: ${tokens.animations.enabled ? 'Enabled' : 'Disabled'}
858
+
859
+ **Theme & Decorations:**
860
+ ${pageType.includes('landing') || pageType.includes('marketing') ? `
861
+ - Decorations: ✅ Enabled
862
+ - USE: ${tokens.theme.decorative_elements.use.slice(0, 3).join(', ')}
863
+ - AVOID: ${tokens.theme.decorative_elements.avoid.slice(0, 2).join(', ') || '(none)'}
864
+ - Scroll Animations: ✅ Enabled
865
+ ` : `
866
+ - Decorations: ❌ Disabled (${pageType} page)
867
+ - Scroll Animations: ❌ Disabled
868
+ `}
869
+
870
+ **Pattern Files to Load:**
871
+ ${pageType.includes('landing') || pageType.includes('marketing') ?
872
+ `- patterns/buttons.md ✅
873
+ - patterns/cards.md ✅
874
+ - patterns/scroll-animations.md ✅
875
+ - patterns/decorations.md ✅` :
876
+ pageType.includes('auth') ?
877
+ `- patterns/buttons.md ✅
878
+ - patterns/forms.md ✅` :
879
+ `- patterns/buttons.md ✅
880
+ - patterns/cards.md ✅
881
+ - patterns/forms.md ✅`}
822
882
 
823
883
  **Agent Loading (STEP 0.5 for uxui-frontend):**
824
- 1. Read: STYLE_TOKENS.json (~500 tokens)
825
- 2. Optional: STYLE_GUIDE.md (selective sections ~2K tokens)
826
- 3. Report: Design tokens extracted
827
-
828
- **Critical Rules:**
829
- - ❌ NO hardcoded colors (text-gray-500)
830
- - ✅ USE theme tokens (text-foreground/70)
831
- - NO arbitrary spacing (p-5)
832
- - ✅ USE spacing scale (p-4, p-6)
884
+ 1. Read: tokens.json (~800 tokens)
885
+ 2. Read: page-plan.md (if exists)
886
+ 3. Load patterns selectively based on page type
887
+ 4. Report: Design tokens + page type extracted
888
+
889
+ **Style Guidelines:**
890
+
891
+ | Instead of | Use | WHY |
892
+ |------------|-----|-----|
893
+ | text-gray-500 | text-foreground/70 | Theme-aware |
894
+ | p-5 | p-4 or p-6 | Spacing scale |
895
+ | ${pageType.includes('landing') ? '✅ Apply decorations from theme' : '❌ Skip decorations for this page type'} | | |
833
896
  `
834
- }
835
897
  }
836
898
 
837
899
  // Replace placeholders