Prototyping

Ask an AI agent for a prototype and get throwaway screens built from SlabUI, with variants and states you switch from the URL.

The slabui-prototype skill teaches AI agents to build prototypes with SlabUI. A prototype here is throwaway code that answers one question, such as "which layout makes an overdue customer easiest to find?". It is made of the same components, blocks and theme tokens as your product, with mocked data, so what you look at is what the real screen would look like.

Install

pnpm slabui skills add slabui-prototype slabui-setup

slabui-setup is optional: with it, a prototype in a new app starts with the name, the logo and the colors of your product (see the setup skill).

The skills are installed like the other skills: in .agents/skills/<skill>/, with a link for the agents that read another folder. slabui skills update brings new versions.

Ask for a prototype

Ask the agent in plain words. The skill starts when you ask to prototype, mock up or try out a screen, a flow or a layout:

Prototype three options for the customers screen.
Prototype the invoice approval flow so I can show it to the finance team.

Small edits to a screen that exists, and screens that are meant to ship, do not use the skill.

The two modes

The agent writes down the question the prototype answers and picks a mode. When your request fits both, it asks.

ModeForWhat you get
Explore"What should this look like?"Three variants, main state only
Validate"Show this flow to people"One direction, with all its states

The variants of Explore differ in structure and share the same mocked data. The states of Validate are the ones that apply to the screen: empty, loading, error and so on.

Explore does not cover every state, and Validate does not offer options: states come after a direction is picked.

How it works

The question

The agent writes the question in one line and keeps it in a comment at the top of the prototype. Everything else follows from it.

Where it runs

In a project with a slabui.json, the prototype is mounted inside the page it belongs to, next to the real header, navigation and data. When no page can host it, the agent creates a route with prototype in its path, following your routing convention.

Without a project, the agent creates a throwaway Vite app and runs slabui init. With the slabui-setup skill installed, it then asks for the name of your product, its logo, your brand color, a style and a layout, and generates the theme, so the prototype looks like your product. Without that skill, the app keeps the default theme and a sample name. A sidebar block is the frame, so the screen is not judged on an empty page.

In a project that exists, the agent never changes the name, the logo or the theme.

Your approval

In Validate mode, or when there is more than one screen, the agent stops and shows you the list of screens, each with its job and its next action, and the list of states it plans to build. It builds after you answer. One clear screen in Explore mode goes straight to building.

The pieces

The agent searches the registry, installs blocks and components with the CLI and builds the screens from them. It styles with the theme tokens, never with raw colors or fixed sizes, so the prototype follows your theme. A block keeps its structure and the length of its labels, and a control that exists in the registry is installed instead of written by hand.

The check

In both modes the agent renders every variant and every state at a desktop, a tablet and a phone width, and once in dark mode, looks at the result and fixes what it finds before showing you: labels that do not fit, uneven spacing, things that do not line up, icons that repeat. Validate mode adds checks on the states, such as nothing changing size between them and every state offering a way out.

The summary

The agent ends with the question, the URL, what is mocked, the decisions it made, what to rewrite before the screen ships and what you still have to decide. In Explore mode it also says which variant it would pick, and why.

Variants and states in the URL

Every variant and every state lives on the same route, and the URL says which one is showing:

http://localhost:5173/customers?variant=b&state=empty

A link opens exactly what you want someone to look at, and a reload keeps it.

A floating bar at the bottom of the page switches between them:

  • The arrows change the variant, and so do the [ and ] keys.
  • The state buttons change the state.
  • The sun and moon button switches between light and dark mode.
  • The screen button goes through desktop, tablet and phone. At the tablet and phone sizes the same page is shown inside a frame of that width, so the layout answers as on a real device.
  • The bar only renders in development.

The mode and the size are in the URL too, so a link can open a variant in dark mode on a phone:

http://localhost:5173/customers?variant=b&theme=dark&viewport=mobile

A project that forbids loading its pages in a frame has no device frame; the bar then hides the screen button.

When the screen already exists, it is the first variant, named current, so you compare the options with what you have today.

What makes a variant

Variants differ in structure, never only in color, theme or font (those belong to the theme editor):

AxisWhat changes
StructureWhere things live and how they are grouped
InteractionHow people act
DensityHow much shows at once
EmphasisWhat the eye meets first
RemovalWhat goes away

The usual answer is a mix, such as "B with the header from A". Ask for it and the agent builds the mix as the next variant.

States

In Validate mode the agent goes through four groups and marks each state as applies, doesn't apply or open question:

GroupExamples
DataEmpty for the first time, filtered to nothing, many rows, long text
SystemFirst load, couldn't load, partly failed, slow, offline
ActivitySaving, invalid, done with undo, about to delete, waiting on someone
PeopleRoles and permissions, first visit

States that change the whole screen become ?state= keys. States that change one part, such as a row that failed or a very long name, go into the mocked data. Each state is shown with the component made for it: Empty, Skeleton, Alert, <Button loading>, a sonner toast.

Mocked data

The data is fake but realistic: typical names and amounts, in your language and local formats. Lists have 40 rows or more, with one or two long values and a few missing optional fields, because three tidy rows hide truncation and overflow. Menus, titles and the company and user names stay short and typical. Actions change the data in memory through a stub that waits about a second, so nothing reaches your backend.

After the prototype

A prototype is written without tests or error handling, so the winning variant is rewritten into the real code, not promoted as it is. The agent's summary lists what to rewrite. When the project has a docs/DESIGN.md (see the setup skill), the agent adds the variant you picked, and why, to its decisions. Keep the prototype on a branch of its own, out of your main branch, as a record of what was compared.

What the skill does not do

  • It does not write to your backend: every action is a stub.
  • It does not create branches or commit unless you ask.
  • It does not recreate a Pro item that failed to install; it tells you, and you decide whether to sign in (npx slabui login) or pick another item.
  • It does not prototype logic or a data model without a screen.