factory-statechart

factory-statechart is a skill for Claude Code from watt-mind/factory. It costs 72 tokens per session (2,215 once invoked), scanned A, a copy of statechart, Apache-2.0.

A tool-assisted method for checking state-changing systems with a TLA+ model and drawing the results as a Mermaid statechart. TLA+ describes possible system behaviour; a statechart shows the steps between states.

In plain words
What is it for?
Use it to examine product flows, protocols, and services that move through states, and to show a bug as a readable sequence of steps.
Why use it?
It can reveal rules that fail, dead ends, and short paths to incorrect states before relying on the real system.

Skill for Claude Code

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

Part of the core plugin — 38 skills, 22 commands, 5 agents, 1 hook shipped together

Good fit Use it to examine product flows, protocols, and services that move through states, and to show a bug as a readable sequence of steps.

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

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 38 skills, 22 commands, 5 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 factory-statechart

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/watt-mind/factory/factory-statechart"><img src="https://agentmods.dev/badge/skills/watt-mind/factory/factory-statechart.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,215 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 92% copy Near-identical to another mod 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.00072 $0.02215
Opus 5.5 $0.00029 $0.00886
Sonnet 5.5 $0.00014 $0.00443
Haiku 4.5 $0.00007 $0.00221

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

Security

Grade A, and why

factory-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 12d ago.

The scan reads SKILL.md. This mod also ships 26 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

This is a copy

92% identical to statechart — 19 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/core/skills/factory-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 namespaced scratch folder outside the repo (for example $TMPDIR/statechart-<ticket-or-session>/). Write a TLA+ spec and its config. Then run:

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

<skill dir>/scripts/statechart is an executable wrapper that picks an available TypeScript-capable runtime (bun, node, or deno) to run scripts/statechart.ts.

The first run installs TLC and Java with mise and needs the network (or uses TLA2TOOLS / JAVA env vars when preinstalled).

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 });

Read the full file on GitHub · 82 lines

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 Changed · -1 lines 86a237235fe3
  2. 15d ago First seen · 83 lines · 72 tokens per session scan A f6fa132b3f97

Subscribe to this mod's changes

factory-statechart is a skill published in the GitHub repository watt-mind/factory (24 stars, last pushed yesterday), licensed Apache-2.0. It adds 72 tokens to every session and 2,215 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 92% identical to statechart, differing in 19 lines, and is treated as a copy.

Related

factory-statechart compared with skills from other repositories

factory-statechart next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
factory-statechartwatt-mind/factorySkill24yesterdayApache-2.0A72Claude Code
agent-performance-optimizerruvnet/rufloSkill83ktodayMITA19Claude Code
agent-refinementruvnet/rufloSkill83ktodayMITA15Claude Code
ap-depth-proberSpielewoy/autoprompt-skillSkill1.3k1mo agoMITA22Claude Code
ap-preflight-probeSpielewoy/autoprompt-skillSkill1.3k1mo agoMITA23Claude Code
reengineering-vibe-coderichfrem/agent-plugins-skillsSkill8yesterdayMITA124Claude Code
mutation-testingvmobifystudio/app-dev-teamSkill57d agoMITA65Claude Code