Use when asked to find, audit, or fix implicit state machines, state bugs, or impossible states, such as boolean flag clusters, status fields written from many places, records stuck or in contradictory states, lifecycles enforced only by convention.
Ships in implicit-state-machine-finder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An implicit state machine is a lifecycle the code enforces by convention instead of by structure: the states and legal transitions exist, but nobody wrote them down, so illegal states are reachable.
This skill runs in two phases. Phase 1 changes no code and always ends in a written report. Phase 2 converts one machine at a time.
A request to fix state bugs is still both phases, in order. The report comes first. Every conversion follows every Phase 2 step. Deadlines and "don't wait on me" change who answers the gate question below; they do not remove steps.
Search for meaning, not just patterns. Look for:
isLoading, isError, hasSubmitted, isOpen).published_at, archived_at, deleted_at, paid_at that together encode a state.Ignore independent flags (a dark-mode toggle next to a loading flag is not a machine) and anything already modeled explicitly.
Rank by bug risk, highest first: reachable impossible states with data or money impact, then user-visible stuck or wrong states, then scattered writes with no demonstrated bug, then cosmetic.
Deliver the report as a ranked list, one section per machine, with a one-line recommendation each: convert, convert lightly, or leave alone (with the reason). Lead with a short summary table: machine, location, risk, recommendation.
What happens after the report depends on what the request asked for.
| The request | After the report |
|---|---|
| Asks to find, audit, or list. It does not ask for fixes. | Stop and ask which machines to convert. If nobody is there to answer, write the report to docs/state-machines.md (or the repo's existing docs location) and end. |
| Names the machines to convert. | Convert those machines. |
| Asks for fixes, names no machine, and the user is there. | Stop and ask which machines to convert. |
| Asks for fixes, names no machine, and the user said not to wait. | Write the report to docs/state-machines.md and commit it alone. Then convert, in rank order, each machine whose entry shows a reachable impossible state with money, data, or user-visible impact. Leave the others in the report. |
A request that only asks for an audit never becomes Phase 2 on your own judgment.
Finish every step for one machine before you open the next machine's files.
failed plus a special error string. That builds a new implicit machine. If the storage cannot hold a state the machine needs, that is a stored-representation change: follow step 6.Each converted machine gets a conversion record in the repo. Add it to that machine's entry in the report file (docs/state-machines.md, or the repo's existing docs location). Commit it in the machine's conversion commit.
Copy this template. Fill every line. Write "none" where a line is empty.
### Conversion record: <machine>
- **Pins**: <how many, the command that ran them, the result against the unchanged code, the pins commit>
- **Impossible states closed**: <each one from the audit entry: unrepresentable or rejected, and the test that proves it>
- **Behavior changes**: <each pin you edited, as old behavior → new behavior>
- **Choices made without the user**: <each event-handling choice from step 4>
- **Contracts**: <unchanged, or what changed and who approved it>
- **Stored impossible rows**: <the query that finds them, and the named state reads map each combination to>
- **Open decisions**: <everything left as pinned because it needs approval>
- **Not verified**: <anything you could not check: no tests for an area, no way to run the app, no lint or type check>
Keep the final message short. It has three parts, in this order:
Before you report done, the pins passed before the change, the full suite passes after it, and lint and type checks pass where the repo has them.
Every conversion should be checkable against all three:
state field in API responses, a can/allowedTransitions list, clear error messages naming the current state and why a transition was rejected, and a short entry in the repo docs listing each machine with its states and transitions. Step 6 still applies: add a field to an existing response only when no existing test or consumer pins its exact shape.If a proposed change helps one audience at another's expense, say so in the report instead of proceeding.
Record these in the report as "leave alone" with the reason, so the next audit does not rediscover them.
| Thought | What to do |
|---|---|
| "They asked for fixes, so the report can wait." | Write the report first. It decides which machines get converted and what the pins must cover. |
| "They said the existing tests cover it." | Check the claim against the audit entry (step 1). Write the missing pins. |
| "There is no column for this state, so I'll store it as another state plus a note." | That is a new implicit machine (step 3). Leave the behavior pinned and list it under Open decisions. |
| "These three machines are small; one pass and one commit is faster." | One machine at a time: pins commit, then conversion commit. |
| "The new field is additive, so I can update the old test." | An existing test that must change is a contract change (step 6). |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/implicit-state-machine-finder:implicit-state-machinesfrom implicit-state-machine-finder
implicit-state-machine-finder@2389-research is listed by 2389-research/claude-plugins — review the source before installing
npx claudepluginhub 2389-research/claude-plugins --plugin implicit-state-machine-finder