Skip to content

I Built a Skill So My Agent Shows Me Every UI State Before It Ships

Here is a pattern I kept running into. I ask a coding agent to improve a screen, it comes back with a diff, and the diff looks fine. I open the app, click through the happy path, and it looks fine there too. Then a week later I see the same screen while it is loading, or empty, or halfway through a failed save, and it looks like nobody designed it.

The agent didn’t do anything wrong. I never asked it to show me those states, and I never looked for them. A diff is a poor way to review a UI, and a screenshot of one state is not much better.

So I built a skill for it. It is called state-prototyping.

What I wanted before anything shipped

I wanted three things from a review step. I wanted to see the real screen, not a sketch of it. I wanted to switch between realistic states without breaking anything or waiting on a backend. And I wanted to know why each change was made, in words I could argue with.

Most prototypes fail the first one. They are a recreation: someone rebuilds the screen in a sandbox, it looks close, and then the production version has a different padding, a different dialog, a different disabled style. Reviewing the copy tells me very little about the original.

What the skill does

state-prototyping is a set of instructions plus a small review shell that my agent follows when I ask for a UI prototype. The agent explores the app first. It reads the screens, the components, who owns each piece of state, and what happens on failure, then builds a short inventory of states from that evidence instead of from guesses.

Then it builds one editable preview with a list of selectable states. Loading, empty, error, saving, stopped, success and conflict are the usual ones. If the agent proposes a state that does not exist in the product yet, it has to label it as proposed.

The review shell with a searchable list of 35 states on the left, a Before and After toolbar, and the portfolio home page in the preview

The review shell in Split mode. The state list is on the left, and changed elements on the After side are outlined.

What the skill contains

  • SKILL.md workflow
  • Review shell
  • Vanilla or React starter
  • Node check scripts
  • Reference notes

I keep the output in a .state-prototype/<flow>/ folder unless I name another place. It is plain files that I can serve locally and delete when the change lands.

Import the real UI, fake only the data

This is the rule I care about most. For an existing screen, the agent imports the production components, styles and tokens. The only things replaced are data and side effects, using fictional, deterministic fixtures and local callbacks.

A loading state is a request that never resolves. A saving state is a submit that stays pending. A declined card keeps whatever I typed and shows the error, because the real component does that. Nothing calls a network, a native API or a payment provider, and the skill says never to fake a provider response.

The portfolio in the After view with the stats line reading Loading... views, last 30 days, and Last updated: Loading...

The stats loading state on this portfolio, with a request that never resolves.

The portfolio with the assistant panel open, showing a red message that the assistant is unavailable and Try again and Start a new conversation buttons

The assistant provider error state, reviewed with the same real components.

If something cannot be isolated safely, the state is marked unavailable and the boundary is named. I would rather see “native file save is not available here” than a fake success.

sh
node scripts/init-prototype.mjs .state-prototype/billing --stack react --states states.json
node scripts/check-prototype.mjs .state-prototype/billing

Those are the two commands the agent runs to set up the shell and validate the state list. I don’t run them by hand most of the time. The point is that the structure is checked by a script, not by whether the agent remembered it.

Before and After, side by side

For existing UI, I can ask for a frozen Before next to an editable After. Before is recovered from the real source at the start, never recreated. After is where the agent’s proposal and my feedback go.

The shell has four compare modes: Before, After, Split and Slider. Slider is for small visual changes on the same layout, where a few pixels of padding are easy to miss in a split view. Both sides use the same state, theme and width, so I am never comparing a loading screen to an empty one by accident.

Slider compare mode with the Before page on the left of a divider and the After page on the right

Slider mode. When Before and After have different heights, as they do here, the shell says so and points me to Split.

The shell also has width presets, a theme switch, a searchable list of states grouped by area, and links that land on a specific state. Share lets me copy the changes as Markdown or JSON, which matters later.

Highlights and recorded reasons

With highlights on, the shell measures the difference between Before and After and outlines the elements that changed. A Changes panel lists each one with the values, for example a button going from one height or background color to another.

The Changes panel open beside the Before and After preview, listing numbered changes with the element and how many properties changed

The Changes panel. Each numbered badge on the After side matches an entry in the list.

Next to each change there is a reason, written from the user’s point of view. The agent records it in a notes file as it works. If a change has no reason, the panel says so, and that counts as a gap to fix. A reason also cannot contradict the measured numbers.

I used it on this portfolio

I ran the skill on this site. The Before below is the portfolio as it was, recovered from the real source. The After is the proposal I reviewed.

The portfolio home page before the redesign

Before.

The portfolio home page after the redesign

After.

What changed:

  • DM Sans with lighter weights.
  • Grouping through spacing instead of dividers and boxes.
  • One accent color, used only for primary actions.
  • Real product screenshots in place of placeholders.

The review also caught a contrast bug in the assistant composer. The hint text measured 1.73:1 in dark mode. I fixed it. I would not have gone looking for it in a diff, but it showed up once I stepped through that state in both themes.

Locking an area once it is right

I review a screen one area at a time. The agent inspects the states for that area, critiques the main surfaces first, then dialogs, then error and edge states, and reports a short Before, After and Why table. Then it asks whether to lock the area or keep refining, and stops.

Locking adds the area to a list, and a locked area is frozen, including through shared styles. If a later change would touch it, the agent has to say so and ask. This fixes something that used to annoy me: finishing the header, moving on to the table, and finding the header changed again because of a shared rule.

How this changes the way I review

I no longer review a diff and hope. I open the preview, search the state list, and step through Previous and Next until every area has been seen at desktop and phone width, in both themes. The skill also has the agent look at each decision from three views: the user, the developer who will build it for real, and another agent that has to operate or test the UI. Controls should be findable by role and name, outcomes readable as text, and states reproducible from a URL.

That last view is partly for my own agents. If a later agent implements the approved prototype, the Markdown or JSON change list gives it something precise to follow, instead of a screenshot to squint at.

Pros
  • •
    The preview uses the real components, so approval means something
  • •
    Loading, empty, error and conflict states get reviewed on purpose
  • •
    Every change carries a reason I can read and challenge
  • •
    Locked areas stop later edits from undoing finished work
Cons
  • •
    Fixtures do not verify native, live or persisted behavior
  • •
    Some states cannot be isolated without a production change, so they are marked unavailable
  • •
    It adds a review step, which is overhead for a one-line style fix

What it does not do

It does not prove the feature works against a real backend. The skill is explicit that fixtures show what the screen does with given data, nothing more. It also does not replace testing the production build once the change is approved, and it does not authorize a redesign. The shell and the product are separate designs, and the agent is told to keep the product’s own structure, navigation and workflow and refine controls, hierarchy, feedback and motion.

I scale it to the task. A small component gets a handful of states and a short coverage note, not an exhaustive map.

Where it goes next

The skill is mine and I am still changing it as I use it. The source is in my skills repo , and I am building the docs and examples at skills.johnkevinumali.com , which will be the home for both.

To try it, install it from the repo:

bash
npx skills add Kevin-Umali/skills --skill state-prototyping

Then invoke it with /state-prototyping in Claude Code or $state-prototyping in Codex.

What I wanted was simple: before a screen ships, I want to have seen it in every state it can be in, and know why it looks the way it does.

Sources & references

2 sources
  1. Kevin-Umali/skills on GitHub

    The repo, including the state-prototyping skill and install options.

  2. Skills docs and examples

    Documentation and examples, in progress.