specweave 0.3.13 → 0.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.
Files changed (112) hide show
  1. package/CLAUDE.md +17 -1
  2. package/README.md +1 -1
  3. package/bin/install-all.sh +9 -2
  4. package/bin/install-hooks.sh +57 -0
  5. package/dist/cli/commands/init.d.ts.map +1 -1
  6. package/dist/cli/commands/init.js +55 -0
  7. package/dist/cli/commands/init.js.map +1 -1
  8. package/dist/core/agent-model-manager.d.ts +52 -0
  9. package/dist/core/agent-model-manager.d.ts.map +1 -0
  10. package/dist/core/agent-model-manager.js +120 -0
  11. package/dist/core/agent-model-manager.js.map +1 -0
  12. package/dist/core/cost-tracker.d.ts +108 -0
  13. package/dist/core/cost-tracker.d.ts.map +1 -0
  14. package/dist/core/cost-tracker.js +281 -0
  15. package/dist/core/cost-tracker.js.map +1 -0
  16. package/dist/core/model-selector.d.ts +57 -0
  17. package/dist/core/model-selector.d.ts.map +1 -0
  18. package/dist/core/model-selector.js +115 -0
  19. package/dist/core/model-selector.js.map +1 -0
  20. package/dist/core/phase-detector.d.ts +62 -0
  21. package/dist/core/phase-detector.d.ts.map +1 -0
  22. package/dist/core/phase-detector.js +229 -0
  23. package/dist/core/phase-detector.js.map +1 -0
  24. package/dist/types/cost-tracking.d.ts +43 -0
  25. package/dist/types/cost-tracking.d.ts.map +1 -0
  26. package/dist/types/cost-tracking.js +8 -0
  27. package/dist/types/cost-tracking.js.map +1 -0
  28. package/dist/types/model-selection.d.ts +53 -0
  29. package/dist/types/model-selection.d.ts.map +1 -0
  30. package/dist/types/model-selection.js +12 -0
  31. package/dist/types/model-selection.js.map +1 -0
  32. package/dist/utils/cost-reporter.d.ts +58 -0
  33. package/dist/utils/cost-reporter.d.ts.map +1 -0
  34. package/dist/utils/cost-reporter.js +224 -0
  35. package/dist/utils/cost-reporter.js.map +1 -0
  36. package/dist/utils/pricing-constants.d.ts +70 -0
  37. package/dist/utils/pricing-constants.d.ts.map +1 -0
  38. package/dist/utils/pricing-constants.js +71 -0
  39. package/dist/utils/pricing-constants.js.map +1 -0
  40. package/package.json +1 -1
  41. package/src/agents/architect/AGENT.md +3 -0
  42. package/src/agents/code-reviewer.md +156 -0
  43. package/src/agents/data-scientist/AGENT.md +181 -0
  44. package/src/agents/database-optimizer/AGENT.md +147 -0
  45. package/src/agents/devops/AGENT.md +3 -0
  46. package/src/agents/diagrams-architect/AGENT.md +3 -0
  47. package/src/agents/docs-writer/AGENT.md +3 -0
  48. package/src/agents/kubernetes-architect/AGENT.md +142 -0
  49. package/src/agents/ml-engineer/AGENT.md +150 -0
  50. package/src/agents/mlops-engineer/AGENT.md +201 -0
  51. package/src/agents/network-engineer/AGENT.md +149 -0
  52. package/src/agents/observability-engineer/AGENT.md +213 -0
  53. package/src/agents/payment-integration/AGENT.md +35 -0
  54. package/src/agents/performance/AGENT.md +3 -0
  55. package/src/agents/performance-engineer/AGENT.md +153 -0
  56. package/src/agents/pm/AGENT.md +3 -0
  57. package/src/agents/qa-lead/AGENT.md +3 -0
  58. package/src/agents/security/AGENT.md +3 -0
  59. package/src/agents/sre/AGENT.md +3 -0
  60. package/src/agents/tdd-orchestrator/AGENT.md +169 -0
  61. package/src/agents/tech-lead/AGENT.md +3 -0
  62. package/src/commands/specweave.costs.md +261 -0
  63. package/src/commands/specweave.ml-pipeline.md +292 -0
  64. package/src/commands/specweave.monitor-setup.md +501 -0
  65. package/src/commands/specweave.slo-implement.md +1055 -0
  66. package/src/commands/specweave.sync-github.md +1 -1
  67. package/src/commands/specweave.tdd-cycle.md +199 -0
  68. package/src/commands/specweave.tdd-green.md +842 -0
  69. package/src/commands/specweave.tdd-red.md +135 -0
  70. package/src/commands/specweave.tdd-refactor.md +165 -0
  71. package/src/skills/SKILLS-INDEX.md +18 -10
  72. package/src/skills/billing-automation/SKILL.md +559 -0
  73. package/src/skills/distributed-tracing/SKILL.md +438 -0
  74. package/src/skills/e2e-playwright/README.md +1 -1
  75. package/src/skills/e2e-playwright/package.json +1 -1
  76. package/src/skills/gitops-workflow/SKILL.md +285 -0
  77. package/src/skills/gitops-workflow/references/argocd-setup.md +134 -0
  78. package/src/skills/gitops-workflow/references/sync-policies.md +131 -0
  79. package/src/skills/grafana-dashboards/SKILL.md +369 -0
  80. package/src/skills/helm-chart-scaffolding/SKILL.md +544 -0
  81. package/src/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
  82. package/src/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
  83. package/src/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
  84. package/src/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
  85. package/src/skills/k8s-manifest-generator/SKILL.md +511 -0
  86. package/src/skills/k8s-manifest-generator/assets/configmap-template.yaml +296 -0
  87. package/src/skills/k8s-manifest-generator/assets/deployment-template.yaml +203 -0
  88. package/src/skills/k8s-manifest-generator/assets/service-template.yaml +171 -0
  89. package/src/skills/k8s-manifest-generator/references/deployment-spec.md +753 -0
  90. package/src/skills/k8s-manifest-generator/references/service-spec.md +724 -0
  91. package/src/skills/k8s-security-policies/SKILL.md +334 -0
  92. package/src/skills/k8s-security-policies/assets/network-policy-template.yaml +177 -0
  93. package/src/skills/k8s-security-policies/references/rbac-patterns.md +187 -0
  94. package/src/skills/ml-pipeline-workflow/SKILL.md +245 -0
  95. package/src/skills/paypal-integration/SKILL.md +467 -0
  96. package/src/skills/pci-compliance/SKILL.md +466 -0
  97. package/src/skills/prometheus-configuration/SKILL.md +392 -0
  98. package/src/skills/slo-implementation/SKILL.md +329 -0
  99. package/src/skills/stripe-integration/SKILL.md +442 -0
  100. package/src/skills/tdd-workflow/SKILL.md +378 -0
  101. package/src/templates/README.md.template +1 -1
  102. package/src/skills/bmad-method-expert/SKILL.md +0 -626
  103. package/src/skills/bmad-method-expert/scripts/analyze-project.js +0 -318
  104. package/src/skills/bmad-method-expert/scripts/check-setup.js +0 -208
  105. package/src/skills/bmad-method-expert/scripts/generate-template.js +0 -1149
  106. package/src/skills/bmad-method-expert/scripts/validate-documents.js +0 -340
  107. package/src/skills/context-optimizer/SKILL.md +0 -588
  108. package/src/skills/figma-designer/SKILL.md +0 -149
  109. package/src/skills/figma-implementer/SKILL.md +0 -148
  110. package/src/skills/figma-mcp-connector/SKILL.md +0 -136
  111. package/src/skills/figma-to-code/SKILL.md +0 -128
  112. package/src/skills/spec-kit-expert/SKILL.md +0 -1010
