Back/Design/Claude/Figma
IntermediateDesign

Automate Design Documentation by Exporting All Component States from Code to Figma

Export the states that exist in code but are missing from the design file. One prompt asks the agent to find every state in a flow, place editable versions side by side in Figma, and give designers a current canvas for refinement.

Automate Design Documentation by Exporting All Component States from Code to Figma

Alex asks the agent to send all five signup states to Figma, where they appear side by side as editable frames that a design partner can refine.

Before you start

What you need

  • A locally runnable product flow with multiple implemented states
  • An AI coding agent connected to the Figma MCP
  • A destination Figma file or project

What you’ll make

One Figma file containing editable, labeled frames for every requested state in the current implementation.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

4 steps

Step01

Identify a Component with Multiple States

Choose a flow where code contains states the Figma file does not, such as empty, typing, validation error, loading, and success. Make sure each state can be reproduced locally through a route, fixture, or predictable interaction.

Step02

Use an AI Agent to Export All States

Run the app locally and ask the coding agent, connected to Figma, to export the full set. Name the flow and the expected number of states. If the labels are not obvious from code, list them in the prompt.

Example prompt
Inspect the signup flow in this codebase and send all five implemented states to Figma. Reproduce each state from the running app, label it with the state name, and place the editable frames side by side in one section of the destination file.
Step03

Review Exported States in Figma

Open the Figma file and compare the exported set with the running flow. Check that no state is missing, labels match behavior, copy is current, and every frame is editable rather than a flattened screenshot.

Step04

Refine and Document in Figma

Use the side by side frames to refine error copy, visual hierarchy, transitions, and edge cases. Keep the full set together so the design file documents the actual product flow instead of only the happy path.

What good looks like

  • Every requested state appears once and is clearly labeled.
  • The exported frames match the current code behavior and copy.
  • States are arranged together for fast comparison.
  • Designers can select and edit the imported elements.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The agent exports only the default state
Name the flow and ask the agent to enumerate its state transitions from code before exporting. Add fixtures or routes that make hidden states reproducible.
An exported state does not match the running product
Give the agent the route, fixture, account state, or interaction needed to reproduce it, then replace only the incorrect frame.
The export is a screenshot instead of editable Figma content
Confirm the backend Figma MCP workflow is connected and request editable layers or components, not an image capture.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready