Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

statechart

БесплатноЗапускает вложенные скриптыНе проверен

Check a TLA+ model with TLC or a Lean 4 proof and draw it as Mermaid. Report shortest bug paths for TLA+, and plain-English lemma graphs, proof trees, gaps…

cursorот cursor★ 20 800 звёзд на GitHub

Об этом скилле

Statechart

Draw how a TLA+ system moves between states or how a Lean 4 proof works, in the operator's words.

Run

scripts/statechart runs scripts/statechart.ts with Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later. On native Windows, run node --disable-warning=ExperimentalWarning <skill dir>/scripts/statechart.ts with Node 22.18 to 22.x, or Node 23.6 or later. The first positional argument picks TLA+ or Lean 4 mode. --out DIR must be new or empty in both modes.

TLA+ models

Work in a scratch folder outside the repo, write a TLA+ spec and its config, and run:

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

The first TLA+ run installs TLC and Java with mise and needs network access. --tactics applies only to .lean files and exits 2 on .tla inputs.

Lean 4 proofs

Run against a .lean file pinned to Lean v4.34.1, or a standalone .lean file with no lean-toolchain:

<skill dir>/scripts/statechart FILE.lean THEOREM [--view FILE] [--tactics] [--out DIR]
  • THEOREM takes a full declaration name or a unique dotted suffix in FILE.lean. Unsafe declarations and non-theorem definitions exit 2.
  • Point --out at a scratch folder outside the repo so charts stay out of your checkout. Without --out, output goes to <short-theorem>-proof beside FILE.lean.
  • --view FILE applies a plain-English view module to lemmas.mmd and proof.mmd.
  • --tactics shows raw Lean tactic lines inside proof.mmd boxes.
  • --config applies only to TLA+ specs and exits 2 on .lean inputs.
  • Toolchain lookup checks LEAN_SYSROOT, then lean and lake on PATH from the package root, then a pinned mise http:lean install for v4.34.1. Every resolved binary must report v4.34.1. Any other pin or version exits 2.
  • Runs on a Lake package call lake setup-file in place. lake setup-file writes the gitignored .lake/ folder and may create lake-manifest.json when the package has none. Copy the Lake package into a temporary folder first so .lake/ stays out of your checkout.

TLA+ workflow

Write the spec

  • Write each rule the operator agrees to as an INVARIANT. A rule can check a screen, a result, a stored value, or a message. Add any variable a rule needs, and never weaken a rule to make it hold.
  • Write Next as a disjunction of actions, such as YouPressPlay \/ YouPressStop. Otherwise TLC names every step Next.
  • A state with no step out breaks NoDeadlock, even when it is a valid end state. If an INVARIANT or PROPERTY already uses NoDeadlock, the rule name is CHECK_DEADLOCK. Add a no-op end-state action to Next, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, and label it in step().

Pick the TLA+ chart

Put the operator's state labels, arrow labels, phases, colors, and title in a --view FILE module. Its state(vars) export picks the chart shape:

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

Label states with what the operator sees or cares about, such as "Paying" or "Lease held, write pending", without variable names. In vars, a TLA+ sequence is an object keyed from 1, so v.pc[1] is pc[1]. A set is an array.

Export step(action, from, to) to label arrows from the TLC action name and the before and after vars. Write what the operator sees happen, such as "you press play" or "the connect fails", without code or TLA+ action names. Give two actions the same label when they produce the same chart transition so they share one arrow.

When a step requires a condition, append it in brackets in the operator's words, such as you press play [while the file loads]. In a regions chart, omit brackets for other regions. The command adds other-region conditions automatically, such as [when Offline], and custom brackets overwrite them. When an unlabeled value decides the target state, name the outcome in the label, such as "the roster read fails".

The view can also export three optional properties:

  • group(vars) returns a phase name. A chart state gets no color when its model states belong to different groups.
  • colors maps each group name to blue, orange, purple, yellow, teal, tan, or pink.
  • title sets the chart heading.

Make state(), group(), and step() depend only on their arguments. The command calls state() and group() at most once per model state, calls step() at most once per step, and reuses those answers for both the chart and report.md.

The chart omits steps that stay inside one state label. Split a label when the operator must see such a step.

Aim for 20 arrows or fewer. First coarsen state() labels. Merge values that behave alike, and drop details

Полный SKILL.md на GitHub

Установить statechart в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/render.mdscripts/backends/cfg.tsscripts/backends/mermaid.tsscripts/backends/plain-text.tsscripts/backends/report.tsscripts/frontends/config.tsscripts/frontends/dot.tsscripts/frontends/marks.tsscripts/frontends/messages.tsscripts/frontends/spec.tsscripts/frontends/trace.tsscripts/frontends/value.tsscripts/frontends/verdict.tsscripts/frontends/view.tsscripts/ir.tsscripts/janitor.tsscripts/kill.tsscripts/lean/Extract.leanscripts/lean/backends/lemma-chart.tsscripts/lean/backends/mermaid.tsscripts/lean/backends/proof-chart.tsscripts/lean/backends/report.tsscripts/lean/frontends/facts.tsscripts/lean/frontends/view.tsscripts/lean/ir.tsscripts/lean/passes/attribute.tsscripts/lean/passes/blocks.tsscripts/lean/passes/budget.tsscripts/lean/passes/check.tsscripts/lean/passes/contract.tsscripts/lean/passes/fold.tsscripts/lean/passes/inline.tsscripts/lean/passes/mark.tsscripts/lean/passes/reduce.tsscripts/lean/passes/trust.tsscripts/lean/passes/view-lemmas.tsscripts/lean/pipeline.tsscripts/lean/run.tsscripts/lean/toolchain.tsscripts/package.json

FAQ

Что делает скилл statechart?

Check a TLA+ model with TLC or a Lean 4 proof and draw it as Mermaid. Report shortest bug paths for TLA+, and plain-English lemma graphs, proof trees, gaps, failing steps, native code, and custom axioms for Lean 4. Use for /statechart.

Как установить скилл statechart?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл statechart запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить statechart с