@kood/claude-code 0.3.15 → 0.3.17
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/dist/index.js +6 -3
- package/package.json +1 -1
- package/templates/.claude/skills/figma-to-code/SKILL.md +482 -0
- package/templates/.claude/skills/figma-to-code/references/design-tokens.md +400 -0
- package/templates/.claude/skills/figma-to-code/references/figma-mcp-tools.md +285 -0
- package/templates/.claude/skills/figma-to-code/references/layout-mapping.md +557 -0
- package/templates/.claude/skills/figma-to-code/references/responsive-design.md +364 -0
- package/templates/.claude/skills/figma-to-code/references/verification.md +219 -0
- package/templates/nextjs/docs/skills/figma-to-code/SKILL.md +482 -0
- package/templates/nextjs/docs/skills/figma-to-code/references/design-tokens.md +400 -0
- package/templates/nextjs/docs/skills/figma-to-code/references/figma-mcp-tools.md +285 -0
- package/templates/nextjs/docs/skills/figma-to-code/references/layout-mapping.md +557 -0
- package/templates/nextjs/docs/skills/figma-to-code/references/responsive-design.md +364 -0
- package/templates/nextjs/docs/skills/figma-to-code/references/verification.md +219 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/SKILL.md +482 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/references/design-tokens.md +400 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/references/figma-mcp-tools.md +285 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/references/layout-mapping.md +557 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/references/responsive-design.md +364 -0
- package/templates/tanstack-start/docs/skills/figma-to-code/references/verification.md +219 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
# Figma → Code (100% Pixel-Perfect)
|
|
2
|
+
|
|
3
|
+
<context>
|
|
4
|
+
|
|
5
|
+
**Purpose:** Convert Figma designs to 100% accurate code. Extract design tokens/layouts/assets via Figma MCP to ensure pixel-perfect accuracy.
|
|
6
|
+
|
|
7
|
+
**Trigger:** Implementing Figma designs, generating design system code, developing UI components
|
|
8
|
+
|
|
9
|
+
**Key Features:**
|
|
10
|
+
- Pixel-perfect accuracy (no approximations)
|
|
11
|
+
- Automatic design token extraction (Variables, Styles)
|
|
12
|
+
- Real asset downloads (no AI-generated assets)
|
|
13
|
+
- Accurate Auto Layout → Flexbox/Grid mapping
|
|
14
|
+
- Responsive design implementation required
|
|
15
|
+
- Asset WebP compression and structured organization
|
|
16
|
+
|
|
17
|
+
**Critical Rules (must be followed):**
|
|
18
|
+
1. Do not arbitrarily interpret designs or create "similar-looking" versions
|
|
19
|
+
2. Use only precise values extracted from Figma for all measurements
|
|
20
|
+
3. Implement responsive breakpoints for all devices (mobile/tablet/desktop)
|
|
21
|
+
4. Always compress images to WebP and organize in appropriate folders
|
|
22
|
+
5. Use only Figma assets (AI-generated assets absolutely forbidden)
|
|
23
|
+
|
|
24
|
+
</context>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<prerequisites>
|
|
29
|
+
|
|
30
|
+
## Pre-requisites
|
|
31
|
+
|
|
32
|
+
### Verify Figma MCP Connection
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Desktop MCP (local, selection-based)
|
|
36
|
+
claude mcp add --transport http figma-desktop http://127.0.0.1:3845/mcp
|
|
37
|
+
|
|
38
|
+
# Remote MCP (cloud)
|
|
39
|
+
claude mcp add --transport http figma-remote-mcp https://mcp.figma.com/mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Enable Desktop MCP:**
|
|
43
|
+
1. Launch Figma Desktop app
|
|
44
|
+
2. Open file → Switch to Dev Mode
|
|
45
|
+
3. In Inspect panel, click "Enable desktop MCP server"
|
|
46
|
+
|
|
47
|
+
### Organize Figma File Structure (Designer Guide)
|
|
48
|
+
|
|
49
|
+
| Item | Requirement |
|
|
50
|
+
|------|-------------|
|
|
51
|
+
| **Auto Layout** | Apply Auto Layout to all Frames |
|
|
52
|
+
| **Variables** | Define colors/spacing/font sizes as Variables |
|
|
53
|
+
| **Components** | Separate reusable elements as Components |
|
|
54
|
+
| **Naming** | Layer names in PascalCase (Button, CardHeader) |
|
|
55
|
+
| **Annotations** | Document interactions (hover, click) in comments |
|
|
56
|
+
|
|
57
|
+
</prerequisites>
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
<workflow>
|
|
62
|
+
|
|
63
|
+
## Workflow (5 Phases)
|
|
64
|
+
|
|
65
|
+
### Phase 0: Understand Project Environment
|
|
66
|
+
|
|
67
|
+
**Goal:** Detect Vite/Next.js environment and verify existing tokens
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
1. Detect framework
|
|
71
|
+
- Vite: Check for vite.config.js/ts existence
|
|
72
|
+
- Next.js: Check for next.config.js/ts existence
|
|
73
|
+
|
|
74
|
+
2. Locate globals.css
|
|
75
|
+
Vite:
|
|
76
|
+
- src/index.css
|
|
77
|
+
- src/main.css
|
|
78
|
+
- src/app.css
|
|
79
|
+
|
|
80
|
+
Next.js:
|
|
81
|
+
- app/globals.css (App Router)
|
|
82
|
+
- styles/globals.css (Pages Router)
|
|
83
|
+
|
|
84
|
+
3. Verify existing @theme block
|
|
85
|
+
@import "tailwindcss";
|
|
86
|
+
|
|
87
|
+
@theme {
|
|
88
|
+
--color-primary: #xxx;
|
|
89
|
+
--spacing-md: 16px;
|
|
90
|
+
...
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
4. Verify Tailwind CSS version
|
|
94
|
+
- Confirm v4 usage (tailwindcss: ^4.0.0 in package.json)
|
|
95
|
+
- Recommend upgrade if not v4
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Tailwind v4 Characteristics:**
|
|
99
|
+
- **No Config File**: Remove tailwind.config.js → Write @theme directly in CSS
|
|
100
|
+
- **Auto Class Generation**: `@theme { --color-primary: #xxx; }` → `bg-primary` generated automatically
|
|
101
|
+
- **Integrated globals.css**: Manage all tokens in one place
|
|
102
|
+
|
|
103
|
+
### Phase 1: Extract
|
|
104
|
+
|
|
105
|
+
**Goal:** Extract precise design data from Figma
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
1. Verify Figma file/component selection
|
|
109
|
+
- Desktop MCP: Select target layers before work
|
|
110
|
+
- Remote MCP: Provide file URL
|
|
111
|
+
|
|
112
|
+
2. Extract Variables & Styles
|
|
113
|
+
- Colors: Color Variables → CSS Variables / Tailwind config
|
|
114
|
+
- Typography: Text Styles → font-size, line-height, weight
|
|
115
|
+
- Spacing: Spacing Variables → margin, padding, gap
|
|
116
|
+
|
|
117
|
+
3. Analyze Auto Layout structure
|
|
118
|
+
- Direction: Horizontal → flex-row, Vertical → flex-col
|
|
119
|
+
- Alignment: align-items, justify-content
|
|
120
|
+
- Spacing: gap value
|
|
121
|
+
|
|
122
|
+
4. Create asset list
|
|
123
|
+
- Images: Extract download links
|
|
124
|
+
- Icons: SVG export
|
|
125
|
+
- Logos/Illustrations: PNG/WebP
|
|
126
|
+
- Categorize by type (hero/icons/logos/illustrations)
|
|
127
|
+
|
|
128
|
+
5. Verify responsive breakpoints (required)
|
|
129
|
+
Analyze Figma Constraints:
|
|
130
|
+
- Mobile: 320px ~ 767px
|
|
131
|
+
- Tablet: 768px ~ 1023px
|
|
132
|
+
- Desktop: 1024px+
|
|
133
|
+
|
|
134
|
+
Check each breakpoint:
|
|
135
|
+
- Layout changes (Grid → List, Horizontal → Vertical)
|
|
136
|
+
- Font size changes
|
|
137
|
+
- Spacing adjustments
|
|
138
|
+
- Hidden/visible elements
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Details:** [references/figma-mcp-tools.md](references/figma-mcp-tools.md)
|
|
142
|
+
|
|
143
|
+
### Phase 2: Structure
|
|
144
|
+
|
|
145
|
+
**Goal:** Convert Figma Frame hierarchy → React component structure + Tailwind v4 tokens
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
1. Analyze Frame Hierarchy
|
|
149
|
+
Frame "Header"
|
|
150
|
+
├─ Frame "Logo" → <div className="logo">
|
|
151
|
+
├─ Frame "Navigation" → <nav>
|
|
152
|
+
└─ Frame "Actions" → <div className="actions">
|
|
153
|
+
|
|
154
|
+
2. Design Tokens → @theme block (Tailwind v4)
|
|
155
|
+
|
|
156
|
+
A. Verify globals.css
|
|
157
|
+
- If existing @theme block exists, merge with it
|
|
158
|
+
- Otherwise, create new one
|
|
159
|
+
|
|
160
|
+
B. Map Figma Variables → @theme
|
|
161
|
+
|
|
162
|
+
Vite (src/index.css or src/main.css):
|
|
163
|
+
```css
|
|
164
|
+
@import "tailwindcss";
|
|
165
|
+
|
|
166
|
+
@theme {
|
|
167
|
+
/* Figma Color Variables */
|
|
168
|
+
--color-primary: #3182F6;
|
|
169
|
+
--color-secondary: #64748B;
|
|
170
|
+
--color-success: #22C55E;
|
|
171
|
+
|
|
172
|
+
/* Figma Spacing Variables */
|
|
173
|
+
--spacing-xs: 4px;
|
|
174
|
+
--spacing-sm: 8px;
|
|
175
|
+
--spacing-md: 16px;
|
|
176
|
+
--spacing-lg: 24px;
|
|
177
|
+
|
|
178
|
+
/* Figma Typography Variables */
|
|
179
|
+
--font-size-body: 14px;
|
|
180
|
+
--font-size-heading: 28px;
|
|
181
|
+
--font-weight-regular: 400;
|
|
182
|
+
--font-weight-semibold: 600;
|
|
183
|
+
|
|
184
|
+
/* Prevent conflicts with existing tokens */
|
|
185
|
+
/* --color-brand: #xxx; (existing) */
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Next.js (app/globals.css):
|
|
190
|
+
```css
|
|
191
|
+
@import "tailwindcss";
|
|
192
|
+
|
|
193
|
+
@theme {
|
|
194
|
+
/* Same structure */
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
C. Verify auto class generation
|
|
199
|
+
@theme { --color-primary: #3182F6; }
|
|
200
|
+
→ bg-primary, text-primary, border-primary generated automatically
|
|
201
|
+
|
|
202
|
+
D. Merge existing globals.css tokens
|
|
203
|
+
```css
|
|
204
|
+
@theme {
|
|
205
|
+
/* Existing tokens (maintain) */
|
|
206
|
+
--color-brand: #FF5733;
|
|
207
|
+
|
|
208
|
+
/* Tokens extracted from Figma (add) */
|
|
209
|
+
--color-primary: #3182F6;
|
|
210
|
+
--spacing-md: 16px;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
3. Component separation criteria
|
|
215
|
+
- Reusable → Separate component
|
|
216
|
+
- Used once → Inline
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Details:**
|
|
220
|
+
- [references/design-tokens.md](references/design-tokens.md)
|
|
221
|
+
- [references/layout-mapping.md](references/layout-mapping.md)
|
|
222
|
+
|
|
223
|
+
### Phase 3: Implement
|
|
224
|
+
|
|
225
|
+
**Goal:** Write code with exact measurements
|
|
226
|
+
|
|
227
|
+
#### Layout Implementation
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
// ❌ Arbitrary values
|
|
231
|
+
<div className="flex gap-4 p-6">
|
|
232
|
+
|
|
233
|
+
// ✅ Precise Figma values
|
|
234
|
+
<div className="flex gap-[18px] p-[24px]">
|
|
235
|
+
</div>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Color Implementation
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
// ❌ Similar color
|
|
242
|
+
<button className="bg-blue-500">
|
|
243
|
+
|
|
244
|
+
// ✅ @theme token (Tailwind v4)
|
|
245
|
+
<button className="bg-primary">
|
|
246
|
+
|
|
247
|
+
// ✅ Or precise HEX
|
|
248
|
+
<button className="bg-[#3182F6]">
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Typography Implementation
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
// ❌ Approximation
|
|
255
|
+
<h1 className="text-2xl font-bold">
|
|
256
|
+
|
|
257
|
+
// ✅ Exact values
|
|
258
|
+
<h1 className="text-[28px] leading-[36px] font-semibold tracking-[-0.02em]">
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Asset Handling (Required)
|
|
262
|
+
|
|
263
|
+
**1. Download Assets from Figma**
|
|
264
|
+
```bash
|
|
265
|
+
# Generate download link via Figma MCP
|
|
266
|
+
get_images → Obtain download URL
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**2. WebP Compression (Required)**
|
|
270
|
+
```bash
|
|
271
|
+
# Using cwebp (Google WebP)
|
|
272
|
+
cwebp -q 80 input.png -o output.webp
|
|
273
|
+
|
|
274
|
+
# Or ImageMagick
|
|
275
|
+
convert input.png -quality 80 output.webp
|
|
276
|
+
|
|
277
|
+
# Batch conversion
|
|
278
|
+
for file in *.png; do cwebp -q 80 "$file" -o "${file%.png}.webp"; done
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Compression Quality Guide:**
|
|
282
|
+
| Use Case | Quality | Size |
|
|
283
|
+
|----------|---------|------|
|
|
284
|
+
| Hero images | 85-90 | High quality |
|
|
285
|
+
| General images | 75-85 | Balanced |
|
|
286
|
+
| Thumbnails | 60-75 | Optimized |
|
|
287
|
+
|
|
288
|
+
**3. Organize public Folder (Required)**
|
|
289
|
+
```
|
|
290
|
+
public/
|
|
291
|
+
├── images/
|
|
292
|
+
│ ├── hero/ # Hero section images
|
|
293
|
+
│ │ ├── banner.webp
|
|
294
|
+
│ │ └── background.webp
|
|
295
|
+
│ ├── products/ # Product images
|
|
296
|
+
│ │ ├── product-1.webp
|
|
297
|
+
│ │ └── product-2.webp
|
|
298
|
+
│ ├── team/ # Team photos
|
|
299
|
+
│ │ └── member-1.webp
|
|
300
|
+
│ └── thumbnails/ # Thumbnails
|
|
301
|
+
│ └── thumb-1.webp
|
|
302
|
+
├── icons/ # Icons (SVG)
|
|
303
|
+
│ ├── social/
|
|
304
|
+
│ │ ├── facebook.svg
|
|
305
|
+
│ │ └── twitter.svg
|
|
306
|
+
│ └── ui/
|
|
307
|
+
│ ├── arrow.svg
|
|
308
|
+
│ └── close.svg
|
|
309
|
+
└── logos/ # Logos
|
|
310
|
+
├── logo.svg
|
|
311
|
+
└── logo-white.svg
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**4. Use in Code**
|
|
315
|
+
```tsx
|
|
316
|
+
// ❌ AI-generated/arbitrary images
|
|
317
|
+
<img src="/placeholder.jpg" alt="Hero" />
|
|
318
|
+
|
|
319
|
+
// ✅ Real Figma assets + WebP + organized path
|
|
320
|
+
<img
|
|
321
|
+
src="/images/hero/banner.webp"
|
|
322
|
+
alt="Hero Banner"
|
|
323
|
+
width={1200}
|
|
324
|
+
height={600}
|
|
325
|
+
loading="lazy"
|
|
326
|
+
/>
|
|
327
|
+
|
|
328
|
+
// Icons
|
|
329
|
+
<img src="/icons/ui/arrow.svg" alt="" width={24} height={24} />
|
|
330
|
+
|
|
331
|
+
// Logo
|
|
332
|
+
<img src="/logos/logo.svg" alt="Company Logo" width={120} height={40} />
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**5. Responsive Images**
|
|
336
|
+
```tsx
|
|
337
|
+
<picture>
|
|
338
|
+
<source media="(min-width: 1024px)" srcSet="/images/hero/banner-desktop.webp" />
|
|
339
|
+
<source media="(min-width: 768px)" srcSet="/images/hero/banner-tablet.webp" />
|
|
340
|
+
<img src="/images/hero/banner-mobile.webp" alt="Hero" />
|
|
341
|
+
</picture>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Phase 4: Verify
|
|
345
|
+
|
|
346
|
+
**Goal:** Validate design and code accuracy
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
Checklist:
|
|
350
|
+
□ Colors: Compare Figma Color Picker with DevTools
|
|
351
|
+
□ Spacing: All margin/padding/gap values match exactly
|
|
352
|
+
□ Typography: size, weight, line-height match precisely
|
|
353
|
+
□ Layout: Auto Layout structure reflected in code
|
|
354
|
+
|
|
355
|
+
□ Assets (Required):
|
|
356
|
+
□ Use actual files downloaded from Figma
|
|
357
|
+
□ WebP compression completed (PNG/JPG → WebP)
|
|
358
|
+
□ public/ folder organized (images/icons/logos)
|
|
359
|
+
□ Clear filenames (hero-banner.webp, product-1.webp)
|
|
360
|
+
□ Appropriate compression quality (hero: 85-90, general: 75-85)
|
|
361
|
+
|
|
362
|
+
□ Responsive (Required):
|
|
363
|
+
□ Mobile (320-767px) layout verified
|
|
364
|
+
□ Tablet (768-1023px) layout verified
|
|
365
|
+
□ Desktop (1024px+) layout verified
|
|
366
|
+
□ Media query breakpoints exact
|
|
367
|
+
□ Responsive images (<picture> or srcSet)
|
|
368
|
+
□ All devices match Figma design
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Details:** [references/verification.md](references/verification.md)
|
|
372
|
+
|
|
373
|
+
</workflow>
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
<best_practices>
|
|
378
|
+
|
|
379
|
+
## Best Practices
|
|
380
|
+
|
|
381
|
+
### DO
|
|
382
|
+
|
|
383
|
+
| Principle | Description |
|
|
384
|
+
|-----------|-------------|
|
|
385
|
+
| **Exact Values** | Use `px-[18px]` instead of `px-4` (exact value) |
|
|
386
|
+
| **@theme First** | Figma Variables → @theme block (Tailwind v4) |
|
|
387
|
+
| **Merge Existing Tokens** | Maintain existing globals.css tokens + merge new ones |
|
|
388
|
+
| **Extract Before Implement** | Complete all token/asset extraction before coding |
|
|
389
|
+
| **WebP Only** | Compress all images to WebP (PNG/JPG forbidden) |
|
|
390
|
+
| **Structured Assets** | Organize with public/images/[category]/ folder structure |
|
|
391
|
+
| **Responsive Required** | Implement all three breakpoints (Mobile/Tablet/Desktop) |
|
|
392
|
+
| **Cross-Validate** | Figma Dev Mode + MCP + manual verification |
|
|
393
|
+
| **Document Mapping** | Annotate with Figma properties in comments |
|
|
394
|
+
|
|
395
|
+
### DON'T
|
|
396
|
+
|
|
397
|
+
| Forbidden | Reason |
|
|
398
|
+
|-----------|--------|
|
|
399
|
+
| **Use Approximations** | "Similar values" cause design mismatches |
|
|
400
|
+
| **AI-Generated Assets** | Use only real assets created by designers |
|
|
401
|
+
| **PNG/JPG Files** | Must compress to WebP before use |
|
|
402
|
+
| **Images in public/ Root** | Folder structure required (images/icons/logos) |
|
|
403
|
+
| **Skip Responsive** | All three breakpoints are mandatory |
|
|
404
|
+
| **Arbitrary Interpretation** | Ignore Auto Layout and use manual layout |
|
|
405
|
+
| **Tailwind Defaults** | Use exact `gap-[18px]` not `gap-4` |
|
|
406
|
+
| **Use tailwind.config.js** | Tailwind v4 uses @theme block |
|
|
407
|
+
| **Overwrite Existing Tokens** | Maintain existing globals.css tokens |
|
|
408
|
+
|
|
409
|
+
### Prompt Example
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
Convert this Figma component to code.
|
|
413
|
+
|
|
414
|
+
Environment:
|
|
415
|
+
- Vite/Next.js (verify project structure)
|
|
416
|
+
- Tailwind CSS v4 in use
|
|
417
|
+
- Maintain existing globals.css tokens
|
|
418
|
+
|
|
419
|
+
Critical Rules (must follow):
|
|
420
|
+
1. Phase 0: Understand project environment (Vite/Next.js, globals.css location)
|
|
421
|
+
2. Phase 1: Extract Variables, Text Styles, Auto Layout, breakpoints via Figma MCP
|
|
422
|
+
3. Phase 2: Add tokens to @theme block (merge with existing tokens)
|
|
423
|
+
4. Phase 3: All measurements match exactly (no approximations)
|
|
424
|
+
|
|
425
|
+
Asset Handling (Required):
|
|
426
|
+
- Download from Figma (absolutely no AI-generated assets)
|
|
427
|
+
- Compress PNG/JPG → WebP (quality 75-90)
|
|
428
|
+
- Organize in public/images/[category]/
|
|
429
|
+
- Clear filenames (hero-banner.webp, product-1.webp)
|
|
430
|
+
|
|
431
|
+
Responsive (Required):
|
|
432
|
+
- Mobile (320-767px): Verify layout changes
|
|
433
|
+
- Tablet (768-1023px): Verify layout changes
|
|
434
|
+
- Desktop (1024px+): Verify layout changes
|
|
435
|
+
- Responsive images (<picture> or srcSet)
|
|
436
|
+
|
|
437
|
+
Validation:
|
|
438
|
+
- Colors/spacing/typography: 100% match with Figma
|
|
439
|
+
- Assets: WebP compression and folder structure confirmed
|
|
440
|
+
- Responsive: All devices match Figma design
|
|
441
|
+
- @theme tokens auto-generate classes
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
</best_practices>
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
<troubleshooting>
|
|
449
|
+
|
|
450
|
+
## Troubleshooting
|
|
451
|
+
|
|
452
|
+
| Problem | Cause | Solution |
|
|
453
|
+
|---------|-------|----------|
|
|
454
|
+
| MCP not connecting | Desktop MCP not enabled | Enable in Figma Dev Mode |
|
|
455
|
+
| Color mismatch | Using direct colors instead of Variables | Extract Variables first |
|
|
456
|
+
| Spacing error | Using Tailwind defaults | Override with exact px values |
|
|
457
|
+
| Layout broken | Ignoring Auto Layout structure | Convert Frame hierarchy directly |
|
|
458
|
+
| Missing assets | Export settings not verified | Verify Export Settings before download |
|
|
459
|
+
|
|
460
|
+
</troubleshooting>
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
<references>
|
|
465
|
+
|
|
466
|
+
## Detailed Documentation
|
|
467
|
+
|
|
468
|
+
| Document | Content |
|
|
469
|
+
|----------|---------|
|
|
470
|
+
| [figma-mcp-tools.md](references/figma-mcp-tools.md) | Figma MCP tools usage, API endpoints |
|
|
471
|
+
| [design-tokens.md](references/design-tokens.md) | Variables/Styles extraction and Tailwind v4 mapping |
|
|
472
|
+
| [layout-mapping.md](references/layout-mapping.md) | Auto Layout → Flexbox/Grid conversion rules |
|
|
473
|
+
| [responsive-design.md](references/responsive-design.md) | Responsive implementation guide (breakpoints, images) |
|
|
474
|
+
| [verification.md](references/verification.md) | Design-code accuracy verification checklist |
|
|
475
|
+
|
|
476
|
+
## External References
|
|
477
|
+
|
|
478
|
+
- [Figma MCP Server Documentation](https://developers.figma.com/docs/figma-mcp-server/)
|
|
479
|
+
- [Design Tokens with Figma](https://blog.prototypr.io/design-tokens-with-figma-aef25c42430f)
|
|
480
|
+
- [Pixel-Perfect Code Generation Guide](https://medium.com/@reuvenaor85/the-way-to-figma-mcp-pixel-perfect-code-generation-for-react-tailwind-1623fd5383b8)
|
|
481
|
+
|
|
482
|
+
</references>
|