Design pages using the
and
MCP tools.
creates AI-generated design variations that the user can preview and select.
applies direct code edits to an existing Subframe page. Both produce designs the user can refine visually in the Subframe editor and then implement in code.
Don't write UI code directly. Subframe generates production-ready React/Tailwind code that matches the design system. Design first, then implement with
.
When to Use This
- Needs UI while coding
- Wants to explore design options
- Has codebase context that should inform the design
- Wants a starting point to refine in a design tool
- Is collaborating on designs with a team
- Wants to modify an existing page
The key value:
and
bridge coding and design. They work in both directions — create designs while coding and then ensure your code exactly reflects your design.
MCP Authentication
If you cannot find the
tool (or any Subframe MCP tools), the MCP server likely needs to be authenticated. Ask the user to authenticate the Subframe MCP server. If the user is using Claude Code, instruct them to run
to view and authenticate their MCP servers, and then say "done" when they're finished.
Subframe Basics
- Components (buttons, inputs, cards): Synced via CLI. Source of truth in Subframe. Don't modify locally.
- Pages (screens): Designed via AI or editor. Exported via MCP. Add business logic after export.
Subframe knows about the design system and theme. Your job is to provide context from the user's codebase.
Workflow
You do not have to run
before designing. The
MCP tool works independently — it only needs a
and an authenticated MCP server. Local project setup (
folder, synced components, Tailwind config) is not required to design pages.
- Understand the request — If vague, ask clarifying questions. What data? What actions? Who uses it?
- Find the projectId — Check if it exists. If there is no or no projectId found, ask the user to go to
https://app.subframe.com/cli/auth
to get a project ID.
- Decide: or ? Then call the respective MCP tool:
- → Creating something new, exploring multiple directions, or redesigning existing UI where the user wants options to choose from
- → Making targeted changes to a Subframe page that was just created in this session (via ) or that the user provided via an MCP link
- Present the review URL — This is the primary output. The user will preview and choose next steps.
— New Pages & Redesigns
- Creating a new page from scratch
- Redesigning or rethinking existing UI — even if there's an existing implementation in code, use when the user wants to explore multiple design directions or start fresh
- The user wants options to choose from (multiple variations)
Context and Variations
How much context to gather and how many variations to generate depends on the task:
| Task | Context | Variations |
|---|
| New page (open-ended) | Data types () | 4 — explore the design space |
| New page (with reference pages) | Reference pages ( if in Subframe, if not), data types () | 1-2 — stay close to the reference pages |
| Redesigning existing UI | The current page ( if in Subframe, if not; note what to keep vs change in the description) | 2-4 — depending on how open-ended |
Always include when available:
- Similar existing pages (the single most valuable context). Use for Subframe pages — pass the returned by , or the page ID from a pasted MCP link. Use for pages that only exist in the codebase.
- Components or patterns the user refers to or explicitly mentions (via )
- Data types/interfaces for what the page will display (via )
Variations
Each variation is a prompt that drives a unique design direction.
When you have reference pages (
), use fewer variations (1-2) and keep them grounded in the reference. The variations should refine or extend the existing design, not diverge from it. For example:
- "Follow the same layout as the reference page but adapted for [new content]"
- "Same structure with a more compact data-dense layout"
When starting from scratch (no
), use more variations (4) to explore the design space:
- "Compact data table with inline actions and bulk operations"
- "Card-based layout with visual hierarchy and quick filters"
- "Minimal single-column design focused on the primary action"
- "Split-panel layout with sidebar navigation and detail view"
More variations = more exploration. Fewer = more focused. Default to fewer when strong context exists.
Multi-Page Requests
When designing multiple related pages (flows, CRUD, etc.):
- Design the primary page first with more variations to establish the direction
- After user selects a variation, design remaining pages passing the relevant pages via as context
- Use the same to group related pages together
— Editing a Subframe Page with Code
Use
when making targeted edits to a specific Subframe page by providing updated TSX code directly.
Code Rules
Subframe pages are static TSX that gets parsed back into Subframe's visual model. The code you provide must follow these rules:
- Raw TSX only — No import statements, no function definitions, no export statements. Just the JSX body starting from the root element (e.g. or ). Note: returns the full file with imports — you must strip those and only send the JSX body to .
- No business logic — No , hooks, API calls, event handlers, or any dynamic behavior. Pages are purely visual; business logic is added after export.
- No loops or dynamic code — No , , , or any iteration. Every element must be written out explicitly.
- Match the existing code style exactly — Preserve how flex, gap, padding, and other layout properties are structured. The code will be parsed back into the Subframe editor, so the structure matters.
- Tailwind classes only — No attribute. Use with Tailwind classes for all styling. If you need a custom value, use Tailwind's bracket syntax (e.g. ).
- Only use components from the Subframe project and standard HTML tags — Use or to see what's available. Allowed HTML tags: , , , , -, , , , , , , . Don't use arbitrary React components or HTML elements beyond these.
- No nested text elements — Text tags (, , -) can only contain plain text strings, not other elements.
- No omitted code or placeholders — Output the complete page code. No or comments.
- Preserve attributes — Never change or remove these IDs; they're critical for the Subframe editor.
Workflow
- Get the current code — Call to get the page's current TSX code. Always refetch immediately before editing — do not reuse code from earlier in the conversation, as the page may have been modified in the Subframe editor.
- Modify the code — Make the desired changes following the code rules above
- Call with:
- Page identifier: , , or — same as . Use to find existing pages if needed.
- : The full updated TSX code for the page
- : A short description of what changed (shown in the AI tab)
- If the code fails to parse — Fix the errors based on the error message and retry
- Present the — The user opens the design editor with the AI tab open to review and apply the edit
When to use vs
- : You know exactly what code changes to make. You provide the updated TSX directly. Fast, precise, no AI generation.
- : You want AI-generated design variations. The user picks a direction. Better for new pages or exploring options.
When NOT to use : If the user has existing UI in their codebase but no corresponding Subframe page, or if they want to explore multiple design options, use
instead.
is for iterating on a known Subframe page with specific code changes.
After Designing
For
, present the
as a clickable markdown link. The user will:
- Preview variations — See each design option rendered in Subframe
- Select a variation — Choose the one that best fits their needs
- Open in editor — Refine visually in Subframe's full design editor
From there, the user may continue refining in Subframe or return here and ask you to implement the design in code. Do NOT ask the user which variation they prefer or present variation options as a multiple choice in chat. Variation selection happens in the Subframe editor, not here. Simply present the review URL and let them know they can ask you to implement the design once they're ready.
For
, present the
as a clickable markdown link. The user opens the design editor with the AI tab showing the edit, where they can apply it or undo.
Internally track the
from the response — you'll need it for
,
for future designs, or
for future edits — but don't mention it to the user.
Iterating on Variations
After calling
, you can use
with the returned
to retrieve the generated variations and the current state of the page. This lets the user discuss and iterate on designs conversationally — for example, "I like the layout from variation 1 but the color scheme from variation 3", or "keep the header from the current page but use the card layout from variation 2."
- — The current page code if the user has already accepted a variation for this page, or if no variation has been accepted yet. This reflects the live state of the page, including any edits the user made in the Subframe editor.
- — The generated design variations from the most recent call.
Important: The variations can be very token-heavy. After calling
, extract
from the response first — it determines your next step.
- exists — The user already has a page. Use with as the starting point, incorporating ideas from the variations or the user's feedback. You don't need to deeply analyze every variation — just reference the ones the user mentions.
- is null — The user hasn't accepted any variation yet. Use to iterate, passing the relevant variation code via along with the user's feedback in the description. Note: this creates a new — use it for subsequent calls.