@champpaba/claude-agent-kit 1.1.1 → 1.4.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 (36) hide show
  1. package/.claude/CLAUDE.md +52 -444
  2. package/.claude/agents/01-integration.md +47 -193
  3. package/.claude/agents/02-uxui-frontend.md +151 -188
  4. package/.claude/agents/03-test-debug.md +43 -186
  5. package/.claude/agents/04-frontend.md +50 -478
  6. package/.claude/agents/05-backend.md +49 -499
  7. package/.claude/agents/06-database.md +36 -188
  8. package/.claude/commands/cdev.md +86 -1
  9. package/.claude/commands/csetup.md +319 -6
  10. package/.claude/commands/designsetup.md +360 -29
  11. package/.claude/commands/pageplan.md +409 -19
  12. package/.claude/contexts/design/box-thinking.md +358 -0
  13. package/.claude/contexts/patterns/animation-patterns.md +768 -0
  14. package/.claude/contexts/patterns/performance-optimization.md +421 -0
  15. package/.claude/contexts/patterns/ui-component-consistency.md +49 -2
  16. package/.claude/lib/README.md +46 -4
  17. package/.claude/lib/agent-executor.md +69 -10
  18. package/.claude/lib/context-loading-protocol.md +462 -0
  19. package/.claude/lib/detailed-guides/agent-system.md +237 -0
  20. package/.claude/lib/detailed-guides/best-practices-system.md +150 -0
  21. package/.claude/lib/detailed-guides/context-optimization.md +118 -0
  22. package/.claude/lib/detailed-guides/design-system.md +98 -0
  23. package/.claude/lib/detailed-guides/page-planning.md +147 -0
  24. package/.claude/lib/detailed-guides/taskmaster-analysis.md +263 -0
  25. package/.claude/lib/document-loader.md +353 -0
  26. package/.claude/lib/handoff-protocol.md +665 -0
  27. package/.claude/lib/task-analyzer.md +694 -0
  28. package/.claude/lib/tdd-workflow.md +891 -0
  29. package/.claude/templates/design-context-template.md +220 -0
  30. package/.claude/templates/page-plan-example.md +131 -0
  31. package/README.md +290 -0
  32. package/bin/cli.js +0 -2
  33. package/lib/helpers.js +108 -0
  34. package/lib/init.js +18 -13
  35. package/lib/update.js +48 -31
  36. 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 STYLE_GUIDE.md:
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 (if needed):
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. Agents will automatically use STYLE_GUIDE.md ✓
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
  ---