@champpaba/claude-agent-kit 1.1.1 → 1.4.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.
- package/.claude/CLAUDE.md +52 -444
- package/.claude/agents/01-integration.md +47 -193
- package/.claude/agents/02-uxui-frontend.md +40 -186
- package/.claude/agents/03-test-debug.md +43 -186
- package/.claude/agents/04-frontend.md +50 -478
- package/.claude/agents/05-backend.md +49 -499
- package/.claude/agents/06-database.md +36 -188
- package/.claude/commands/cdev.md +86 -1
- package/.claude/commands/csetup.md +319 -6
- package/.claude/commands/designsetup.md +360 -29
- package/.claude/commands/pageplan.md +40 -10
- package/.claude/lib/README.md +46 -4
- package/.claude/lib/context-loading-protocol.md +462 -0
- package/.claude/lib/detailed-guides/agent-system.md +237 -0
- package/.claude/lib/detailed-guides/best-practices-system.md +150 -0
- package/.claude/lib/detailed-guides/context-optimization.md +118 -0
- package/.claude/lib/detailed-guides/design-system.md +98 -0
- package/.claude/lib/detailed-guides/page-planning.md +147 -0
- package/.claude/lib/detailed-guides/taskmaster-analysis.md +263 -0
- package/.claude/lib/document-loader.md +353 -0
- package/.claude/lib/handoff-protocol.md +665 -0
- package/.claude/lib/task-analyzer.md +694 -0
- package/.claude/lib/tdd-workflow.md +891 -0
- package/.claude/templates/design-context-template.md +220 -0
- package/README.md +191 -0
- package/package.json +1 -1
|
@@ -224,30 +224,6 @@ if (!contextAnalysis.has_context) {
|
|
|
224
224
|
|
|
225
225
|
## STEP 2: Style Direction Analysis (AI Pondering)
|
|
226
226
|
|
|
227
|
-
```javascript
|
|
228
|
-
const ponderingPrompt = `
|
|
229
|
-
You are a design systems architect creating style direction recommendations.
|
|
230
|
-
|
|
231
|
-
Extracted Sites Summary:
|
|
232
|
-
${Object.entries(extractedData).map(([site, data]) => `
|
|
233
|
-
## ${site}
|
|
234
|
-
- Style: ${data.sections.overview.style || 'Unknown'}
|
|
235
|
-
- Colors: ${data.sections.color_palette.primary.slice(0, 3).map(c => c.hex).join(', ')}
|
|
236
|
-
- Shadows: ${data.sections.shadows_elevation.values.slice(0, 2).join(', ')}
|
|
237
|
-
- Border Radius: ${data.sections.border_radius.values.slice(0, 3).join(', ')}
|
|
238
|
-
- Typography: ${data.sections.typography.fonts.slice(0, 2).join(', ')}
|
|
239
|
-
- Button Animation: ${Object.values(data.animations).find(a => a.type === 'button')?.description || 'N/A'}
|
|
240
|
-
- Card Animation: ${Object.values(data.animations).find(a => a.type === 'card')?.description || 'N/A'}
|
|
241
|
-
`).join('\n')}
|
|
242
|
-
|
|
243
|
-
Project Context:
|
|
244
|
-
- Product: ${contextAnalysis.product_type}
|
|
245
|
-
- Target Audience: ${contextAnalysis.target_audience.demographics} (tech-savvy: ${contextAnalysis.target_audience.tech_savvy})
|
|
246
|
-
- Brand Personality: ${contextAnalysis.brand_personality.join(', ')}
|
|
247
|
-
- Market Position: ${contextAnalysis.market_position || 'Not specified'}
|
|
248
|
-
|
|
249
|
-
Task: Generate 2-3 style direction options ranked by fit.
|
|
250
|
-
|
|
251
227
|
Instructions:
|
|
252
228
|
1. Wrap thinking in <pondering> tags
|
|
253
229
|
2. Consider:
|
|
@@ -400,6 +376,91 @@ Return only the YAML content.
|
|
|
400
376
|
|
|
401
377
|
---
|
|
402
378
|
|
|
379
|
+
## STEP 3.5: Quick User Input (🆕 v1.4.0)
|
|
380
|
+
|
|
381
|
+
> **NEW:** Ask user for quick feedback before presenting options
|
|
382
|
+
|
|
383
|
+
```javascript
|
|
384
|
+
output(`
|
|
385
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
386
|
+
📝 Quick Question
|
|
387
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
388
|
+
`)
|
|
389
|
+
|
|
390
|
+
const userFeedback = await AskUserQuestion({
|
|
391
|
+
questions: [{
|
|
392
|
+
question: "มีอะไรอยากปรับหรือเน้นเป็นพิเศษไหม? (optional)",
|
|
393
|
+
header: "Preferences",
|
|
394
|
+
multiSelect: false,
|
|
395
|
+
options: [
|
|
396
|
+
{ label: "ไม่มี ใช้ AI แนะนำ", description: "ให้ AI เลือกสิ่งที่เหมาะสมที่สุด" },
|
|
397
|
+
{ label: "มีสี CI ของตัวเอง", description: "ระบุสีแบรนด์" },
|
|
398
|
+
{ label: "ชอบ component เฉพาะ", description: "ชอบ button/card ของเว็บใดเป็นพิเศษ" },
|
|
399
|
+
{ label: "ปรับอื่นๆ", description: "Typography, shadows, หรืออื่นๆ" }
|
|
400
|
+
]
|
|
401
|
+
}]
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
let userPreferences = { type: 'none' }
|
|
405
|
+
|
|
406
|
+
// Process user feedback
|
|
407
|
+
if (userFeedback.answers["Preferences"] === "มีสี CI ของตัวเอง") {
|
|
408
|
+
output(`
|
|
409
|
+
กรุณาระบุสี (HEX format, คั่นด้วย comma):
|
|
410
|
+
ตัวอย่าง: #0d7276, #f97316
|
|
411
|
+
|
|
412
|
+
สีของคุณ:
|
|
413
|
+
`)
|
|
414
|
+
|
|
415
|
+
const colorInput = await getUserTextInput()
|
|
416
|
+
const colors = colorInput.split(',').map(s => s.trim()).filter(s => s.match(/^#[0-9A-Fa-f]{6}$/))
|
|
417
|
+
|
|
418
|
+
if (colors.length > 0) {
|
|
419
|
+
userPreferences = {
|
|
420
|
+
type: 'custom_colors',
|
|
421
|
+
colors: {
|
|
422
|
+
primary: colors[0],
|
|
423
|
+
secondary: colors[1] || null,
|
|
424
|
+
accent: colors[2] || null
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
output(`✅ รับสีแล้ว: ${colors.join(', ')}`)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
} else if (userFeedback.answers["Preferences"] === "ชอบ component เฉพาะ") {
|
|
431
|
+
output(`
|
|
432
|
+
ระบุความชอบ (ตัวอย่าง: "ชอบ button ของ motherduck, card ของ gitingest"):
|
|
433
|
+
`)
|
|
434
|
+
|
|
435
|
+
const preferenceText = await getUserTextInput()
|
|
436
|
+
userPreferences = {
|
|
437
|
+
type: 'component_preference',
|
|
438
|
+
text: preferenceText
|
|
439
|
+
}
|
|
440
|
+
output(`✅ บันทึกความชอบแล้ว`)
|
|
441
|
+
|
|
442
|
+
} else if (userFeedback.answers["Preferences"] === "ปรับอื่นๆ") {
|
|
443
|
+
output(`
|
|
444
|
+
ระบุสิ่งที่อยากปรับ (ตัวอย่าง: "ใช้ font Inter, shadow แบบ soft"):
|
|
445
|
+
`)
|
|
446
|
+
|
|
447
|
+
const adjustmentText = await getUserTextInput()
|
|
448
|
+
userPreferences = {
|
|
449
|
+
type: 'other_adjustment',
|
|
450
|
+
text: adjustmentText
|
|
451
|
+
}
|
|
452
|
+
output(`✅ บันทึกการปรับแต่งแล้ว`)
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
output(`
|
|
456
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
457
|
+
🔄 กำลังสร้าง style options (พร้อม preferences ของคุณ)...
|
|
458
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
459
|
+
`)
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
403
464
|
## STEP 4: Present Options to User
|
|
404
465
|
|
|
405
466
|
```javascript
|
|
@@ -413,6 +474,7 @@ Based on:
|
|
|
413
474
|
✓ Target: ${contextAnalysis.target_audience.demographics}
|
|
414
475
|
✓ Brand: ${contextAnalysis.brand_personality.join(', ')}
|
|
415
476
|
✓ Product: ${contextAnalysis.product_type}
|
|
477
|
+
${userPreferences.type !== 'none' ? `✓ User preferences: ${JSON.stringify(userPreferences)}` : ''}
|
|
416
478
|
|
|
417
479
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
418
480
|
`);
|
|
@@ -720,6 +782,270 @@ Write('design-system/STYLE_GUIDE.md', styleGuideMD);
|
|
|
720
782
|
|
|
721
783
|
---
|
|
722
784
|
|
|
785
|
+
## STEP 5.5: Generate STYLE_TOKENS.json (Context Optimization)
|
|
786
|
+
|
|
787
|
+
> **New in v1.2.0:** Generate lightweight design tokens file for token-efficient loading
|
|
788
|
+
|
|
789
|
+
```javascript
|
|
790
|
+
output(`
|
|
791
|
+
🔄 Extracting design tokens for efficient loading...
|
|
792
|
+
`);
|
|
793
|
+
|
|
794
|
+
// Extract design tokens from STYLE_GUIDE.md
|
|
795
|
+
const tokensPrompt = `
|
|
796
|
+
You are extracting design tokens from the STYLE_GUIDE.md into a lightweight JSON format.
|
|
797
|
+
|
|
798
|
+
Source: STYLE_GUIDE.md content below
|
|
799
|
+
${styleGuideMD}
|
|
800
|
+
|
|
801
|
+
Task: Extract ALL design tokens into JSON format following this exact structure:
|
|
802
|
+
|
|
803
|
+
{
|
|
804
|
+
"$schema": "https://json-schema.org/draft-07/schema",
|
|
805
|
+
"version": "1.0.0",
|
|
806
|
+
"meta": {
|
|
807
|
+
"generated_at": "${new Date().toISOString()}",
|
|
808
|
+
"generated_by": "/designsetup command",
|
|
809
|
+
"source": "design-system/STYLE_GUIDE.md",
|
|
810
|
+
"design_style": "${selectedOption.name}",
|
|
811
|
+
"description": "Lightweight design tokens extracted from STYLE_GUIDE.md (~500 tokens vs ~5000 tokens for full guide)"
|
|
812
|
+
},
|
|
813
|
+
"tokens": {
|
|
814
|
+
"colors": {
|
|
815
|
+
"primary": {
|
|
816
|
+
"DEFAULT": "[extract from guide]",
|
|
817
|
+
"foreground": "[extract]",
|
|
818
|
+
"hover": "[extract or generate]",
|
|
819
|
+
"description": "Primary brand color for CTAs, links, and accents",
|
|
820
|
+
"tailwind": "bg-primary, text-primary, border-primary"
|
|
821
|
+
},
|
|
822
|
+
"secondary": { ... },
|
|
823
|
+
"background": { ... },
|
|
824
|
+
"foreground": { ... },
|
|
825
|
+
"border": { ... },
|
|
826
|
+
"semantic": {
|
|
827
|
+
"success": "[extract]",
|
|
828
|
+
"warning": "[extract]",
|
|
829
|
+
"error": "[extract]",
|
|
830
|
+
"info": "[extract]"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
"spacing": {
|
|
834
|
+
"scale": [extract spacing scale array],
|
|
835
|
+
"description": "4px or 8px base unit spacing scale",
|
|
836
|
+
"tailwind_mapping": { ... },
|
|
837
|
+
"common_patterns": {
|
|
838
|
+
"component_padding": "p-4 (16px) or p-6 (24px)",
|
|
839
|
+
"section_gap": "gap-8 (32px) or gap-12 (48px)",
|
|
840
|
+
"layout_margin": "mt-16 (64px) or mt-24 (96px)"
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
"typography": {
|
|
844
|
+
"font_family": { ... },
|
|
845
|
+
"font_size": { ... },
|
|
846
|
+
"font_weight": { ... },
|
|
847
|
+
"line_height": { ... },
|
|
848
|
+
"headings": { ... }
|
|
849
|
+
},
|
|
850
|
+
"shadows": {
|
|
851
|
+
"sm": "[extract]",
|
|
852
|
+
"DEFAULT": "[extract]",
|
|
853
|
+
"md": "[extract]",
|
|
854
|
+
"lg": "[extract]",
|
|
855
|
+
"xl": "[extract]",
|
|
856
|
+
"usage": {
|
|
857
|
+
"cards": "shadow-md",
|
|
858
|
+
"dropdowns": "shadow-lg",
|
|
859
|
+
"modals": "shadow-xl",
|
|
860
|
+
"buttons_hover": "shadow-sm"
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
"borders": {
|
|
864
|
+
"radius": { ... },
|
|
865
|
+
"width": { ... },
|
|
866
|
+
"usage": { ... }
|
|
867
|
+
},
|
|
868
|
+
"animation": {
|
|
869
|
+
"duration": { ... },
|
|
870
|
+
"easing": { ... },
|
|
871
|
+
"common": { ... }
|
|
872
|
+
},
|
|
873
|
+
"breakpoints": { ... },
|
|
874
|
+
"z_index": { ... }
|
|
875
|
+
},
|
|
876
|
+
"component_library": {
|
|
877
|
+
"name": "[extract from guide]",
|
|
878
|
+
"install_command": "[extract]",
|
|
879
|
+
"common_components": [extract array]
|
|
880
|
+
},
|
|
881
|
+
"component_patterns": {
|
|
882
|
+
"button": {
|
|
883
|
+
"primary": "[extract full Tailwind classes from Button component section - exact copy of primary button pattern]",
|
|
884
|
+
"secondary": "[extract secondary button pattern]",
|
|
885
|
+
"ghost": "[extract ghost button pattern]",
|
|
886
|
+
"outline": "[extract outline button pattern]",
|
|
887
|
+
"destructive": "[extract destructive/danger button pattern]",
|
|
888
|
+
"link": "[extract link button pattern]",
|
|
889
|
+
"icon": "[extract icon-only button pattern]",
|
|
890
|
+
"sizes": {
|
|
891
|
+
"sm": "[extract small button classes]",
|
|
892
|
+
"md": "[extract medium/default button classes]",
|
|
893
|
+
"lg": "[extract large button classes]"
|
|
894
|
+
},
|
|
895
|
+
"states": {
|
|
896
|
+
"default": "[base classes]",
|
|
897
|
+
"hover": "[hover state classes]",
|
|
898
|
+
"active": "[active/pressed state classes]",
|
|
899
|
+
"disabled": "[disabled state classes]",
|
|
900
|
+
"loading": "[loading state classes with spinner]"
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
"card": {
|
|
904
|
+
"default": "[extract default card pattern with border/shadow/padding]",
|
|
905
|
+
"elevated": "[extract elevated card with larger shadow]",
|
|
906
|
+
"outlined": "[extract outlined card variant]",
|
|
907
|
+
"interactive": "[extract interactive card with hover effects]",
|
|
908
|
+
"composition": {
|
|
909
|
+
"header": "[extract card header classes]",
|
|
910
|
+
"content": "[extract card content/body classes]",
|
|
911
|
+
"footer": "[extract card footer classes]",
|
|
912
|
+
"image": "[extract card image wrapper classes]"
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
"input": {
|
|
916
|
+
"base": "[extract base input field classes]",
|
|
917
|
+
"variants": {
|
|
918
|
+
"default": "[extract default input]",
|
|
919
|
+
"error": "[extract error state input with red border]",
|
|
920
|
+
"success": "[extract success state input]",
|
|
921
|
+
"disabled": "[extract disabled input]"
|
|
922
|
+
},
|
|
923
|
+
"sizes": {
|
|
924
|
+
"sm": "[extract small input]",
|
|
925
|
+
"md": "[extract medium input]",
|
|
926
|
+
"lg": "[extract large input]"
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
"form_field": {
|
|
930
|
+
"wrapper": "[extract form field wrapper classes]",
|
|
931
|
+
"label": "[extract label classes]",
|
|
932
|
+
"input": "[reference to input.base]",
|
|
933
|
+
"helper_text": "[extract helper text classes]",
|
|
934
|
+
"error_message": "[extract error message classes with red text]",
|
|
935
|
+
"composition": "[extract full form field pattern: label + input + helper + error]"
|
|
936
|
+
},
|
|
937
|
+
"badge": {
|
|
938
|
+
"default": "[extract default badge]",
|
|
939
|
+
"variants": {
|
|
940
|
+
"primary": "[extract primary badge]",
|
|
941
|
+
"secondary": "[extract secondary badge]",
|
|
942
|
+
"success": "[extract success/green badge]",
|
|
943
|
+
"warning": "[extract warning/yellow badge]",
|
|
944
|
+
"error": "[extract error/red badge]",
|
|
945
|
+
"outline": "[extract outline badge]"
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
"alert": {
|
|
949
|
+
"base": "[extract base alert classes]",
|
|
950
|
+
"variants": {
|
|
951
|
+
"info": "[extract info alert with blue accent]",
|
|
952
|
+
"success": "[extract success alert with green accent]",
|
|
953
|
+
"warning": "[extract warning alert with yellow accent]",
|
|
954
|
+
"error": "[extract error alert with red accent]"
|
|
955
|
+
},
|
|
956
|
+
"composition": {
|
|
957
|
+
"wrapper": "[alert container classes]",
|
|
958
|
+
"icon": "[icon wrapper classes]",
|
|
959
|
+
"content": "[content wrapper classes]",
|
|
960
|
+
"title": "[alert title classes]",
|
|
961
|
+
"description": "[alert description classes]",
|
|
962
|
+
"actions": "[action buttons wrapper classes]"
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
"layout_patterns": {
|
|
967
|
+
"container": {
|
|
968
|
+
"default": "[extract default container: max-w-7xl mx-auto px-4 sm:px-6 lg:px-8]",
|
|
969
|
+
"narrow": "[extract narrow container: max-w-4xl]",
|
|
970
|
+
"wide": "[extract wide container: max-w-screen-2xl]",
|
|
971
|
+
"full": "[extract full-width: w-full]",
|
|
972
|
+
"fluid": "[extract fluid container with responsive padding]"
|
|
973
|
+
},
|
|
974
|
+
"grid": {
|
|
975
|
+
"auto": "[extract auto-fit grid: grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6]",
|
|
976
|
+
"feature": "[extract feature grid: grid grid-cols-1 md:grid-cols-3 gap-8]",
|
|
977
|
+
"dashboard": "[extract dashboard grid: grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4]",
|
|
978
|
+
"gallery": "[extract gallery grid: grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2]",
|
|
979
|
+
"masonry": "[extract masonry-style grid classes]"
|
|
980
|
+
},
|
|
981
|
+
"flex": {
|
|
982
|
+
"row_center": "[extract centered row: flex items-center justify-center]",
|
|
983
|
+
"row_between": "[extract space-between row: flex items-center justify-between]",
|
|
984
|
+
"row_start": "[extract left-aligned row: flex items-center justify-start]",
|
|
985
|
+
"col_center": "[extract centered column: flex flex-col items-center justify-center]",
|
|
986
|
+
"col_start": "[extract top-aligned column: flex flex-col items-start]"
|
|
987
|
+
},
|
|
988
|
+
"section_spacing": {
|
|
989
|
+
"tight": "[extract tight section spacing: py-8 md:py-12]",
|
|
990
|
+
"normal": "[extract normal section spacing: py-12 md:py-16]",
|
|
991
|
+
"loose": "[extract loose section spacing: py-16 md:py-24]",
|
|
992
|
+
"hero": "[extract hero section spacing: py-20 md:py-32]"
|
|
993
|
+
},
|
|
994
|
+
"page_layouts": {
|
|
995
|
+
"landing": "[extract landing page layout structure]",
|
|
996
|
+
"dashboard": "[extract dashboard layout: sidebar + main content]",
|
|
997
|
+
"auth": "[extract auth page layout: centered card]",
|
|
998
|
+
"settings": "[extract settings page layout: tabs + content]"
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
"critical_rules": {
|
|
1002
|
+
"colors": [
|
|
1003
|
+
"❌ NO hardcoded hex values (#64748b)",
|
|
1004
|
+
"✅ USE theme tokens (text-foreground/70)",
|
|
1005
|
+
"❌ NO random opacity values",
|
|
1006
|
+
"✅ USE consistent opacity scale (/50, /70, /90)"
|
|
1007
|
+
],
|
|
1008
|
+
"spacing": [
|
|
1009
|
+
"❌ NO arbitrary values (p-5, gap-7, mt-15)",
|
|
1010
|
+
"✅ USE spacing scale (p-4, p-6, gap-8, mt-16)",
|
|
1011
|
+
"❌ NO hardcoded px values",
|
|
1012
|
+
"✅ USE Tailwind scale"
|
|
1013
|
+
],
|
|
1014
|
+
"consistency": [
|
|
1015
|
+
"❌ NO mixing patterns (shadow-sm on Card A, shadow-lg on Card B)",
|
|
1016
|
+
"✅ USE consistent patterns (all cards use shadow-md)",
|
|
1017
|
+
"❌ NO mixing border radius (rounded-md vs rounded-lg)",
|
|
1018
|
+
"✅ USE same border radius for similar components"
|
|
1019
|
+
]
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
IMPORTANT:
|
|
1024
|
+
- Extract ALL values from STYLE_GUIDE.md (don't use placeholders)
|
|
1025
|
+
- If a value isn't in the guide, infer it logically (e.g., hover = 10% darker than DEFAULT)
|
|
1026
|
+
- Keep descriptions concise but clear
|
|
1027
|
+
- Return ONLY valid JSON (no markdown, no explanations)
|
|
1028
|
+
`;
|
|
1029
|
+
|
|
1030
|
+
const tokensJSON = await LLM({
|
|
1031
|
+
prompt: tokensPrompt,
|
|
1032
|
+
max_tokens: 4000,
|
|
1033
|
+
temperature: 0.1 // Low temperature for consistent extraction
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
// Validate JSON
|
|
1037
|
+
try {
|
|
1038
|
+
JSON.parse(tokensJSON);
|
|
1039
|
+
Write('design-system/STYLE_TOKENS.json', tokensJSON);
|
|
1040
|
+
output(`✅ STYLE_TOKENS.json generated (~500 tokens)`);
|
|
1041
|
+
} catch (e) {
|
|
1042
|
+
warn(`⚠️ Failed to generate STYLE_TOKENS.json: ${e.message}`);
|
|
1043
|
+
warn(`Continuing without tokens file...`);
|
|
1044
|
+
}
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
---
|
|
1048
|
+
|
|
723
1049
|
## STEP 6: Final Report
|
|
724
1050
|
|
|
725
1051
|
```
|
|
@@ -740,7 +1066,8 @@ Write('design-system/STYLE_GUIDE.md', styleGuideMD);
|
|
|
740
1066
|
${selectedOption.advantages.slice(0, 4).map(a => ` ✓ ${a}`).join('\n')}
|
|
741
1067
|
|
|
742
1068
|
📦 Files Created:
|
|
743
|
-
✓ design-system/STYLE_GUIDE.md (final guide)
|
|
1069
|
+
✓ design-system/STYLE_GUIDE.md (final guide, ~2000 lines)
|
|
1070
|
+
✓ design-system/STYLE_TOKENS.json (lightweight tokens, ~500 tokens) 🆕
|
|
744
1071
|
✓ design-system/synthesis/options/ (${styleOptions.options.length} YAMLs)
|
|
745
1072
|
|
|
746
1073
|
⚠️ Trade-offs:
|
|
@@ -756,17 +1083,21 @@ ${selectedOption.disadvantages.slice(0, 2).map(d => ` • ${d}`).join('\n')}
|
|
|
756
1083
|
|
|
757
1084
|
🚀 Next Steps:
|
|
758
1085
|
|
|
759
|
-
1. Review
|
|
760
|
-
cat design-system/STYLE_GUIDE.md | head -100
|
|
1086
|
+
1. Review generated files:
|
|
1087
|
+
- Full guide: cat design-system/STYLE_GUIDE.md | head -100
|
|
1088
|
+
- Tokens: cat design-system/STYLE_TOKENS.json
|
|
761
1089
|
|
|
762
|
-
2. Setup project (
|
|
1090
|
+
2. Setup project (generates design-context.md):
|
|
763
1091
|
/psetup
|
|
764
1092
|
|
|
765
1093
|
3. Start development:
|
|
766
1094
|
/csetup feature-login
|
|
767
1095
|
/cdev feature-login
|
|
768
1096
|
|
|
769
|
-
4.
|
|
1097
|
+
4. Context Optimization (v1.2.0):
|
|
1098
|
+
✅ Commands use STYLE_TOKENS.json (~500 tokens, not full guide ~5K)
|
|
1099
|
+
✅ Agents load design-context.md + STYLE_TOKENS.json (~1.5K total)
|
|
1100
|
+
✅ 70% token reduction while maintaining quality ✨
|
|
770
1101
|
```
|
|
771
1102
|
|
|
772
1103
|
---
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
1. **Reads User-Specified Context:**
|
|
22
22
|
- Only reads files that user mentions with `@` prefix
|
|
23
23
|
- Always reads `.changes/{change-id}/proposal.md` (if exists)
|
|
24
|
-
- Always reads `design-system/
|
|
24
|
+
- **Always reads `design-system/STYLE_TOKENS.json`** (lightweight, ~500 tokens) ✅
|
|
25
|
+
- Validates `design-system/STYLE_GUIDE.md` exists (doesn't load full content)
|
|
25
26
|
|
|
26
27
|
2. **Searches Existing Components:**
|
|
27
28
|
- Glob: `**/{Navbar,Footer,Sidebar,Header}*.{tsx,jsx,vue}`
|
|
@@ -64,16 +65,34 @@ const userFiles = extractMentionedFiles(userMessage) // @prd.md, @brief.md
|
|
|
64
65
|
|
|
65
66
|
// Always read (if exists)
|
|
66
67
|
const proposalPath = `.changes/${changeId}/proposal.md`
|
|
67
|
-
const
|
|
68
|
+
const tokensPath = `design-system/STYLE_TOKENS.json` // 🆕 Lightweight tokens
|
|
69
|
+
const styleGuidePath = `design-system/STYLE_GUIDE.md` // Validate only, don't load
|
|
68
70
|
|
|
69
71
|
const contextFiles = [
|
|
70
72
|
...userFiles,
|
|
71
|
-
proposalPath
|
|
72
|
-
styleGuidePath
|
|
73
|
+
proposalPath
|
|
73
74
|
].filter(fileExists)
|
|
74
75
|
|
|
75
76
|
// Read all context
|
|
76
|
-
|
|
77
|
+
let context = contextFiles.map(readFile).join('\n\n---\n\n')
|
|
78
|
+
|
|
79
|
+
// 🆕 Load design tokens (lightweight)
|
|
80
|
+
if (fileExists(tokensPath)) {
|
|
81
|
+
const tokens = JSON.parse(Read(tokensPath))
|
|
82
|
+
context += `\n\n---\n\n# Design Tokens (STYLE_TOKENS.json)\n\n`
|
|
83
|
+
context += `Primary Color: ${tokens.tokens.colors.primary.DEFAULT}\n`
|
|
84
|
+
context += `Spacing Scale: ${tokens.tokens.spacing.scale.join(', ')}px\n`
|
|
85
|
+
context += `Component Library: ${tokens.component_library.name}\n`
|
|
86
|
+
context += `Shadows: ${Object.keys(tokens.tokens.shadows).join(', ')}\n`
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Validate STYLE_GUIDE.md exists (don't load!)
|
|
90
|
+
const hasStyleGuide = fileExists(styleGuidePath)
|
|
91
|
+
if (!hasStyleGuide) {
|
|
92
|
+
warn(`⚠️ No STYLE_GUIDE.md found - run /designsetup first`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Total context: ~1.5K tokens (vs 5K+ if loading full STYLE_GUIDE.md)
|
|
77
96
|
```
|
|
78
97
|
|
|
79
98
|
### STEP 3: Search Existing Components
|
|
@@ -181,11 +200,22 @@ _([length] chars - based on [source])_
|
|
|
181
200
|
---
|
|
182
201
|
|
|
183
202
|
## 5. Design Notes
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
|
|
204
|
+
**Design System Files:**
|
|
205
|
+
- Tokens (lightweight): \`design-system/STYLE_TOKENS.json\`
|
|
206
|
+
- Full guide (reference): \`design-system/STYLE_GUIDE.md\`
|
|
207
|
+
|
|
208
|
+
**Key Design Tokens:**
|
|
209
|
+
- Primary color: [from STYLE_TOKENS.json]
|
|
210
|
+
- Font family: [from STYLE_TOKENS.json]
|
|
211
|
+
- Spacing scale: [from STYLE_TOKENS.json]
|
|
212
|
+
- Component library: [from STYLE_TOKENS.json]
|
|
213
|
+
- Shadows: [from STYLE_TOKENS.json]
|
|
214
|
+
|
|
215
|
+
**Agent Instructions:**
|
|
216
|
+
- uxui-frontend MUST read STYLE_TOKENS.json in STEP 0.5
|
|
217
|
+
- Use theme tokens (text-foreground/70), NOT hardcoded colors
|
|
218
|
+
- Use spacing scale (p-4, p-6), NOT arbitrary values (p-5)
|
|
189
219
|
|
|
190
220
|
## 6. Implementation Notes
|
|
191
221
|
|
package/.claude/lib/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# .claude/lib/ - Implementation Logic
|
|
2
2
|
|
|
3
3
|
> **Logic specifications for Main Claude orchestrator**
|
|
4
|
+
> **Version:** 1.4.0 - Context Optimization & DRY Consolidation
|
|
4
5
|
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
## 📁 Files
|
|
8
|
+
## 📁 Core Logic Files
|
|
8
9
|
|
|
9
10
|
**`agent-executor.md`** - Agent retry & escalation logic
|
|
10
11
|
Used by `/cdev` to execute agents with automatic retry, validation, and user escalation
|
|
@@ -12,15 +13,56 @@ Used by `/cdev` to execute agents with automatic retry, validation, and user esc
|
|
|
12
13
|
**`tdd-classifier.md`** - TDD classification logic
|
|
13
14
|
Used by `/csetup` to automatically determine which phases require TDD workflow
|
|
14
15
|
|
|
15
|
-
**`flags-updater.md`** -
|
|
16
|
+
**`flags-updater.md`** - Progress tracking protocol
|
|
16
17
|
Ensures Main Claude updates flags.json after EVERY phase completion. Provides helper functions for extracting files, tasks, and calculating duration.
|
|
17
18
|
|
|
18
|
-
**`agent-router.md`** -
|
|
19
|
+
**`agent-router.md`** - Mandatory agent routing rules
|
|
19
20
|
Enforces strict agent boundaries. Main Claude MUST delegate implementation work to specialized agents. Includes work type detection patterns and self-check protocol.
|
|
20
21
|
|
|
21
|
-
**`validation-gates.md`** -
|
|
22
|
+
**`validation-gates.md`** - Validation checkpoints
|
|
22
23
|
Four validation gates that Main Claude MUST pass: before work, after agent responds, before reporting, and before phase start. Ensures quality and correctness at each step.
|
|
23
24
|
|
|
25
|
+
**`task-analyzer.md`** - TaskMaster-style task analysis (v1.3.0)
|
|
26
|
+
Used by `/csetup` to analyze tasks with 6 dimensions: complexity, dependencies, risk, research, subtasks, priority. Generates intelligent phases.md with time buffers and metadata.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📁 Shared Documentation (v1.4.0 - NEW!)
|
|
31
|
+
|
|
32
|
+
**`context-loading-protocol.md`** - Universal context loading strategy
|
|
33
|
+
Consolidated protocol used by ALL agents (STEP 0). Includes package manager discovery, framework detection via Context7, and best practices loading.
|
|
34
|
+
|
|
35
|
+
**`handoff-protocol.md`** - Agent handoff templates
|
|
36
|
+
Standardized handoff formats for agent-to-agent communication. Includes all 15 handoff paths with clear templates.
|
|
37
|
+
|
|
38
|
+
**`tdd-workflow.md`** - TDD workflow examples
|
|
39
|
+
Complete TDD implementation examples (Stripe integration, user auth). Used by frontend, backend, database agents.
|
|
40
|
+
|
|
41
|
+
**`document-loader.md`** - Token-efficient document loading
|
|
42
|
+
Unified pattern for loading design system files. 3-tier strategy: STYLE_TOKENS.json → design-context.md → STYLE_GUIDE.md.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 📁 Detailed Guides (v1.4.0 - NEW!)
|
|
47
|
+
|
|
48
|
+
**`detailed-guides/best-practices-system.md`** - How best practices work
|
|
49
|
+
Complete guide to auto-generated best practices via Context7 MCP. Covers `/agentsetup`, 3-level indexing, and agent discovery flow.
|
|
50
|
+
|
|
51
|
+
**`detailed-guides/context-optimization.md`** - Token optimization strategy
|
|
52
|
+
Details the 70% token reduction in design system loading. Explains 3-tier loading, before/after comparisons, and benefits.
|
|
53
|
+
|
|
54
|
+
**`detailed-guides/page-planning.md`** - /pageplan command guide
|
|
55
|
+
Complete guide to page planning system. Covers component reuse, content drafting, asset preparation, and 25% speed improvement.
|
|
56
|
+
|
|
57
|
+
**`detailed-guides/taskmaster-analysis.md`** - 6-dimension task analysis
|
|
58
|
+
Detailed explanation of TaskMaster-style analysis. Covers complexity scoring, dependency detection, risk assessment, research requirements, subtask breakdown, priority ranking.
|
|
59
|
+
|
|
60
|
+
**`detailed-guides/design-system.md`** - Style guide generation
|
|
61
|
+
How `/designsetup` works. Covers 3 smart paths (reference → brownfield → greenfield), 17-section output, and agent discovery.
|
|
62
|
+
|
|
63
|
+
**`detailed-guides/agent-system.md`** - Agent overview & workflow
|
|
64
|
+
Complete agent system guide. Covers 6 specialist agents, Main Claude's role, self-check protocol, and pre-work requirements.
|
|
65
|
+
|
|
24
66
|
---
|
|
25
67
|
|
|
26
68
|
## 🚨 Important
|