Messy search page
What to ask an AI coding agent when a wizard breaks.
If a builder works only on the happy path, do not ask the agent to patch screens first. Ask it to model the states, transitions, failures, and recovery behavior.
Use these terms
Statechart
Models allowed states, events, guards, invalid transitions, and side effects before the code grows tangled.
Transition table
Turns back, next, submit, retry, cancel, edit, and resume into explicit rules.
Guard condition
Blocks invalid movement until required facts, permissions, or validations are true.
Step state
Names whether a step is not started, active, valid, blocked, complete, failed, or recoverable.
Idempotency
Makes retries, double clicks, and repeated API calls safe.
Fallback UI
Prevents loading, partial-data, API, and component failures from becoming dead ends.
Recovery path
Defines what users see and how they continue after every failure mode.
Prompt pattern
Weak ask
Fix my wizard. It breaks when users go back or an API fails.
Exact Terms ask
Before changing UI code, model this wizard with a statechart, transition table, guard conditions, step state, idempotency, fallback UI, and recovery paths. Return acceptance tests for refresh, back/next, retry, failed API, double submit, and resume.
Common questions
Why not just ask for a bug fix?
A coding agent may patch the visible symptom while leaving invalid transitions and failure paths undefined.
What output should I expect?
Ask for a state model, transition table, persistence rules, failure plan, and tests before component code.