state-machine-design

state-machine-design is a skill for Claude Code, Codex from segunadebayo/design-eng-skills. It costs 41 tokens per session (825 once invoked), scanned A, original, MIT.

A method for designing state machines: models that describe how a system moves between a finite set of modes when events occur.

In plain words
What is it for?
Use it to map a component, process, or lifecycle, define its transitions, find missing cases, and visualize or simulate its behavior.
Why use it?
It replaces tangled combinations of yes-or-no flags with named states, events, conditions, and actions that are easier to check.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the design-eng-skills plugin — 4 skills shipped together

Good fit Use it to map a component, process, or lifecycle, define its transitions, find missing cases, and visualize or simulate its behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/segunadebayo/design-eng-skills/state-machine-design
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add segunadebayo/design-eng-skills --skill state-machine-design
Clone the repo
git clone --depth 1 https://github.com/segunadebayo/design-eng-skills

Made for: Claude Code, Codex.

Or install design-eng-skills, the plugin that ships this one along with the rest of its 4 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for state-machine-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/segunadebayo/design-eng-skills/state-machine-design/github.svg)](https://agentmods.dev/skills/segunadebayo/design-eng-skills/state-machine-design)
Your own site
<a href="https://agentmods.dev/skills/segunadebayo/design-eng-skills/state-machine-design"><img src="https://agentmods.dev/badge/skills/segunadebayo/design-eng-skills/state-machine-design/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for state-machine-design

Your own site · 80×15
<a href="https://agentmods.dev/skills/segunadebayo/design-eng-skills/state-machine-design"><img src="https://agentmods.dev/badge/skills/segunadebayo/design-eng-skills/state-machine-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 825 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.00825
Opus 5 $0.00020 $0.00413
Sonnet 5 $0.00008 $0.00165
Haiku 4.5 $0.00004 $0.00082

Measured 12d ago against content hash e10d64d863d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

state-machine-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/state-machine-design/SKILL.md · 37 lines

How it starts

The opening of the file, as written. The whole thing — 37 lines — stays where its author put it; the contents beside it link to each section on GitHub.

State Machine Design

A framework-agnostic methodology for designing state machines. Built from Harel's foundational statecharts papers, the W3C SCXML spec, and how XState, Spring Statemachine, Stateless, python-statemachine, and Erlang's gen_statem actually get used. Not any single one of them. Use GLOSSARY.md's terms exactly. See SOURCES.md for what this is built on, and where the sources disagree with each other.

1. Recognize the shape

Is this actually a state machine? Here's the tell: the same event gets handled differently depending on a finite, countable mode. It's often hiding as a pile of booleans where most combinations never actually occur, the boolean-soup smell. See METHODOLOGY.md.

2. Determine scope and elicit the behavior

Model one component, one process, one lifecycle. Not a whole application. Find out what actually happens before you design anything: ask "what happens when...?" for every event, in every candidate state, including the cases nobody thought to mention. See METHODOLOGY.md and #3.

3. Name states and events

Write down the finite state and event set, using GLOSSARY.md's terms only. No loose synonyms. Different behavior on the same event means a different state. Identical behavior means the same state.

4. Design the machine

Flat happy path first. Then the rest of the workflow: errors, retries, timeouts. Then guards, pure, no side effects. Then hierarchy, only once duplication actually shows up, scavenge for reuse, don't nest ahead of time. Then parallel regions, only for concerns that are genuinely independent. Then history, only for a real "resume where I left off" need. Full detail in METHODOLOGY.md, including exactly where the sources disagree: transition-priority direction, guard order across regions.

Read the full file on GitHub · 37 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 37 lines · 41 tokens per session scan A e10d64d863d8

Subscribe to this mod's changes

state-machine-design is a skill published in the GitHub repository segunadebayo/design-eng-skills (6 stars, last pushed 1mo ago), licensed MIT. It adds 41 tokens to every session and 825 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.