/vibe-coder:state-machine-hunterfrom Vibe Coder
Finds implicit state machines (boolean soup, status flags, step counters) in codebases, ranks them by harm, and refactors them into explicit named status fields without changing behavior.
Ships in Vibe Coder. 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 state spread over several variables whose legal combinations live only in the author's head. It hurts all three audiences:
The fix that serves all three is the same: one named status field with a closed set of values, and transitions in one place. Do it with what the repo already uses. Do not add XState or any library unless the repo already has it.
Search; read only the hits. For a large repo, send an Explore subagent with these patterns and ask for file:line lists back.
| Signal | Grep for |
|---|---|
| Boolean soup | 2+ of is[A-Z]\w*, has[A-Z]\w*, loading, error, submitted, done in one component, store, class or table |
| Stringly status | status, state, step, phase, mode, stage compared to string literals (=== 'pending') |
| Step counters | step, currentStep, page incremented with + 1 (wizards, onboarding) |
| Nullable-as-state | data, user, result checked against null to mean "not loaded yet" |
| Guarded handlers | handlers that start with if (isX) return (re-entry, double submit) |
| Persisted status | DB columns or enums named status/state; timestamps like paid_at, cancelled_at used as flags |
| Effects chains | useEffect/watchers that set one flag when another changes |
| Retry/timers | retry, attempt, setTimeout, polling, backoff |
For each candidate, write down: the variables, every combination the code can reach, which of those are impossible but reachable, the events that move between them, and every file that reads or writes them.
Give the user one table, worst first. Rank by user harm, then by how many files touch it.
| # | Machine | Where | States (named) | Impossible states reachable | Harm | Fix size |
|---|
Then a mermaid stateDiagram-v2 for the top one or two only. End with the fix you recommend for #1 and ask before changing anything. Persisted status (DB, API payloads, URLs, analytics events) is a data-model change: always ask, never fold it into a UI refactor.
One machine per change. Smallest form that closes the impossible states, in the repo's own idiom:
type S = { status: 'idle' } | { status: 'loading' } | { status: 'error'; error: E } | { status: 'ready'; data: D }, and a switch with an exhaustive never check. Data lives inside the state that has it.useReducer (or the store's existing pattern) instead of several useStates. Transitions are the reducer's cases; illegal events in a state return the state unchanged.Enum plus one ALLOWED = {from: {to, ...}} table and one transition() that raises on an illegal move.Rules that keep it from breaking anything:
isLoading, derive it (const isLoading = s.status === 'loading') rather than editing every caller in the same change.awaitingPayment, not step3).// States of checkout; transitions in checkoutReducer. That line is what the next agent greps.isOpen on a modal) is fine.Lessons from earlier runs live in two files: ~/.claude/skill-lessons/state-machine-hunter.md (any repo) and .claude/skill-lessons/state-machine-hunter.md at the repo root (this repo only).
- <YYYY-MM-DD>: <do or avoid X> because <Y>. (seen: 1). When a line already says the same thing, raise its seen count and date instead of adding one. Facts about this repo go in the repo file, everything else in the user file. Keep each file under 30 lines by merging or dropping stale lessons.seen: 3: if the ashish-claude-skills source repo is open, propose the edit to plugins/vibe-coder/skills/state-machine-hunter/SKILL.md as a diff and wait for a yes, then delete the lesson once it lands; otherwise say Lesson ready to promote: <line> in the report.Learned: <the line written | nothing>.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ashishyd/ashish-claude-skills --plugin vibe-coder6 skills in this plugin
/bug-triagerUse when a bug, edge case, failing case or code-review finding turns up and you must decide whether to fix it now; when tempted to add handling for a rare or hypothetical case; or when the user asks to triage, prioritise or rate bugs. Scores each one on frequency and severity (1-10 each); a product below 5 becomes an issue and the code is left alone./launch-readyUse when a vibe-coded site or web app is about to go live, or when the user asks for a pre-launch, launch-readiness or ship check. Covers consistent design, mobile, every state, real-user flows and launch details. Five read-only subagents audit 20 checks, the user approves the issue list, then you fix everything in one pass and show before-and-after screenshots./