/arch-skills:state-machine-auditfrom Architecture skills
Find the implicit state machines in an app or repo, map them (Mermaid for big ones), judge whether each behavior is intended, flag paths to bugs or invalid states, and write a findings report.
Ships in Architecture skills. 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.
Read-only analysis. Never change the code under review.
In this order:
owner/repo or URL: gh repo clone <repo> /tmp/sm-audit/<name> -- --depth 1.gh repo list --limit 100 | grep -i <name>); if more than one or none fits, ask.git rev-parse --show-toplevel in the current directory.Record the commit (git rev-parse --short HEAD) for the report.
Run a candidate scan and save it to /tmp/sm-audit/candidates.txt:
rg -n --hidden -g '!node_modules' -g '!vendor' -g '!dist' -g '!*.lock' -i \
-e '\b(status|state|phase|stage|step|mode|lifecycle)\b\s*[:=]' \
-e '\benum\b' -e 'models\.TextChoices|IntegerChoices' \
-e 'switch\s*\(.*(status|state|phase|step)' -e 'case\s+.*(STATUS|STATE)' \
-e '\b(is|has)[A-Z][A-Za-z]*\s*[:=]\s*(true|false)' \
-e '_(at|on)\b.*(null|None)' \
-e 'useReducer|createMachine|transition|workflow|approve|reject|cancel|retry' \
<repo> > /tmp/sm-audit/candidates.txt
Also check migrations/schema files for status columns, check constraints and defaults.
Implicit machines usually look like:
isLoading, isError, isDone)signed_at, cancelled_at, deleted_at)Group hits by entity. For a large repo, run one subagent per area (backend models, API, UI, jobs) in parallel, each returning machines in the format below; tell them not to post or edit anything.
For every machine record:
file:line of every write.Check each machine against this list:
Judge intent from evidence: tests, docs, comments, ADRs, issues, commit messages. Rate each behaviour: Intended, Likely intended, Unclear, Likely bug, and give confidence (high/medium/low). Never call something a bug without the code path that reaches it.
stateDiagram-v2 for any machine with more than 5 states, more than 7 transitions, or branching guards. Smaller ones get a transition table.note and add a classDef risky fill:#b00020,color:#ffffff style; keep text high contrast.Write state-machine-report-YYYY-MM-DD.md (outside the repo, or where the user says). Structure:
file:line, intent verdict.file:line), intended or not, suggested fix, suggested test.Then give a short chat summary: count of machines, top 3 findings, report location. Offer to file GitHub issues for chosen findings; file nothing without a yes.
What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/architecture-decision-reviewReviews a design choice before it is built and returns an ADR with a reversibility call, a connascence table and fitness functions. Use when choosing between design options, or before a plan adds, splits or moves a module, dependency, schema or public API./architecture-review-reportReviews the architecture in a written plan, spec, RFC, design doc or set of GitHub issues and writes an evidence-based report: each finding quotes its text and gives a severity, an impact and a suggestion. Use for "review this spec" or "what's wrong with this plan"./pr-erosion-checkOther plugins' skills for the same job
npx claudepluginhub bytefloww1013/josh-skills --plugin arch-skills