statechart

statechart is a skill for Claude Code from saadshahd/moo.md. It costs 84 tokens per session (1,162 once invoked), scanned A, original, MIT.

A workflow for modelling a state machine in TLA+, a language for describing system behaviour, and checking it with a model checker. It examines every permitted order of events and shows short paths to rules that fail.

In plain words
What is it for?
It is for checking ordering rules in stateful systems and linking each model action back to the code it represents.
Why use it?
It helps find bugs caused by events happening in the wrong order, especially in flows, protocols, retry loops, and other systems that move between states.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_SKILL_DIR} variable.

Part of the hunch plugin — 5 skills shipped together

Good fit It is for checking ordering rules in stateful systems and linking each model action back to the code it represents.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saadshahd/moo.md/statechart
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 saadshahd/moo.md --skill statechart
Clone the repo
git clone --depth 1 https://github.com/saadshahd/moo.md

Made for: Claude Code.

Or install hunch, the plugin that ships this one along with the rest of its 5 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 statechart

README.md
[![agentmods](https://agentmods.dev/badge/skills/saadshahd/moo.md/statechart/github.svg)](https://agentmods.dev/skills/saadshahd/moo.md/statechart)
Your own site
<a href="https://agentmods.dev/skills/saadshahd/moo.md/statechart"><img src="https://agentmods.dev/badge/skills/saadshahd/moo.md/statechart/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 statechart

Your own site · 80×15
<a href="https://agentmods.dev/skills/saadshahd/moo.md/statechart"><img src="https://agentmods.dev/badge/skills/saadshahd/moo.md/statechart.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,162 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.00084 $0.01162
Opus 5.5 $0.00034 $0.00465
Sonnet 5.5 $0.00017 $0.00232
Haiku 4.5 $0.00008 $0.00116

Measured today against content hash 808a26ba3966, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

statechart 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 today.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/chart.ts, scripts/statechart.test.ts, scripts/statechart.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

hunch/skills/statechart/SKILL.md · 73 lines

How it starts

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

The reader is the person who decides whether the behavior is right.

Pick the target

Pick the promise whose break harms users most and that tests rarely reach. Read the code for it; ask the user only what the code cannot show.

Name the question before the tool:

The question The tool
Can events happen in a bad order? A model checker: this skill
Does the code hold for every input? A verifier that runs on the code; with none for its language, generated inputs on the real code
Does it hold at every size, past any bound? A proof

A question that is not about order → say which kind it is and stop; sound:find picks the tool.

Write the model

Write SPEC.tla and SPEC.cfg in a scratch folder, or beside the code they cover when the project keeps them.

  • Point each action at the code a reviewer can open, in a \* path:line comment. What the code does in one indivisible step is one action; two steps are two.
  • Head the spec with the files and functions it covers and the commit it was last checked against, \* covers: and \* synced:, so a later change to them shows the model may be stale.
  • Each rule the reader agrees to is an INVARIANT; one about "eventually" or "forever" is a PROPERTY. A rule with no variable to check it gets one. Never weaken a rule to make it hold.
  • Next is a disjunction of named actions, Pay \/ Decline, so each step has a name.
  • A correct end state still breaks deadlock: give it a step that changes nothing, Done == phase \in {"paid", "failed"} /\ UNCHANGED vars.
  • Keep the constants small, or add a CONSTRAINT, so the check ends.

Write the view

A module that exports:

  • state(vars): the reader's words for a state, such as "Paying" or "Lease held, write pending", never a variable name. A set arrives as an array; a sequence, record or function as an object keyed by its domain, so v.pc[1] is pc[1].
  • step(action, from, to): the step as the reader sees it happen, such as "you press pay", or null to hide it. A step that happens only in some conditions ends with them in brackets, in the reader's words: you press play [while the file loads]. Two actions that end the same share a label, and so an arrow.
  • title.

Read the full file on GitHub · 73 lines

Files

What ships with it

5 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. today Changed 808a26ba3966
  2. 2d ago Changed 6da2018cf61d
  3. 11d ago First seen · 73 lines · 84 tokens per session scan A cf0291e537ed

Subscribe to this mod's changes

statechart is a skill published in the GitHub repository saadshahd/moo.md (38 stars, last pushed today), licensed MIT. It adds 84 tokens to every session and 1,162 once invoked, about $0.0003 per session on Opus 5.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-11-19.

Related

statechart compared with skills from other repositories

statechart next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
statechartsaadshahd/moo.mdSkill38todayMITA84Claude Code
session-recapsxhmilyoyo/sundayhao-pluginsSkill87d agoApache-2.0A39Claude Code
knowledge-bank-lookupsxhmilyoyo/sundayhao-pluginsSkill87d agoApache-2.0A94Claude Code
kb-ingestsxhmilyoyo/sundayhao-pluginsSkill87d agoApache-2.0A152Claude Code
kb-lintsxhmilyoyo/sundayhao-pluginsSkill87d agoApache-2.0A103Claude Code
session-managersxhmilyoyo/sundayhao-pluginsSkill87d agoApache-2.0A49Claude Code
lark-openapi-explorerDropFan/claude-code-pluginsSkill81mo agoMITA76Claude Code