Claude Code state-machine skill: Model form submission and retries
Describe a UI flow as states and transitions. Add conditions for each event so loading, failure, and retry behavior is easier to reason about and test.
中文Install in Claude Code
Use a local Claude Code session with a written flow description. Start with a state transition table before choosing an implementation.
- Download the repository snapshot at the linked commit. Copy the entire .claude/skills/state-machine/ directory into .claude/skills/state-machine/ in your practice project.
- Confirm that SKILL.md is directly inside .claude/skills/state-machine/. Open Claude Code from the project root and enter /state-machine.
Example task
Run /state-machine. Describe an editable form that submits only with complete fields, disables the button during submission, confirms success, and keeps the draft if the request fails. Ask for a transition table and test cases.What to check
The table prevents a second submit while the request is active. It also provides a retry from the error state that keeps the entered values.
Original SKILL.md on GitHub · Updated
Frequently asked question
When does a form benefit from a state machine?
Use it when the interactions between editing, submitting, success, and failure become hard to track. The table gives each event a predictable outcome.