state-machineslisted
Install: claude install-skill waynesutton/builder-skills
# State machines
An implicit state machine is a field, or a group of fields, that moves through stages with no written list of allowed moves. The list exists anyway. It is spread across every function that writes the field, and nobody has read it in one place.
This skill reads it in one place. It writes a report. It changes no code until the user picks a machine to fix.
Most of what it finds is product design and bugs. The part an attacker can use belongs to `sec-check` rule 21.
## What counts
- A field named `status`, `state`, `stage`, `phase`, or `step` (draft, pending, paid, shipped, refunded).
- A group of booleans that act like one status: `isPaid`, `isApproved`, `isRejected`, `isPublished`.
- A timestamp that doubles as a flag: `paidAt`, `deletedAt`, `completedAt`, `verifiedAt`.
- A flow spread across UI, mutations, webhooks, and scheduled jobs: onboarding, checkout, invites, approvals, AI jobs, uploads.
## Run the audit
Work at the repo root with the whole repo open. On a Convex app, start with `convex/schema.ts`, then `convex/**/*.ts`, `convex/http.ts`, and `convex/crons.ts`.
1. **Find the fields.** Search the schema and types:
```bash
rg -n "\b(status|state|stage|phase|step)\b\s*[:=]" convex src --glob '!**/_generated/**'
rg -n "\bis[A-Z]\w+:\s*v\.(boolean|optional)" convex/schema.ts
rg -n "\w+At:\s*v\.(number|optional)" convex/schema.ts
```
Group booleans and timestamps on the same table that describe one lifecycle. Each group is one mach