Skip to content
Skill

Statechart

Model-check a TLA+ spec of a stateful system and draw bug paths as a Mermaid chart

Statechart is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
Java, JavaScript, TypeScript
Platforms
Claude Code
GitHub stars
5.1K
Last commit
License
MIT
Listing updated

Similar skills

About Statechart

This skill runs TLC, the TLA+ model checker, against a spec of a system that moves between states, such as a product flow, a protocol or a service. It checks each invariant the user agrees on and reports the shortest sequence of steps that reaches each state breaking a rule.

The bundled command writes the results as a Mermaid statechart. The agent can add a view module that controls state labels, arrow wording, phase colors and a title, so the chart reads in the user's terms rather than variable names. The report lists which rules broke, which were not checked when a run hit its state bound, and the path for each bug.

The skill expects a TLA+ spec and config, plus Java and TypeScript or JavaScript support for the scripts. On first run it installs TLC and Java through mise, which needs network access. The skill's own guidance is to run it in a scratch folder outside the repository.

When your agent uses it

Check a TLA+ model of a system that moves between states, such as a product flow, a protocol, or a service, and draw it as a Mermaid statechart. The report gives the shortest path to each state that breaks a rule. Use for /statechart, or to show a bug as a path through states.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 412 files (2.8 MB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude

Or copy only this skill to ~/.claude/skills/statechart:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/statechart &&
cp -R "$tmp/plugins/pstack/skills/statechart" ~/.claude/skills/statechart &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/statechart inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/statechart to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/statechart &&
cp -R "$tmp/plugins/pstack/skills/statechart" ~/.agents/skills/statechart &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/statechart inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/statechart to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/statechart &&
cp -R "$tmp/plugins/pstack/skills/statechart" ~/.cursor/skills/statechart &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/statechart inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/statechart

Or copy the folder to ~/.gemini/skills/statechart yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/statechart:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/statechart &&
cp -R "$tmp/plugins/pstack/skills/statechart" ~/.copilot/skills/statechart &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/statechart inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git

Then copy pstack-claude/plugins/pstack/skills/statechart into your agent's skills folder as statechart. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

TLA+ invariant checking
Runs TLC on a spec and its config, checking each rule the user agrees to as an invariant.
Shortest bug paths
Reports the shortest sequence of steps leading to each state that breaks a rule.
Mermaid statechart output
Draws the model as a Mermaid statechart with marks on states that break rules.
Custom chart views
Lets the agent define state labels, step wording, phase colors and a title through a view module.
Chart size control
Offers ways to coarsen labels and hide steps so busy charts stay readable.
Bounded runs
Stops reruns at a fixed state count and lists rules that were not checked.

Good for

  • Check whether a checkout or onboarding flow can reach a state that breaks a business rule
  • Find the shortest sequence of events that leads a protocol into a bad state
  • Draw a service's state machine as a chart and mark where a rule fails
  • Show a reported bug as a path through states before writing a fix

Statechart FAQ

What does the skill need to run?

A TLA+ spec and config. The first run installs TLC and Java with mise and needs network access. The scripts are TypeScript, JavaScript and a POSIX shell wrapper.

Which AI clients does Statechart work with?

It is a Claude Code plugin skill in the pstack-claude marketplace, so the content ties it to Claude Code.

Does Statechart change my code?

The skill works on a TLA+ model in a scratch folder outside the repo. It does not modify the codebase, though the agent may replay bug paths against real code as tests.

Can Statechart check a large model?

Large models can run without end, so the guidance is to keep constants small or add a CONSTRAINT. The chart is drawn only when the state count is within 500 states.

How do I install Statechart in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/statechart to use it in all your projects, or to .claude/skills/statechart in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

Does Statechart run scripts?

Yes. It runs Java, JavaScript and TypeScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Statechart?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Statechart?

The closest alternatives to Statechart are Mermaid diagram generator, Diagramming code, Illuminate concept, Create formal verification skill and Shiplog trace.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from michael-denyer/pstack-claude

  1. Makes the agent read pstack's poteto-mode skill first and follow its routing

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  2. Has the agent restate your goals and the problem you're solving in its own words

    • Open source
    • 5.1K GitHub stars
    • Productivity
  3. Sketches types, signatures and module layout before the agent writes code

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  4. Runs parallel candidate attempts at a task, then merges the best parts into one artifact

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  5. Drafts a personal working-style skill from your past agent conversations

    • Open source
    • 5.1K GitHub stars
    • Developer tools