agentleFS
Beskars-CodeBeskars-Code/Skills/skills/statechart/SKILL.md

statechart

Skill0 starsChanged 7 days agoMITView on GitHub

Use only when the user asks for /statechart, to model-check or draw a flow, protocol, service, or state machine as a checked statechart, or to show a bug as a path through states.

50 other projects use a version of this, 39 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use make-bot-ui, reframe and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • eryzerzSkill

    make-bot-ui

    Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.

    Also in 10 projects that use this

  • rohunvoraSkill

    reframe

    This skill should be used when the user is stuck, obvious solutions aren't working, constraints feel impossible, or they keep circling back to bad options. Use when designs keep getting rejected or the user is solving symptoms instead of root causes.

    Also in 11 projects that use this

  • JordanHoodSkill

    guardrails

    Safety hooks for Claude Code that protect against destructive operations, enforce write boundaries, and gate sensitive actions. Essential when running autonomous workers with --dangerously-skip-permissions. Use when: setting up a new Claude Code environment, configuring safety for dispatch/pipeline workers, or auditing existing hook coverage.

    Also in 3 projects that use this

  • AnasX7Skill

    show-me

    Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.

    Also in 6 projects that use this

  • SentrySkill

    deslop

    Strip AI-generated noise from the diff before pushing — extra comments a human wouldn't write, defensive try/catch in trusted code paths, casts to any, inline imports in Python, and other style inconsistencies with the surrounding file. Use this immediately before commit so the diff stays clean.

    Also in 5 projects that use this

  • MicrosoftSkill

    writing-for-agents

    Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 49 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every run, before judging the model against the code it describes: code-quality.md, code-structure.md.

    line 16
  2. Very specific:

    Run and read: Run the command, then read the report with reading the report: breaks and mayBreak marks, the Legend, rules not checked, and …

    line 27
  3. Very specific:

    Show the result: If the command wrote chart.mmd, show it as a mermaid code block.

    line 28

“Common” is measured: kept by at least 6 in 10 of the 49 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Statechart

Check a TLA+ model of a system that moves between states and draw it as a Mermaid statechart in the reader's words. The checker tries every order of steps up to a bound, marks each state that breaks a rule, and gives the shortest path to each one. The reader, the person who owns the behavior, decides whether the behavior is right.

Adapted from pstack's statechart (MIT). The chart engine in scripts/ is vendored verbatim; see provenance.

Read when

  • Every run, before judging the model against the code it describes: code-quality.md, code-structure.md.
  • Reading the report, rendering an image, or updating the engine: reference.md.
  • Writing the hand-off: plain language.

Process

  1. Set up. Work in a scratch folder outside the repo. The command is scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR] from this skill's folder. It is TypeScript, so it needs Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later. The first run installs TLC and Java with mise and needs the network; or set TLA2TOOLS to a tla2tools.jar path and JAVA to a Java 11 or later binary.
  2. Write the spec and config. Create an adjacent SPEC.cfg or pass a config with --config. Set INIT and NEXT or SPECIFICATION, and list each agreed invariant with INVARIANT. Add variables when a rule needs them. Never weaken a rule to make it hold. Write Next as a disjunction of named actions so TLC can name each step. Give intended terminal states a no-op action, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, to avoid a spurious deadlock.
  3. Pick the chart. The judgment is yours: the words on each state and arrow, the phases and their colors, the title, and the report to the reader. Put it in a view module and pass it with --view. The view exports state(vars): a string gives a flat chart (v.paid ? "Paid" : "Paying"), an array gives parent states (v.main.split(".")), and an object gives one parallel region per key ({ Playback: v.playback, Volume: v.volume }). Label each state with what the reader can see or cares about; keep variable names out of labels. A TLA+ sequence arrives as an object with keys from 1, and a set as an array.
  4. Label the arrows. The view can export step(action, from, to), returning the arrow label as the user sees it happen, such as "you press play" or "the connect fails". Never name the code or the TLA+ action. Two actions that end the same get the same label, so they share one arrow. End a label with its condition in brackets when a step happens only sometimes, such as you press play [while the file loads]; in a regions chart skip brackets for conditions on other regions, since the command writes those itself. When a hidden value decides where a step goes, name the result instead, such as "the roster read fails". The view can also export group(vars) for phase colors, colors, and title. Each function runs at most once per model state or step, so make it depend only on its arguments.
  5. Keep it readable. Aim for about 20 arrows or fewer. Start with coarser state() labels: one label for values that act the same, and leave out detail the reader does not need. Keep every state on a bug path and every mark. Never merge two states that break different rules. Still too busy: return null from step() for steps the reader does not need, keeping every state reachable from a start state, at least one arrow out of each state that has one in the model, and all or none of the steps behind one arrow. Say in the hand-off which steps the chart hides. A step that stays inside one label is not drawn; split the label when the reader must see it.
  6. Run and read. Run the command, then read the report with reading the report: breaks and mayBreak marks, the Legend, rules not checked, and the 500-state chart budget all have fine print that changes what a result means.
  7. Show the result. If the command wrote chart.mmd, show it as a mermaid code block. Otherwise give the report and explain the chart limit. Render SVG on request or when the chart is too large to read as text, following render a chart.
  8. Hand off. Give each chart and its Mermaid text to the person who must decide. Add one line per bug: the rule, the reader's sentence for that rule, and the path as the report numbers it. Say what the model leaves out, and give the command that makes the files again with a new --out folder. When the model describes code, replay each bug path against the real code, as a test or a live repro, one step per action. If a bug does not occur there, treat the model as wrong until you show it is not.

If a parent already owns the next step

A project-local formal verification skill may name /statechart to read its results. Return the chart, the report findings, and what the model leaves out. The parent owns any fix. This skill never edits product code and never weakens a rule to reach a pass.

Anti-patterns

  • Weakening an invariant, shrinking the model, or merging states until the marks go away
  • Labels that name variables, code, or TLA+ actions instead of what the reader sees
  • Reporting a bug path that was never replayed against the real code it claims to describe
  • Editing the vendored engine in scripts/ to change a verdict

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.