statechart

statechart is a skill for Claude Code from michael-denyer/pstack-claude. It costs 70 tokens per session (2,160 once invoked), scanned A, original, MIT.

A statechart workflow turns a TLA+ model, code design, or agreed system behavior into a Mermaid diagram showing states and the events that connect them. TLA+ is a formal language for describing and checking how systems behave over time.

In plain words
What is it for?
Use it to draw state diagrams, explain a bug as a path through states, or turn an agreed diagram into a TLA+ model.
Why use it?
It makes complex system behavior easier to inspect and can show a numbered path to a state where a rule fails. This helps reviewers discuss bugs in product flows, protocols, and services using observable behavior rather than internal variable names.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the pstack plugin — 68 skills, 4 agents, 1 hook shipped together

Good fit Use it to draw state diagrams, explain a bug as a path through states, or turn an agreed diagram into a TLA+ model.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/michael-denyer/pstack-claude/statechart
About the project

pstack-claude is a set of opinionated coding-agent skills and workflows ported from Cursor to Claude Code, Codex, Pi, and other agent harnesses. It guides agents toward concise, simple, and verified code by routing goals to suitable workflows and supporting subagent tools. The catalogue entries are the project's skills, agents, hook, and plugin implementations for these agent environments.

michael-denyer/pstack-claude · 4,216 stars · on GitHub

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 michael-denyer/pstack-claude --skill statechart
Clone the repo
git clone --depth 1 https://github.com/michael-denyer/pstack-claude

Made for: Claude Code.

Or install pstack, the plugin that ships this one along with the rest of its 68 skills, 4 agents, 1 hook.

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/michael-denyer/pstack-claude/statechart/github.svg)](https://agentmods.dev/skills/michael-denyer/pstack-claude/statechart)
Your own site
<a href="https://agentmods.dev/skills/michael-denyer/pstack-claude/statechart"><img src="https://agentmods.dev/badge/skills/michael-denyer/pstack-claude/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/michael-denyer/pstack-claude/statechart"><img src="https://agentmods.dev/badge/skills/michael-denyer/pstack-claude/statechart.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,160 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.00070 $0.02160
Opus 5.5 $0.00028 $0.00864
Sonnet 5.5 $0.00014 $0.00432
Haiku 4.5 $0.00007 $0.00216

Measured 14d ago against content hash 9d401e0e3169, 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 14d ago.

The scan reads SKILL.md. This mod also ships 31 executable files (scripts/backends/cfg.ts, scripts/backends/mermaid.ts, scripts/backends/plain-text.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.

Origin

Copies of this mod

3 near-identical copies found in the catalogue:

plugins/pstack/skills/statechart/SKILL.md · 82 lines

How it starts

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

Statechart

The chart shows how a system moves between states, in the words of the person who reads it. That person, the reader, decides whether the behavior is right.

Run

Work in a scratch folder outside the repo. Write a TLA+ spec and its config. Then run:

<skill dir>/scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]

scripts/statechart.ts is TypeScript, so run it with a runtime that can execute TypeScript.

The first run installs TLC and Java with mise and needs the network.

Write the spec

  • Write each rule that the reader agrees to as an INVARIANT. A rule can be about a screen, a result, a stored value, or a message. If the model has no variable for a rule, add the variable. Never weaken a rule to make it hold.
  • Write Next as a disjunction of the actions, such as YouPressPlay \/ YouPressStop. If you do not, TLC names every step Next.
  • A state with no step out breaks NoDeadlock, also when it is a correct end state. When an INVARIANT or a PROPERTY already has that name, the rule is CHECK_DEADLOCK. Add to Next an action that is true only in the end states and changes nothing, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, and give it a label in step().

Pick the chart

You do the work that needs judgment: the words on each state and arrow, the phases and their colors, the title, and the report to the reader. Put your work in a view module, and give it with --view.

To show the reader's words, the view exports state(vars). The value that state() returns picks the form:

  • A string gives a flat chart: export const state = (v) => (v.paid ? "Paid" : "Paying");
  • An array gives parent states: export const state = (v) => v.main.split(".");
  • An object gives one parallel region for each key: export const state = (v) => ({ Playback: v.playback, Volume: v.volume });

Label each state with what the reader can see or cares about, such as "Paying" or "Lease held, write pending". Keep variable names out of labels. In vars, a TLA+ sequence is an object with keys from 1, so v.pc[1] is pc[1]. A set is an array.

Read the full file on GitHub · 82 lines

Files

What ships with it

60 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. 14d ago Changed · +46 lines · -12 tokens per session 9d401e0e3169
  2. 15d ago First seen · 36 lines · 82 tokens per session scan A 1191e664bb22

Subscribe to this mod's changes

statechart is a skill published in the GitHub repository michael-denyer/pstack-claude (4,216 stars, last pushed today), licensed MIT. It adds 70 tokens to every session and 2,160 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-10-27.

Related

statechart compared with skills from other repositories

statechart next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
statechartmichael-denyer/pstack-claudeSkill4.2ktodayMITA70Claude Code
istio-traffic-managementwshobson/agentsSkill42k2d agoMITA40Claude Code
postgresql-table-designwshobson/agentsSkill42k2d agoMITA37Claude Code
event-store-designwshobson/agentsSkill42k2d agoMITA33Claude Code
chief-data-officer-advisoralirezarezvani/claude-skillsSkill30kyesterdayMITA61Claude Code
general-counsel-advisoralirezarezvani/claude-skillsSkill30kyesterdayMITA68Claude Code
strategic-alignmentalirezarezvani/claude-skillsSkill30kyesterdayMITA38Claude Code