# Statechart

> Statechart is an open-source agent skill for developer tools. Model-check a TLA+ spec of a stateful system and draw bug paths as a Mermaid chart. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/michael-denyer/pstack-claude/tree/main/plugins/pstack/skills/statechart
- **Repository:** https://github.com/michael-denyer/pstack-claude
- **GitHub stars:** 5,057
- **License:** MIT
- **Skill name:** statechart
- **Collection:** https://github.com/michael-denyer/pstack-claude
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

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.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs Java, JavaScript and TypeScript scripts](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/statechart)
- [No network calls found in its scripts](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/statechart)
- [License: MIT](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/statechart)

## Features

- **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

## Install

### Claude Code

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

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

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

```sh
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.

### Codex

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

```sh
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.

### Cursor

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

```sh
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.

### Gemini CLI

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

```sh
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.

### VS Code

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

```sh
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.

### Other agents

Get the folder:

```sh
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.

## 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.

## Alternatives

- [Mermaid diagram generator](https://ai-powered.com/skills/mermaid-diagram-generator): Mermaid diagram generator is an open-source agent skill for developer tools.
- [Diagramming code](https://ai-powered.com/skills/diagramming-code): Diagramming code is an open-source agent skill for developer tools.
- [Illuminate concept](https://ai-powered.com/skills/illuminate-concept): Illuminate concept is an open-source agent skill for developer tools.
- [Create formal verification skill](https://ai-powered.com/skills/create-formal-verification-skill): Create formal verification skill is an open-source agent skill for developer tools.
- [Shiplog trace](https://ai-powered.com/skills/shiplog-trace): Shiplog trace is an open-source agent skill for developer tools.
- [Trace architecture](https://ai-powered.com/skills/trace-architecture): Trace architecture is an open-source agent skill for developer tools.
- [Maintain formal verification skill](https://ai-powered.com/skills/maintain-formal-verification-skill): Maintain formal verification skill is an open-source agent skill for security.
- [Testing](https://ai-powered.com/skills/testing-xiaolai-2): Testing is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/statechart
