how to use loops for frontend and UI:
loops won't automate design, but it will help get the request right on the first implementation attempt.
agents still suck at interpreting design requests and, worse, one-shotting spacing/sizing, behaviors, animations, transitions and states.
the core of every good loop is clearly defining success.
so for every design loop, you need a visual reference.
if you're designing something new, you can start with a screen recording of an app you like. record as many interactions as possible. every click, hover state, error state, etc.
or if you're working within an existing design system, you can explore figma mockups with agent.
the most important thing is to prompt with a pixel perfect reference: a recording, screenshot or figma mockup(s).
you can share another app and ask it to adapt the visual design or interactive behavior to your existing app. you should explicitly ask it to translate the reference and adhere to your design system (formal or informal).
the second most important thing is in your prompt, before the loop begins, you ask the agent to interview you to fill in the gaps to fully understand your intent.
a tool like claude code or codex will ask questions like "what should happen when a user does X" to cover edge cases.
a few back and forths will build the context to help cover the important details you forgot or didn't think to mention.
lastly, before starting the loop, it's absolutely critical you describe success.
"verify with computer use everything looks and behaves as intended" or something along those lines.
you are essentially offloading the tedious review, and it will check its own work on a loop until it matches your design brief.