@efectoapp/mcp-studio 0.1.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.
@@ -0,0 +1,802 @@
1
+ # Efecto Studio — Design Web Pages with AI
2
+
3
+ Efecto Studio is a real-time web design tool that AI agents control programmatically. You create a **session**, the user opens a URL in their browser, and you push design commands that render instantly. Every node maps to a real HTML element styled with Tailwind CSS — web-native, semantic, and pixel-accurate.
4
+
5
+ **Prerequisite**: The `efectostudio` MCP server must be configured (`npx @efectoapp/mcp-studio install`), or you must have access to the Studio session REST API.
6
+
7
+ ---
8
+
9
+ ## How Sessions Work
10
+
11
+ ```
12
+ Agent ──POST /execute──> Server ──SSE──> Browser (renders live)
13
+ Agent <──poll/response── Server <──POST── Browser (returns results)
14
+ ```
15
+
16
+ 1. You create a session via the MCP server or REST API
17
+ 2. The user opens the returned Studio URL in their browser
18
+ 3. You push tool calls — each one executes in the browser and returns a result
19
+ 4. The user sees every change live as you build the design
20
+
21
+ Sessions expire after 15 minutes of inactivity. The browser must be connected before tool calls can execute.
22
+
23
+ ---
24
+
25
+ ## Quick Start — Build a Page in 7 Steps
26
+
27
+ ### Step 1: Create a Session
28
+ ```
29
+ create_session
30
+ label: "Landing page design"
31
+ ```
32
+ Returns `{ sessionId, studioUrl }`. Tell the user to open `studioUrl`. The session ID is stored automatically — all subsequent tools use it.
33
+
34
+ ### Step 2: Wait for Browser Connection
35
+ ```
36
+ session_status
37
+ ```
38
+ Poll until `browserConnected: true`. The browser must be open before you can push tools.
39
+
40
+ ### Step 3: Create an Artboard
41
+ ```
42
+ create_artboard
43
+ name: "Homepage"
44
+ width: 1440
45
+ height: 900
46
+ backgroundColor: "#ffffff"
47
+ className: "flex flex-col"
48
+ ```
49
+ Returns the artboard ID. **Always set className to "flex flex-col"** so children stack vertically.
50
+
51
+ ### Step 4: Add Sections with JSX
52
+ ```
53
+ add_section
54
+ parentId: "<artboard-id>"
55
+ jsx: '<nav className="flex items-center justify-between px-16 py-5 bg-white w-full">
56
+ <h2 className="text-xl font-bold text-gray-900">Acme</h2>
57
+ <div className="flex items-center gap-8">
58
+ <a className="text-sm text-gray-600" href="#">Features</a>
59
+ <a className="text-sm text-gray-600" href="#">Pricing</a>
60
+ <button className="px-4 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg">Get Started</button>
61
+ </div>
62
+ </nav>'
63
+ ```
64
+ This is the most efficient way to build complex layouts — one JSX string per section.
65
+
66
+ ### Step 5: Read Current State
67
+ ```
68
+ get_document
69
+ ```
70
+ Returns JSX-like markup with `data-id` attributes on every node. Use these IDs for updates.
71
+
72
+ ### Step 6: Fine-Tune with Updates
73
+ ```
74
+ batch_update
75
+ updates: [
76
+ { nodeId: "abc", className: "text-2xl font-extrabold text-gray-900" },
77
+ { nodeId: "def", textContent: "Updated heading text" }
78
+ ]
79
+ ```
80
+
81
+ ### Step 7: Iterate
82
+ Repeat Steps 4-6 to add more sections, adjust styling, and refine the design. The user sees every change in real time.
83
+
84
+ ---
85
+
86
+ ## The 33 Studio Tools
87
+
88
+ ### Reading State
89
+
90
+ | Tool | Purpose |
91
+ |------|---------|
92
+ | `get_document` | Returns full document as JSX with data-id attributes |
93
+ | `list_artboards` | Lists all artboards with IDs, names, dimensions |
94
+ | `find_nodes` | Search nodes by name, text content, type, or className |
95
+
96
+ ### Creating Content
97
+
98
+ | Tool | Purpose |
99
+ |------|---------|
100
+ | `create_artboard` | Creates a new artboard (screen/frame) |
101
+ | `add_section` | Adds complex layouts from JSX markup (preferred) |
102
+ | `add_node` | Adds a single node to a parent |
103
+
104
+ ### Modifying Content
105
+
106
+ | Tool | Purpose |
107
+ |------|---------|
108
+ | `update_node` | Updates any node property (className, textContent, tag, style, src, etc.) |
109
+ | `update_class` | Shortcut: replaces only className on a node |
110
+ | `update_artboard` | Updates artboard properties (name, size, background, className) |
111
+ | `batch_update` | Updates multiple nodes in one call (bulk styling) |
112
+ | `replace_section` | Replaces a node and its children with new JSX |
113
+
114
+ ### Organizing Structure
115
+
116
+ | Tool | Purpose |
117
+ |------|---------|
118
+ | `move_node` | Reparents or reorders a node |
119
+ | `duplicate_node` | Deep-clones a node with fresh IDs |
120
+ | `duplicate_artboard` | Deep-clones an artboard for variations |
121
+ | `group_nodes` | Wraps selected nodes in a frame container |
122
+ | `ungroup_node` | Unwraps a group, moving children to parent |
123
+ | `reorder_node` | Brings to front or sends to back (z-order) |
124
+
125
+ ### Display & Selection
126
+
127
+ | Tool | Purpose |
128
+ |------|---------|
129
+ | `select_nodes` | Highlights nodes for the user to see |
130
+ | `set_visibility` | Shows/hides nodes (like Figma eye icon) |
131
+ | `delete_nodes` | Deletes nodes and their children |
132
+ | `delete_artboard` | Deletes an artboard and all contents |
133
+
134
+ ### Alignment & Distribution
135
+
136
+ | Tool | Purpose |
137
+ |------|---------|
138
+ | `align_nodes` | Aligns multiple nodes (left/center/right/top/middle/bottom) |
139
+ | `distribute_nodes` | Distributes nodes evenly (horizontal/vertical) |
140
+
141
+ ### History
142
+
143
+ | Tool | Purpose |
144
+ |------|---------|
145
+ | `undo` | Undoes the last action (Cmd+Z) |
146
+ | `redo` | Redoes the last undone action (Cmd+Shift+Z) |
147
+
148
+ ### Viewport & Document
149
+
150
+ | Tool | Purpose |
151
+ |------|---------|
152
+ | `zoom_to_artboard` | Zooms viewport to show a specific artboard |
153
+ | `zoom_to_fit` | Zooms to fit all artboards in the viewport |
154
+ | `set_viewport` | Sets viewport zoom level and/or pan position |
155
+ | `rename_document` | Renames the Studio document |
156
+ | `new_document` | Creates a new blank document (replaces current) |
157
+
158
+ ### Canvas & Reading
159
+
160
+ | Tool | Purpose |
161
+ |------|---------|
162
+ | `move_artboard` | Repositions an artboard on the canvas for multi-screen flows |
163
+ | `deselect_all` | Clears the current node selection |
164
+ | `get_node_tree` | Returns JSX for one node/artboard subtree (faster than full document) |
165
+
166
+ ---
167
+
168
+ ## Node Types & HTML Tags
169
+
170
+ Every node maps 1:1 to an HTML element. The `type` determines behavior; the `tag` determines which HTML element renders.
171
+
172
+ | Type | Default Tag | All Valid Tags | Content Property |
173
+ |------|-------------|----------------|-----------------|
174
+ | **frame** | `div` | div, section, article, aside, main, nav, header, footer, ul, ol, li, figure, figcaption, form, table, thead, tbody, tr, th, td | (none — pure container) |
175
+ | **text** | `p` | p, span, h1, h2, h3, h4, h5, h6, blockquote, label, li | `textContent` |
176
+ | **image** | `img` | img | `src`, `alt`, `objectFit` |
177
+ | **button** | `button` | button, a, div | `textContent`, `variant` |
178
+ | **link** | `a` | a, button, div, span | `textContent`, `href`, `target` |
179
+ | **icon** | `svg` | svg, div | `iconName` (Phosphor, PascalCase) |
180
+ | **input** | `input` | input, textarea, select | `placeholder`, `inputType`, `label` |
181
+ | **video** | `video` | video | `src`, `poster`, `autoPlay`, `loop`, `muted` |
182
+ | **component** | `div` | div | `componentId`, `overrides` |
183
+
184
+ ### Tag Determines Type in JSX
185
+
186
+ When writing JSX for `add_section`, the HTML tag determines the node type:
187
+
188
+ ```
189
+ <div> -> frame <img> -> image
190
+ <section> -> frame <button> -> button
191
+ <nav> -> frame <a> -> link
192
+ <header> -> frame <input> -> input
193
+ <footer> -> frame <video> -> video
194
+ <h1>-<h6> -> text <svg> -> icon
195
+ <p> -> text
196
+ <span> -> text
197
+ ```
198
+
199
+ ---
200
+
201
+ ## The `add_section` JSX Format
202
+
203
+ This is the primary way to build layouts. Write standard JSX with HTML tags and Tailwind `className` attributes.
204
+
205
+ ### Format Rules
206
+
207
+ 1. **Use HTML tags** — div, section, nav, h1, p, img, button, a, etc.
208
+ 2. **Style with className** — Tailwind CSS classes only
209
+ 3. **Text goes between tags** — `<h1 className="...">Hello</h1>`
210
+ 4. **Images are self-closing** — `<img src="https://..." alt="..." className="..." />`
211
+ 5. **Use `data-id`** only when referencing existing nodes (from `get_document`)
212
+ 6. **No React-specific syntax** — no `onClick`, `useState`, fragments, or components
213
+
214
+ ### Example: Complete Section
215
+
216
+ ```jsx
217
+ <section className="flex flex-col items-center gap-12 px-16 py-24 bg-white w-full">
218
+ <div className="flex flex-col items-center gap-4 max-w-2xl">
219
+ <span className="text-sm font-semibold text-blue-600 uppercase tracking-widest">Why Choose Us</span>
220
+ <h2 className="text-4xl font-bold text-gray-900 text-center">Everything you need to scale</h2>
221
+ <p className="text-lg text-gray-500 text-center">Built for modern teams that move fast and ship faster.</p>
222
+ </div>
223
+ <div className="flex gap-8 w-full max-w-5xl">
224
+ <div className="flex flex-col gap-3 p-8 bg-gray-50 rounded-2xl grow">
225
+ <h3 className="text-lg font-semibold text-gray-900">Lightning Fast</h3>
226
+ <p className="text-sm text-gray-500">Deploy in seconds, not hours. Our edge network ensures sub-50ms latency worldwide.</p>
227
+ </div>
228
+ <div className="flex flex-col gap-3 p-8 bg-gray-50 rounded-2xl grow">
229
+ <h3 className="text-lg font-semibold text-gray-900">Enterprise Security</h3>
230
+ <p className="text-sm text-gray-500">SOC 2 certified with end-to-end encryption. Your data stays yours.</p>
231
+ </div>
232
+ <div className="flex flex-col gap-3 p-8 bg-gray-50 rounded-2xl grow">
233
+ <h3 className="text-lg font-semibold text-gray-900">24/7 Support</h3>
234
+ <p className="text-sm text-gray-500">Our team is always on. Get answers in minutes, not days.</p>
235
+ </div>
236
+ </div>
237
+ </section>
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Tailwind CSS Patterns That Work
243
+
244
+ ### Layout
245
+ ```
246
+ flex /* Horizontal flex row */
247
+ flex flex-col /* Vertical flex column */
248
+ items-center /* Center cross-axis */
249
+ items-start /* Align to start */
250
+ justify-between /* Space between children */
251
+ justify-center /* Center main-axis */
252
+ gap-2 gap-4 gap-8 /* Gap between flex children */
253
+ grow /* Fill remaining space (DO NOT use flex-1) */
254
+ ```
255
+
256
+ ### Spacing
257
+ ```
258
+ p-4 p-6 p-8 p-12 /* Padding all sides */
259
+ px-6 py-4 /* Horizontal / vertical padding */
260
+ pt-8 pb-16 /* Top / bottom padding */
261
+ mx-auto /* Center horizontally */
262
+ ```
263
+
264
+ ### Sizing
265
+ ```
266
+ w-full /* Full width of parent */
267
+ w-auto /* Width from content */
268
+ w-fit /* Shrink-wrap width */
269
+ w-[600px] /* Fixed pixel width */
270
+ max-w-2xl max-w-5xl /* Maximum width constraints */
271
+ min-h-screen /* Minimum full viewport height */
272
+ h-[400px] /* Fixed pixel height */
273
+ ```
274
+
275
+ ### Typography
276
+ ```
277
+ text-xs text-sm text-base text-lg text-xl text-2xl text-3xl text-4xl text-5xl text-6xl text-7xl text-8xl text-9xl
278
+ font-light font-normal font-medium font-semibold font-bold font-extrabold font-black
279
+ leading-tight leading-snug leading-normal leading-relaxed
280
+ tracking-tight tracking-normal tracking-wide tracking-widest
281
+ text-left text-center text-right
282
+ uppercase lowercase capitalize
283
+ ```
284
+
285
+ ### Colors (NAMED ONLY)
286
+
287
+ Use named Tailwind colors. **Never use arbitrary hex** like `bg-[#f9f9f9]` — it silently fails at runtime.
288
+
289
+ ```
290
+ /* Backgrounds */
291
+ bg-white bg-black bg-gray-50 bg-gray-100 bg-gray-900 bg-neutral-950
292
+ bg-blue-50 bg-blue-500 bg-blue-600 bg-indigo-500 bg-purple-500
293
+ bg-green-50 bg-green-500 bg-red-50 bg-red-500 bg-amber-50 bg-yellow-400
294
+
295
+ /* Text */
296
+ text-white text-black text-gray-400 text-gray-500 text-gray-600 text-gray-700 text-gray-900
297
+ text-blue-600 text-blue-500 text-indigo-600 text-green-600 text-red-600
298
+
299
+ /* Borders */
300
+ border-gray-100 border-gray-200 border-gray-300 border-blue-500
301
+
302
+ /* If you MUST use a specific hex color, use inline style instead: */
303
+ style: { "background-color": "#f9f9f9" }
304
+ ```
305
+
306
+ ### Borders & Radius
307
+ ```
308
+ border border-2 /* Border width */
309
+ border-gray-200 border-gray-300 /* Border color */
310
+ rounded rounded-lg rounded-xl rounded-2xl rounded-full /* Border radius */
311
+ ```
312
+
313
+ ### Effects
314
+ ```
315
+ shadow-sm shadow shadow-md shadow-lg shadow-xl
316
+ opacity-50 opacity-75
317
+ ring-1 ring-2 ring-blue-500 /* Ring / outline */
318
+ ```
319
+
320
+ ### Gradients
321
+ ```
322
+ bg-gradient-to-r from-blue-500 to-purple-500
323
+ bg-gradient-to-b from-white to-gray-50
324
+ bg-gradient-to-br from-indigo-500 via-purple-500 to-pink-500
325
+ ```
326
+
327
+ ---
328
+
329
+ ## Artboard Best Practices
330
+
331
+ ### Standard Sizes
332
+ | Name | Width | Height | Use Case |
333
+ |------|-------|--------|----------|
334
+ | Desktop | 1440 | 900+ | Full website pages |
335
+ | Desktop (narrow) | 1280 | 800+ | Content-focused pages |
336
+ | Tablet | 768 | 1024 | Tablet responsive view |
337
+ | Mobile | 375 | 812 | iPhone / mobile view |
338
+
339
+ ### Always Start With
340
+ ```
341
+ create_artboard:
342
+ name: "Homepage"
343
+ width: 1440
344
+ height: 900
345
+ backgroundColor: "#ffffff"
346
+ className: "flex flex-col"
347
+ ```
348
+
349
+ - **`className: "flex flex-col"`** is essential — without it, children overlap at (0,0)
350
+ - **`backgroundColor`** is an inline style property, NOT a Tailwind class
351
+ - Height grows automatically when content overflows, but set an initial height
352
+
353
+ ---
354
+
355
+ ## Common Section Patterns
356
+
357
+ ### Navigation Bar
358
+
359
+ ```jsx
360
+ <nav className="flex items-center justify-between px-16 py-5 bg-white w-full border-b border-gray-100">
361
+ <h2 className="text-xl font-bold text-gray-900">Acme</h2>
362
+ <div className="flex items-center gap-8">
363
+ <a className="text-sm font-medium text-gray-600" href="#">Features</a>
364
+ <a className="text-sm font-medium text-gray-600" href="#">Pricing</a>
365
+ <a className="text-sm font-medium text-gray-600" href="#">About</a>
366
+ <button className="px-5 py-2.5 text-sm font-medium text-white bg-gray-900 rounded-lg">Get Started</button>
367
+ </div>
368
+ </nav>
369
+ ```
370
+
371
+ ### Hero Section (Centered)
372
+
373
+ ```jsx
374
+ <section className="flex flex-col items-center justify-center gap-8 px-16 py-32 bg-white w-full">
375
+ <div className="flex flex-col items-center gap-6 max-w-3xl">
376
+ <span className="px-4 py-1.5 text-xs font-semibold text-blue-700 bg-blue-50 rounded-full uppercase tracking-wider">Now in Beta</span>
377
+ <h1 className="text-6xl font-bold text-gray-900 text-center leading-tight">Build beautiful websites at the speed of thought</h1>
378
+ <p className="text-xl text-gray-500 text-center">The AI-powered design tool that turns ideas into production-ready pages. No code required.</p>
379
+ </div>
380
+ <div className="flex items-center gap-4">
381
+ <button className="px-8 py-3.5 text-base font-semibold text-white bg-blue-600 rounded-xl">Start Free Trial</button>
382
+ <button className="px-8 py-3.5 text-base font-semibold text-gray-700 bg-white border-2 border-gray-200 rounded-xl">Watch Demo</button>
383
+ </div>
384
+ </section>
385
+ ```
386
+
387
+ ### Hero Section (Split — Text Left, Image Right)
388
+
389
+ ```jsx
390
+ <section className="flex items-center gap-16 px-16 py-24 bg-white w-full">
391
+ <div className="flex flex-col gap-6 grow">
392
+ <h1 className="text-5xl font-bold text-gray-900 leading-tight">Ship your next product in record time</h1>
393
+ <p className="text-lg text-gray-500">From prototype to production in minutes. Our platform handles the complexity so you can focus on what matters.</p>
394
+ <div className="flex items-center gap-4">
395
+ <button className="px-6 py-3 text-base font-semibold text-white bg-gray-900 rounded-lg">Get Started</button>
396
+ <a className="text-base font-medium text-gray-600" href="#">Learn more</a>
397
+ </div>
398
+ </div>
399
+ <img src="https://placehold.co/600x400" alt="Product screenshot" className="w-[560px] h-[380px] rounded-2xl object-cover bg-gray-100" />
400
+ </section>
401
+ ```
402
+
403
+ ### Feature Grid (3 columns)
404
+
405
+ ```jsx
406
+ <section className="flex flex-col items-center gap-16 px-16 py-24 bg-gray-50 w-full">
407
+ <div className="flex flex-col items-center gap-4 max-w-2xl">
408
+ <h2 className="text-4xl font-bold text-gray-900 text-center">Powerful features for modern teams</h2>
409
+ <p className="text-lg text-gray-500 text-center">Everything you need to design, build, and ship — all in one place.</p>
410
+ </div>
411
+ <div className="flex gap-8 w-full max-w-6xl">
412
+ <div className="flex flex-col gap-4 p-8 bg-white rounded-2xl shadow-sm grow">
413
+ <div className="flex items-center justify-center w-12 h-12 bg-blue-100 rounded-xl">
414
+ <span className="text-blue-600 text-lg font-bold">1</span>
415
+ </div>
416
+ <h3 className="text-xl font-semibold text-gray-900">Real-Time Collaboration</h3>
417
+ <p className="text-sm text-gray-500 leading-relaxed">Work together with your team in real time. See cursors, selections, and changes as they happen.</p>
418
+ </div>
419
+ <div className="flex flex-col gap-4 p-8 bg-white rounded-2xl shadow-sm grow">
420
+ <div className="flex items-center justify-center w-12 h-12 bg-green-100 rounded-xl">
421
+ <span className="text-green-600 text-lg font-bold">2</span>
422
+ </div>
423
+ <h3 className="text-xl font-semibold text-gray-900">One-Click Deploy</h3>
424
+ <p className="text-sm text-gray-500 leading-relaxed">Push to production with a single click. Built-in CI/CD, preview deployments, and rollbacks.</p>
425
+ </div>
426
+ <div className="flex flex-col gap-4 p-8 bg-white rounded-2xl shadow-sm grow">
427
+ <div className="flex items-center justify-center w-12 h-12 bg-purple-100 rounded-xl">
428
+ <span className="text-purple-600 text-lg font-bold">3</span>
429
+ </div>
430
+ <h3 className="text-xl font-semibold text-gray-900">AI Assistant</h3>
431
+ <p className="text-sm text-gray-500 leading-relaxed">Built-in AI that understands your codebase. Generate components, fix bugs, and refactor with natural language.</p>
432
+ </div>
433
+ </div>
434
+ </section>
435
+ ```
436
+
437
+ ### Testimonial / Social Proof
438
+
439
+ ```jsx
440
+ <section className="flex flex-col items-center gap-12 px-16 py-24 bg-white w-full">
441
+ <div className="flex flex-col items-center gap-6 max-w-2xl">
442
+ <p className="text-2xl text-gray-700 text-center leading-relaxed italic">"This tool completely transformed our workflow. We shipped our redesign in two weeks instead of two months."</p>
443
+ <div className="flex items-center gap-4">
444
+ <div className="w-12 h-12 bg-gray-200 rounded-full"></div>
445
+ <div className="flex flex-col">
446
+ <span className="text-sm font-semibold text-gray-900">Sarah Chen</span>
447
+ <span className="text-sm text-gray-500">VP of Design, Stripe</span>
448
+ </div>
449
+ </div>
450
+ </div>
451
+ <div className="flex items-center gap-12">
452
+ <span className="text-sm font-medium text-gray-400">Trusted by</span>
453
+ <span className="text-lg font-bold text-gray-300">Stripe</span>
454
+ <span className="text-lg font-bold text-gray-300">Vercel</span>
455
+ <span className="text-lg font-bold text-gray-300">Linear</span>
456
+ <span className="text-lg font-bold text-gray-300">Notion</span>
457
+ <span className="text-lg font-bold text-gray-300">Figma</span>
458
+ </div>
459
+ </section>
460
+ ```
461
+
462
+ ### Pricing Cards
463
+
464
+ ```jsx
465
+ <section className="flex flex-col items-center gap-12 px-16 py-24 bg-gray-50 w-full">
466
+ <div className="flex flex-col items-center gap-4">
467
+ <h2 className="text-4xl font-bold text-gray-900">Simple, transparent pricing</h2>
468
+ <p className="text-lg text-gray-500">No surprise fees. Cancel anytime.</p>
469
+ </div>
470
+ <div className="flex gap-8 w-full max-w-4xl">
471
+ <div className="flex flex-col gap-6 p-8 bg-white rounded-2xl border border-gray-200 grow">
472
+ <div className="flex flex-col gap-2">
473
+ <h3 className="text-lg font-semibold text-gray-900">Starter</h3>
474
+ <div className="flex items-baseline gap-1">
475
+ <span className="text-4xl font-bold text-gray-900">$19</span>
476
+ <span className="text-sm text-gray-500">/month</span>
477
+ </div>
478
+ <p className="text-sm text-gray-500">Perfect for individuals and small projects.</p>
479
+ </div>
480
+ <button className="w-full py-3 text-sm font-semibold text-gray-700 bg-gray-100 rounded-lg">Get Started</button>
481
+ </div>
482
+ <div className="flex flex-col gap-6 p-8 bg-gray-900 rounded-2xl grow">
483
+ <div className="flex flex-col gap-2">
484
+ <h3 className="text-lg font-semibold text-white">Pro</h3>
485
+ <div className="flex items-baseline gap-1">
486
+ <span className="text-4xl font-bold text-white">$49</span>
487
+ <span className="text-sm text-gray-400">/month</span>
488
+ </div>
489
+ <p className="text-sm text-gray-400">For growing teams that need more power.</p>
490
+ </div>
491
+ <button className="w-full py-3 text-sm font-semibold text-gray-900 bg-white rounded-lg">Get Started</button>
492
+ </div>
493
+ <div className="flex flex-col gap-6 p-8 bg-white rounded-2xl border border-gray-200 grow">
494
+ <div className="flex flex-col gap-2">
495
+ <h3 className="text-lg font-semibold text-gray-900">Enterprise</h3>
496
+ <div className="flex items-baseline gap-1">
497
+ <span className="text-4xl font-bold text-gray-900">$99</span>
498
+ <span className="text-sm text-gray-500">/month</span>
499
+ </div>
500
+ <p className="text-sm text-gray-500">For large organizations with custom needs.</p>
501
+ </div>
502
+ <button className="w-full py-3 text-sm font-semibold text-gray-700 bg-gray-100 rounded-lg">Contact Sales</button>
503
+ </div>
504
+ </div>
505
+ </section>
506
+ ```
507
+
508
+ ### CTA (Call to Action)
509
+
510
+ ```jsx
511
+ <section className="flex flex-col items-center gap-8 px-16 py-24 bg-gray-900 w-full">
512
+ <h2 className="text-4xl font-bold text-white text-center">Ready to get started?</h2>
513
+ <p className="text-lg text-gray-400 text-center max-w-xl">Join thousands of teams already building faster. Start your free trial today.</p>
514
+ <div className="flex items-center gap-4">
515
+ <button className="px-8 py-3.5 text-base font-semibold text-gray-900 bg-white rounded-xl">Start Free Trial</button>
516
+ <button className="px-8 py-3.5 text-base font-semibold text-gray-300 bg-transparent border border-gray-700 rounded-xl">Talk to Sales</button>
517
+ </div>
518
+ </section>
519
+ ```
520
+
521
+ ### Footer
522
+
523
+ ```jsx
524
+ <footer className="flex items-center justify-between px-16 py-8 bg-white border-t border-gray-100 w-full">
525
+ <span className="text-sm text-gray-500">2026 Acme Inc. All rights reserved.</span>
526
+ <div className="flex items-center gap-6">
527
+ <a className="text-sm text-gray-500" href="#">Privacy</a>
528
+ <a className="text-sm text-gray-500" href="#">Terms</a>
529
+ <a className="text-sm text-gray-500" href="#">Contact</a>
530
+ </div>
531
+ </footer>
532
+ ```
533
+
534
+ ### Stats / Metrics Row
535
+
536
+ ```jsx
537
+ <section className="flex items-center justify-center gap-16 px-16 py-16 bg-blue-600 w-full">
538
+ <div className="flex flex-col items-center gap-2">
539
+ <span className="text-4xl font-bold text-white">10K+</span>
540
+ <span className="text-sm text-blue-200">Active Users</span>
541
+ </div>
542
+ <div className="flex flex-col items-center gap-2">
543
+ <span className="text-4xl font-bold text-white">99.9%</span>
544
+ <span className="text-sm text-blue-200">Uptime SLA</span>
545
+ </div>
546
+ <div className="flex flex-col items-center gap-2">
547
+ <span className="text-4xl font-bold text-white">50ms</span>
548
+ <span className="text-sm text-blue-200">Avg Latency</span>
549
+ </div>
550
+ <div className="flex flex-col items-center gap-2">
551
+ <span className="text-4xl font-bold text-white">4.9/5</span>
552
+ <span className="text-sm text-blue-200">User Rating</span>
553
+ </div>
554
+ </section>
555
+ ```
556
+
557
+ ---
558
+
559
+ ## Tips, Gotchas, and Best Practices
560
+
561
+ ### The Golden Rules
562
+
563
+ 1. **Always `get_document` first** before modifying an existing design. You need the `data-id` attributes.
564
+ 2. **Never guess node IDs** — always read them from `get_document` or `find_nodes`.
565
+ 3. **Use `add_section` with JSX** for building structures. It is far more efficient than `add_node` one element at a time.
566
+ 4. **Use `batch_update`** for multiple small changes. One call instead of many.
567
+ 5. **Prefer updating over deleting and recreating.** Use `update_node` or `update_class`.
568
+
569
+ ### Critical Gotchas
570
+
571
+ **Artboard className must include `flex flex-col`**
572
+ Without it, children overlap at (0,0). This is the #1 mistake.
573
+
574
+ **Artboard backgroundColor is a property, NOT a className**
575
+ ```
576
+ WRONG: className: "bg-gray-900 flex flex-col"
577
+ RIGHT: backgroundColor: "#1a1a1a", className: "flex flex-col"
578
+ ```
579
+
580
+ **Never use arbitrary hex colors in className**
581
+ Tailwind 4 generates CSS at build time. Dynamic classes like `bg-[#f9f9f9]` have no CSS at runtime and are invisible.
582
+ ```
583
+ WRONG: className: "bg-[#f9f9f9] text-[#333333]"
584
+ RIGHT: className: "bg-gray-50 text-gray-700"
585
+ ALSO OK: style: { "background-color": "#f9f9f9", "color": "#333333" }
586
+ ```
587
+ Note: The system auto-converts arbitrary hex to inline styles, but prefer named colors.
588
+
589
+ **`flex-1` does not work — use `grow` instead**
590
+ `flex-1` gets classified as unmapped by the Tailwind bridge. Use `grow` for the same effect.
591
+
592
+ **Frame nodes have no textContent**
593
+ Frame types (div, section, nav, header, footer) cannot hold text directly. Use text nodes (h1, p, span) inside them.
594
+
595
+ **Button nodes ignore children**
596
+ The button renderer only uses `textContent`. Do not nest icons or other elements inside buttons — place them as siblings.
597
+
598
+ **Top-level sections need `w-full`**
599
+ The auto-fixer adds this, but always include `w-full` on direct children of the artboard so they span the full width.
600
+
601
+ **Images without `src` get a placeholder**
602
+ If you omit `src`, the system inserts `https://placehold.co/600x400`. Always provide a real src for production designs.
603
+
604
+ ### Design Tips
605
+
606
+ - **Max-width containers**: Use `max-w-5xl` or `max-w-6xl` centered with content inside for readable text widths
607
+ - **Consistent spacing**: Use the Tailwind spacing scale (4, 6, 8, 12, 16, 24 are common section padding values)
608
+ - **Color hierarchy**: Use gray-900 for headings, gray-500 for body text, gray-400 for secondary text
609
+ - **Section rhythm**: Alternate between white and gray-50 backgrounds for visual separation
610
+ - **Button hierarchy**: Primary = solid dark, Secondary = outline or light background
611
+
612
+ ---
613
+
614
+ ## Complete Recipe: SaaS Landing Page
615
+
616
+ Build a complete SaaS landing page from scratch — step by step.
617
+
618
+ ### Step 1: Create Session and Artboard
619
+
620
+ ```
621
+ create_session
622
+ label: "SaaS Landing Page"
623
+ ```
624
+
625
+ Wait for browser connection (`session_status`), then:
626
+
627
+ ```
628
+ create_artboard:
629
+ name: "Landing Page"
630
+ width: 1440
631
+ height: 900
632
+ backgroundColor: "#ffffff"
633
+ className: "flex flex-col"
634
+ ```
635
+
636
+ ### Step 2: Navigation
637
+
638
+ ```
639
+ add_section:
640
+ parentId: "<artboard-id>"
641
+ jsx: |
642
+ <nav className="flex items-center justify-between px-16 py-5 bg-white w-full border-b border-gray-100">
643
+ <div className="flex items-center gap-2">
644
+ <div className="w-8 h-8 bg-blue-600 rounded-lg"></div>
645
+ <h2 className="text-lg font-bold text-gray-900">Launchpad</h2>
646
+ </div>
647
+ <div className="flex items-center gap-8">
648
+ <a className="text-sm font-medium text-gray-600" href="#">Product</a>
649
+ <a className="text-sm font-medium text-gray-600" href="#">Features</a>
650
+ <a className="text-sm font-medium text-gray-600" href="#">Pricing</a>
651
+ <a className="text-sm font-medium text-gray-600" href="#">Docs</a>
652
+ </div>
653
+ <div className="flex items-center gap-3">
654
+ <a className="text-sm font-medium text-gray-600" href="#">Sign In</a>
655
+ <button className="px-5 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg">Start Free</button>
656
+ </div>
657
+ </nav>
658
+ ```
659
+
660
+ ### Step 3: Hero
661
+
662
+ ```
663
+ add_section:
664
+ parentId: "<artboard-id>"
665
+ jsx: |
666
+ <section className="flex flex-col items-center gap-10 px-16 py-32 bg-white w-full">
667
+ <div className="flex flex-col items-center gap-6 max-w-3xl">
668
+ <span className="px-4 py-1.5 text-xs font-semibold text-blue-700 bg-blue-50 rounded-full uppercase tracking-wider">New: AI-Powered Workflows</span>
669
+ <h1 className="text-6xl font-extrabold text-gray-900 text-center leading-tight tracking-tight">Ship products faster than ever before</h1>
670
+ <p className="text-xl text-gray-500 text-center leading-relaxed">The all-in-one platform for modern product teams. Design, build, test, and deploy from a single dashboard.</p>
671
+ </div>
672
+ <div className="flex items-center gap-4">
673
+ <button className="px-8 py-4 text-base font-semibold text-white bg-blue-600 rounded-xl">Start Free Trial</button>
674
+ <button className="px-8 py-4 text-base font-semibold text-gray-700 bg-white border-2 border-gray-200 rounded-xl">Watch Demo</button>
675
+ </div>
676
+ <p className="text-sm text-gray-400">Free for 14 days. No credit card required.</p>
677
+ </section>
678
+ ```
679
+
680
+ ### Step 4: Social Proof Bar
681
+
682
+ ```
683
+ add_section:
684
+ parentId: "<artboard-id>"
685
+ jsx: |
686
+ <section className="flex items-center justify-center gap-12 px-16 py-12 bg-gray-50 border-y border-gray-100 w-full">
687
+ <span className="text-sm text-gray-400">Trusted by leading teams at</span>
688
+ <span className="text-lg font-bold text-gray-300">Stripe</span>
689
+ <span className="text-lg font-bold text-gray-300">Vercel</span>
690
+ <span className="text-lg font-bold text-gray-300">Linear</span>
691
+ <span className="text-lg font-bold text-gray-300">Notion</span>
692
+ <span className="text-lg font-bold text-gray-300">Figma</span>
693
+ </section>
694
+ ```
695
+
696
+ ### Step 5: Feature Grid
697
+
698
+ ```
699
+ add_section:
700
+ parentId: "<artboard-id>"
701
+ jsx: |
702
+ <section className="flex flex-col items-center gap-16 px-16 py-24 bg-white w-full">
703
+ <div className="flex flex-col items-center gap-4 max-w-2xl">
704
+ <h2 className="text-4xl font-bold text-gray-900 text-center">Built for speed, designed for scale</h2>
705
+ <p className="text-lg text-gray-500 text-center">Powerful tools that grow with your team. No compromises.</p>
706
+ </div>
707
+ <div className="flex gap-6 w-full max-w-5xl">
708
+ <div className="flex flex-col gap-4 p-8 bg-gray-50 rounded-2xl grow">
709
+ <div className="flex items-center justify-center w-12 h-12 bg-blue-100 rounded-xl">
710
+ <span className="text-blue-600 font-bold">1</span>
711
+ </div>
712
+ <h3 className="text-lg font-semibold text-gray-900">Visual Editor</h3>
713
+ <p className="text-sm text-gray-500 leading-relaxed">Drag-and-drop interface with pixel-perfect precision. Design at the speed of thought.</p>
714
+ </div>
715
+ <div className="flex flex-col gap-4 p-8 bg-gray-50 rounded-2xl grow">
716
+ <div className="flex items-center justify-center w-12 h-12 bg-green-100 rounded-xl">
717
+ <span className="text-green-600 font-bold">2</span>
718
+ </div>
719
+ <h3 className="text-lg font-semibold text-gray-900">Instant Deploy</h3>
720
+ <p className="text-sm text-gray-500 leading-relaxed">One-click deployment to our global CDN. Preview environments for every branch.</p>
721
+ </div>
722
+ <div className="flex flex-col gap-4 p-8 bg-gray-50 rounded-2xl grow">
723
+ <div className="flex items-center justify-center w-12 h-12 bg-purple-100 rounded-xl">
724
+ <span className="text-purple-600 font-bold">3</span>
725
+ </div>
726
+ <h3 className="text-lg font-semibold text-gray-900">AI Copilot</h3>
727
+ <p className="text-sm text-gray-500 leading-relaxed">AI that understands your design system. Generate components, layouts, and content automatically.</p>
728
+ </div>
729
+ </div>
730
+ </section>
731
+ ```
732
+
733
+ ### Step 6: CTA
734
+
735
+ ```
736
+ add_section:
737
+ parentId: "<artboard-id>"
738
+ jsx: |
739
+ <section className="flex flex-col items-center gap-8 px-16 py-24 bg-gray-900 w-full">
740
+ <h2 className="text-4xl font-bold text-white text-center">Start building today</h2>
741
+ <p className="text-lg text-gray-400 text-center max-w-xl">Join 10,000+ teams already shipping faster with Launchpad. Free trial, no strings attached.</p>
742
+ <div className="flex items-center gap-4">
743
+ <button className="px-8 py-4 text-base font-semibold text-gray-900 bg-white rounded-xl">Start Free Trial</button>
744
+ <button className="px-8 py-4 text-base font-semibold text-gray-300 bg-transparent border border-gray-700 rounded-xl">Talk to Sales</button>
745
+ </div>
746
+ </section>
747
+ ```
748
+
749
+ ### Step 7: Footer
750
+
751
+ ```
752
+ add_section:
753
+ parentId: "<artboard-id>"
754
+ jsx: |
755
+ <footer className="flex items-center justify-between px-16 py-8 bg-gray-900 border-t border-gray-800 w-full">
756
+ <div className="flex items-center gap-2">
757
+ <div className="w-6 h-6 bg-blue-600 rounded-md"></div>
758
+ <span className="text-sm font-semibold text-gray-400">Launchpad</span>
759
+ </div>
760
+ <span className="text-sm text-gray-500">2026 Launchpad Inc. All rights reserved.</span>
761
+ <div className="flex items-center gap-6">
762
+ <a className="text-sm text-gray-500" href="#">Privacy</a>
763
+ <a className="text-sm text-gray-500" href="#">Terms</a>
764
+ <a className="text-sm text-gray-500" href="#">Status</a>
765
+ </div>
766
+ </footer>
767
+ ```
768
+
769
+ ### Step 8: Verify and Refine
770
+
771
+ Call `get_document` to verify the structure. Use `batch_update` for any tweaks — adjust colors, spacing, or text content across multiple nodes at once.
772
+
773
+ ---
774
+
775
+ ## Responsive Design Workflow
776
+
777
+ To create responsive variations:
778
+
779
+ 1. Build the desktop design (1440px) first
780
+ 2. Use `duplicate_artboard` to clone it for tablet (768px) and mobile (375px)
781
+ 3. Use `batch_update` to adjust:
782
+ - Switch horizontal flex rows to `flex flex-col` for stacking
783
+ - Reduce padding: `px-16` to `px-6`, `py-24` to `py-16`
784
+ - Scale down text: `text-6xl` to `text-4xl`, `text-4xl` to `text-2xl`
785
+ - Change gap values: `gap-8` to `gap-4`
786
+ - Change grid layouts: 3-column features to 1-column stack
787
+
788
+ ---
789
+
790
+ ## Dark Mode Design
791
+
792
+ For dark-themed pages:
793
+
794
+ 1. Set artboard `backgroundColor: "#0a0a0a"` or `"#111111"`
795
+ 2. Use inverted color scale:
796
+ - Headings: `text-white` or `text-gray-100`
797
+ - Body: `text-gray-400`
798
+ - Secondary: `text-gray-500`
799
+ - Backgrounds: `bg-gray-900`, `bg-gray-800`, `bg-neutral-900`
800
+ - Borders: `border-gray-800`
801
+ - Cards: `bg-gray-900` with `border border-gray-800`
802
+ 3. Buttons: `bg-white text-gray-900` for primary, `border border-gray-700 text-gray-300` for secondary