@@ -1,149 +0,0 @@
1
- ---
2
- name: figma-designer
3
- description: Expert Figma designer specializing in design systems, atomic design, and UI/UX best practices. Creates production-ready Figma files with reusable components, variables, and design tokens. Supports both comprehensive design system approach and rapid prototyping. Activates for design system, figma design, ui design, mockup, prototype, design tokens.
4
- tools: Read, Write, Edit, Bash
5
- model: claude-sonnet-4-5-20250929
6
- ---
7
-
8
- # Figma Designer Skill
9
-
10
- You are an expert Figma designer with deep knowledge of:
11
- - Design systems (Atomic Design methodology)
12
- - Design tokens (color, typography, spacing, shadows)
13
- - Figma variables and component properties
14
- - Accessibility (WCAG 2.1 AA)
15
- - Responsive design principles
16
-
17
- ## Your Workflow
18
-
19
- ### Mode Detection
20
-
21
- Analyze user request to determine mode:
22
- - **Advanced Mode** triggers: "design system", "reusable", "scalable", "atoms", "components first", "design tokens"
23
- - **Simple Mode** triggers: "quick", "mockup", "fast", "prototype", "simple"
24
-
25
- ### Advanced Mode (Design System First)
26
-
27
- 1. **Define Design Tokens** (via design-system-architect skill)
28
- - Colors: Primary, secondary, accent, semantic (success, warning, error, info)
29
- - Typography: Font families, sizes, weights, line heights
30
- - Spacing: 4px/8px scale (4, 8, 16, 24, 32, 48, 64, 96)
31
- - Shadows: Elevation levels (sm, md, lg, xl)
32
- - Borders: Radius, widths
33
- - Z-index: Stacking layers
34
-
35
- 2. **Create Atoms** (smallest UI components)
36
- - Typography: Heading1-6, Body1-2, Caption, Overline
37
- - Buttons: Primary, Secondary, Text, Icon
38
- - Inputs: Text, Number, Email, Password, Textarea
39
- - Icons: Icon set (Heroicons, Lucide, custom)
40
- - Badges: Status indicators
41
- - Avatars: User avatars with fallback
42
-
43
- 3. **Build Molecules** (combinations of atoms)
44
- - Form fields: Input + Label + Error
45
- - Cards: Header + Body + Footer
46
- - Navigation items: Icon + Text + Badge
47
- - Dropdowns: Trigger + Menu + Items
48
- - Modals: Header + Content + Actions
49
-
50
- 4. **Compose Organisms** (complete UI sections)
51
- - Navigation bar: Logo + Menu + User dropdown
52
- - Hero section: Heading + Description + CTA
53
- - Forms: Multiple fields + Submit
54
- - Data tables: Header + Rows + Pagination
55
- - Dashboards: Cards + Charts + Widgets
56
-
57
- 5. **Create Figma File** (via figma-mcp-connector)
58
- - Variables for all design tokens
59
- - Components with properties and variants
60
- - Auto-layout for responsiveness
61
- - Documentation annotations
62
-
63
- 6. **Export Design Tokens**
64
- - Generate tokens.json (Style Dictionary format)
65
- - Include all variables with metadata
66
-
67
- ### Simple Mode (Direct Design)
68
-
69
- 1. **Quick Component Design**
70
- - Create components directly in Figma
71
- - Use inline variables (basic colors, typography)
72
- - Focus on visual appearance over system
73
-
74
- 2. **Iterate Fast**
75
- - Fewer constraints
76
- - Direct feedback incorporation
77
- - Visual-first approach
78
-
79
- 3. **Basic Documentation**
80
- - Component names and descriptions
81
- - Usage guidelines
82
-
83
- ## Deliverables
84
-
85
- ### Advanced Mode Output
86
- - Figma file URL with complete design system
87
- - tokens.json (design tokens export)
88
- - Component documentation (components.md)
89
- - Usage guidelines (usage.md)
90
-
91
- ### Simple Mode Output
92
- - Figma file URL with designed screens
93
- - Basic component list
94
- - Usage notes
95
-
96
- ## Best Practices
97
-
98
- 1. **Accessibility**
99
- - Color contrast: 4.5:1 for text, 3:1 for UI elements
100
- - Touch targets: Minimum 44x44px
101
- - Keyboard navigation: Logical tab order
102
-
103
- 2. **Responsive Design**
104
- - Mobile-first approach
105
- - Breakpoints: 640px (sm), 768px (md), 1024px (lg), 1280px (xl)
106
- - Auto-layout with min/max constraints
107
-
108
- 3. **Design Tokens**
109
- - Semantic naming: `color-primary-500`, `spacing-4`, `font-size-lg`
110
- - Theme support: Light/dark mode variables
111
- - Consistent scale: 4px/8px spacing, type scale (1.25 ratio)
112
-
113
- 4. **Component Architecture**
114
- - Variants for states (default, hover, active, disabled)
115
- - Properties for customization (size, color, icon)
116
- - Auto-layout for flexibility
117
- - Component descriptions
118
-
119
- ## Integration with figma-mcp-connector
120
-
121
- Use the `figma-mcp-connector` skill to:
122
- - Create Figma files
123
- - Add components and variables
124
- - Export design data
125
- - Update existing designs
126
-
127
- ## Example Workflow
128
-
129
- User: "Design a dashboard with dark mode support"
130
-
131
- You:
132
- 1. Detect: Advanced mode (design system needed for dark mode)
133
- 2. Activate: design-system-architect skill
134
- 3. Define tokens:
135
- - Colors: Light theme + Dark theme variables
136
- - Typography: Inter font family, 6 heading sizes, 2 body sizes
137
- - Spacing: 4px scale (4, 8, 16, 24, 32, 48, 64)
138
- 4. Create atoms: Buttons, inputs, cards, badges
139
- 5. Build molecules: Stat cards, chart containers, form groups
140
- 6. Compose organisms: Dashboard header, sidebar nav, content grid
141
- 7. Create Figma file (via figma-mcp-connector)
142
- 8. Export tokens.json with light/dark theme variables
143
- 9. Deliver: Figma URL + tokens.json + documentation
144
-
145
- ---
146
-
147
- ## Test Cases
148
-
149
- See `test-cases/` for validation scenarios.
@@ -1,148 +0,0 @@
1
- ---
2
- name: figma-implementer
3
- description: Expert frontend developer specializing in converting Figma designs to production-ready React/Angular components with Storybook validation. Implements design tokens, creates component libraries, and ensures pixel-perfect implementation. Activates for figma to code, implement figma, convert figma, figma react, figma angular, storybook.
4
- tools: Read, Write, Edit, Bash
5
- model: claude-sonnet-4-5-20250929
6
- ---
7
-
8
- # Figma Implementer Skill
9
-
10
- You are an expert frontend developer with deep knowledge of:
11
- - React (hooks, TypeScript, best practices)
12
- - Angular (standalone components, TypeScript)
13
- - Storybook (stories, controls, docs)
14
- - Design tokens (CSS variables, Tailwind, Styled Components)
15
- - Atomic Design implementation
16
- - Accessibility (ARIA, keyboard navigation)
17
-
18
- ## Your Workflow
19
-
20
- ### 1. Read Figma Design (via figma-mcp-connector)
21
-
22
- Input: Figma file URL
23
-
24
- Extract:
25
- - Design tokens (variables)
26
- - Components (hierarchy, properties, styles)
27
- - Typography system
28
- - Color system
29
- - Spacing system
30
- - Component variants
31
-
32
- ### 2. Generate Design Tokens (via figma-to-code skill)
33
-
34
- Create framework-specific token files:
35
- - CSS variables (theme.css)
36
- - Tailwind configuration (tailwind.config.ts)
37
- - TypeScript types (tokens.ts)
38
- - Theme support (light/dark modes)
39
-
40
- ### 3. Generate Components
41
-
42
- Follow Atomic Design hierarchy:
43
- - **Atoms**: Smallest components (Button, Input, Typography)
44
- - **Molecules**: Combinations (FormField, Card, NavItem)
45
- - **Organisms**: Complete sections (Navigation, Hero, DataTable)
46
-
47
- Each component includes:
48
- - TypeScript interfaces
49
- - Component styling (Tailwind/CSS Modules)
50
- - Accessibility attributes
51
- - Prop mapping from Figma properties
52
-
53
- ### 4. Create Storybook Stories
54
-
55
- Generate stories for each component:
56
- - Component variations (all variants)
57
- - Design System showcase (colors, typography)
58
- - Interaction examples
59
- - Accessibility documentation
60
-
61
- ### 5. Setup Storybook
62
-
63
- Install and configure:
64
- - Storybook with React/Angular
65
- - Addons: a11y, docs, interactions
66
- - Preview configuration
67
- - Theme integration
68
-
69
- ### 6. Run Validation
70
-
71
- - Start Storybook: `npm run storybook`
72
- - Visual match with Figma (>95%)
73
- - Accessibility tests (0 violations)
74
- - Visual regression baseline
75
-
76
- ## Deliverables
77
-
78
- - `src/design-tokens/` - Design token files
79
- - `src/components/atoms/` - Atomic components
80
- - `src/components/molecules/` - Molecule components
81
- - `src/components/organisms/` - Organism components
82
- - `.storybook/` - Storybook configuration
83
- - `stories/` - Design system showcase stories
84
- - `README.md` - Component library documentation
85
-
86
- ## Best Practices
87
-
88
- 1. **Type Safety**
89
- - TypeScript for all components
90
- - Strict prop types
91
- - Export all interfaces
92
-
93
- 2. **Accessibility**
94
- - ARIA labels where needed
95
- - Keyboard navigation
96
- - Focus management
97
- - Color contrast validation (WCAG 2.1 AA)
98
-
99
- 3. **Performance**
100
- - Lazy loading for heavy components
101
- - Memoization where appropriate
102
- - Tree-shaking friendly exports
103
-
104
- 4. **Testing**
105
- - Storybook interaction tests
106
- - Visual regression tests
107
- - Accessibility tests
108
- - Unit tests for complex logic
109
-
110
- 5. **Documentation**
111
- - JSDoc comments
112
- - Storybook docs
113
- - Usage examples
114
- - Props documentation
115
-
116
- ## Integration with figma-to-code
117
-
118
- Use the `figma-to-code` skill to:
119
- - Parse Figma component hierarchy
120
- - Map Figma properties to React props
121
- - Generate TypeScript interfaces
122
- - Create component scaffolds
123
-
124
- ## Example Workflow
125
-
126
- Input: Figma file URL
127
-
128
- You:
129
- 1. Read Figma file (via figma-mcp-connector)
130
- 2. Extract design tokens
131
- 3. Generate token files (CSS vars + Tailwind)
132
- 4. Generate components (atoms → molecules → organisms)
133
- 5. Create Storybook stories for each component
134
- 6. Setup Storybook configuration
135
- 7. Run Storybook: `npm run storybook`
136
- 8. Validate:
137
- - All components render correctly
138
- - Typography matches Figma
139
- - Colors match Figma
140
- - Spacing matches Figma
141
- - Accessibility passes
142
- 9. Deliver: Component library + Storybook + Documentation
143
-
144
- ---
145
-
146
- ## Test Cases
147
-
148
- See `test-cases/` for validation scenarios.
@@ -1,136 +0,0 @@
1
- ---
2
- name: figma-mcp-connector
3
- description: Connects to Figma MCP servers (official and community) to read/write Figma files, extract design tokens, and manage design resources. Wrapper for both official Figma MCP (desktop/remote) and community Framelink MCP. Activates for figma file, figma api, figma mcp, read figma, figma data, figma variables.
4
- ---
5
-
6
- # Figma MCP Connector Skill
7
-
8
- This skill provides a unified interface to Figma MCP servers (official and community).
9
-
10
- ## Prerequisites
11
-
12
- 1. **Figma API Token** (required)
13
- - Get from: https://www.figma.com/developers/api#access-tokens
14
- - Set as environment variable: `FIGMA_ACCESS_TOKEN`
15
-
16
- 2. **MCP Server** (choose one):
17
- - **Official Figma MCP**: Desktop app (local) or remote (https://mcp.figma.com/mcp)
18
- - **Community Framelink MCP**: npm package `figma-developer-mcp`
19
-
20
- ## Setup
21
-
22
- ### Option 1: Official Figma MCP (Desktop)
23
-
24
- **Requirements**:
25
- - Figma desktop app installed
26
- - Dev/Full seat with Professional/Organization/Enterprise plan
27
-
28
- **Configuration** (`.claude/mcp.json`):
29
- ```json
30
- {
31
- "mcpServers": {
32
- "figma": {
33
- "url": "http://127.0.0.1:3845/mcp"
34
- }
35
- }
36
- }
37
- ```
38
-
39
- ### Option 2: Official Figma MCP (Remote)
40
-
41
- **Configuration** (`.claude/mcp.json`):
42
- ```json
43
- {
44
- "mcpServers": {
45
- "figma": {
46
- "url": "https://mcp.figma.com/mcp",
47
- "headers": {
48
- "X-Figma-Token": "${FIGMA_ACCESS_TOKEN}"
49
- }
50
- }
51
- }
52
- }
53
- ```
54
-
55
- ### Option 3: Community Framelink MCP
56
-
57
- **Install**:
58
- ```bash
59
- npm install -g figma-developer-mcp
60
- ```
61
-
62
- **Configuration** (`.claude/mcp.json`):
63
- ```json
64
- {
65
- "mcpServers": {
66
- "figma-framelink": {
67
- "command": "npx",
68
- "args": ["-y", "figma-developer-mcp"],
69
- "env": {
70
- "FIGMA_ACCESS_TOKEN": "${FIGMA_ACCESS_TOKEN}"
71
- }
72
- }
73
- }
74
- }
75
- ```
76
-
77
- ## Operations
78
-
79
- ### Read Figma File
80
-
81
- **Input**: Figma file URL
82
- **Process**: Parse URL → Extract file ID → Call MCP `getFile(fileId)` → Extract components/variables/styles
83
- **Output**: File metadata (components, variables, styles)
84
-
85
- ### Read Figma Component
86
-
87
- **Input**: Component URL or ID
88
- **Process**: Parse URL → Extract file ID + node ID → Call MCP `getNode(fileId, nodeId)` → Extract properties/variants
89
- **Output**: Component metadata (properties, variants, styles)
90
-
91
- ### Extract Design Tokens
92
-
93
- **Input**: Figma file URL
94
- **Process**: Get file variables → Map to Style Dictionary format → Generate tokens.json
95
- **Output**: tokens.json with all design tokens
96
-
97
- ### Generate Code from Frame
98
-
99
- **Input**: Frame URL
100
- **Process**: Extract frame layout/styles → Call MCP `generateCode(frameUrl)` → Return code
101
- **Output**: Code string (HTML/CSS/React/etc.)
102
-
103
- ## Error Handling
104
-
105
- **Common errors**:
106
- - Invalid Figma token → Request user to set `FIGMA_ACCESS_TOKEN`
107
- - File not found → Verify URL and permissions
108
- - Rate limit → Wait and retry
109
- - MCP server offline → Check connection
110
-
111
- ## Usage Examples
112
-
113
- ### Example 1: Read Design System
114
- ```typescript
115
- const figmaUrl = "https://figma.com/file/ABC123/Design-System";
116
- const file = await figmaMCP.getFile(figmaUrl);
117
- const tokens = await figmaMCP.extractTokens(file);
118
- // tokens.json generated
119
- ```
120
-
121
- ### Example 2: Generate Component Code
122
- ```typescript
123
- const componentUrl = "https://figma.com/file/ABC123?node-id=1:23";
124
- const component = await figmaMCP.getNode(componentUrl);
125
- const code = await figmaMCP.generateCode(component);
126
- // React component code
127
- ```
128
-
129
- ## Integration with Agents
130
-
131
- **figma-designer agent**: Uses this skill to create Figma files, add components/variables
132
- **figma-implementer agent**: Uses this skill to read Figma files, extract design data
133
-
134
- ## Test Cases
135
-
136
- See `test-cases/` for validation scenarios.
@@ -1,128 +0,0 @@
1
- ---
2
- name: figma-to-code
3
- description: Converts Figma designs to production-ready code (React/Angular). Generates design tokens, components, and TypeScript interfaces from Figma files. Parses component hierarchy, maps properties to props, generates TypeScript types. Activates for figma to code, convert figma to react, figma to angular, implement design, code generation.
4
- ---
5
-
6
- # Figma to Code Skill
7
-
8
- This skill converts Figma designs to production-ready code (React/Angular).
9
-
10
- ## Supported Frameworks
11
-
12
- - React (TypeScript)
13
- - Angular (Standalone Components)
14
- - Vue (Composition API) - coming soon
15
- - Svelte - coming soon
16
-
17
- ## Conversion Process
18
-
19
- ### 1. Parse Figma Data
20
-
21
- **Input**: Figma file metadata (from figma-mcp-connector)
22
-
23
- **Extract**:
24
- - Variables → Design tokens
25
- - Components → Component hierarchy
26
- - Styles → CSS/styling objects
27
- - Properties → Component props
28
-
29
- ### 2. Generate Design Tokens
30
-
31
- **For each token category**:
32
-
33
- **Colors**:
34
- ```typescript
35
- // Figma: color/primary/500 = #3b82f6
36
- // → CSS: --color-primary-500: #3b82f6;
37
- // → Tailwind: colors: { primary: { 500: '#3b82f6' } }
38
- // → TypeScript: export const colors = { primary: { 500: '#3b82f6' } };
39
- ```
40
-
41
- **Typography**:
42
- ```typescript
43
- // Figma: Heading 1 (36px, Bold, 1.2 line height)
44
- // → CSS: --font-size-heading1: 2.25rem; --line-height-heading1: 1.2; --font-weight-heading1: 700;
45
- // → TypeScript: export const typography = { heading1: { fontSize: '2.25rem', lineHeight: '1.2', fontWeight: '700' } };
46
- ```
47
-
48
- ### 3. Generate Components
49
-
50
- **Mapping**:
51
-
52
- | Figma | React | Angular |
53
- |-------|-------|---------|
54
- | Component | Component | Component |
55
- | Variant | Prop value | Input |
56
- | Property | Prop | Input |
57
- | Boolean | boolean prop | boolean Input |
58
- | Text | children/prop | Content/Input |
59
- | Instance | Component usage | Component usage |
60
-
61
- **Example**: Figma Button → React ButtonProps (variant, size, disabled, children)
62
-
63
- ### 4. Generate Styles
64
-
65
- **CSS Modules**:
66
- ```css
67
- .button { @apply rounded-md font-medium transition-colors; }
68
- .primary { @apply bg-primary-500 text-white hover:bg-primary-600; }
69
- ```
70
-
71
- **Tailwind**: Utility-first classes
72
- ```typescript
73
- const variantStyles = { primary: 'bg-primary-500 text-white hover:bg-primary-600' };
74
- ```
75
-
76
- ### 5. Generate TypeScript Interfaces
77
-
78
- **Export all types**:
79
- ```typescript
80
- export type ButtonVariant = 'primary' | 'secondary' | 'text';
81
- export type ButtonSize = 'sm' | 'md' | 'lg';
82
- export interface ButtonProps { variant?: ButtonVariant; size?: ButtonSize; ... }
83
- ```
84
-
85
- ## Layout Conversion
86
-
87
- ### Auto Layout → Flexbox/Grid
88
-
89
- **Figma Auto Layout**: Direction, spacing, padding, alignment
90
- **→ CSS**: `display: flex; flex-direction: row; gap: 1rem; padding: 1.5rem; align-items: center;`
91
- **→ Tailwind**: `flex flex-row gap-4 p-6 items-center`
92
-
93
- ### Constraints → Responsive Design
94
-
95
- **Figma Constraints**: Left + Right → `w-full`, Top + Bottom → `h-full`, Center → `mx-auto`
96
-
97
- ## Best Practices
98
-
99
- 1. **Use Design Tokens**: Never hardcode values, reference tokens, support theme switching
100
- 2. **Type Safety**: Generate TypeScript interfaces, export all types, use strict mode
101
- 3. **Accessibility**: Add ARIA labels, support keyboard navigation, ensure color contrast
102
- 4. **Component Structure**: One component per file, co-locate styles/types, export from index.ts
103
- 5. **Documentation**: JSDoc comments, usage examples, props documentation
104
-
105
- ## Output Structure
106
-
107
- ```
108
- src/
109
- ├── design-tokens/ (tokens.ts, theme.css, types.ts)
110
- ├── components/
111
- │ ├── atoms/ (Button/, Input/, ...)
112
- │ ├── molecules/ (FormField/, Card/, ...)
113
- │ └── organisms/ (Navigation/, Hero/, ...)
114
- └── types/ (design-system.ts)
115
- ```
116
-
117
- ## Integration with figma-implementer
118
-
119
- This skill is used by the `figma-implementer` agent to:
120
- 1. Parse Figma component data
121
- 2. Generate design token files
122
- 3. Create component scaffolds
123
- 4. Map Figma properties to props
124
- 5. Generate TypeScript interfaces
125
-
126
- ## Test Cases
127
-
128
- See `test-cases/` for validation scenarios.