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★ 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]
THEOREMtakes a full declaration name or a unique dotted suffix inFILE.lean. Unsafe declarations and non-theorem definitions exit 2.- Point
--outat a scratch folder outside the repo so charts stay out of your checkout. Without--out, output goes to<short-theorem>-proofbesideFILE.lean. --view FILEapplies a plain-English view module tolemmas.mmdandproof.mmd.--tacticsshows raw Lean tactic lines insideproof.mmdboxes.--configapplies only to TLA+ specs and exits 2 on.leaninputs.- Toolchain lookup checks
LEAN_SYSROOT, thenleanandlakeonPATHfrom the package root, then a pinnedmisehttp:leaninstall forv4.34.1. Every resolved binary must reportv4.34.1. Any other pin or version exits 2. - Runs on a Lake package call
lake setup-filein place.lake setup-filewrites the gitignored.lake/folder and may createlake-manifest.jsonwhen 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
Nextas a disjunction of actions, such asYouPressPlay \/ YouPressStop. Otherwise TLC names every stepNext. - A state with no step out breaks
NoDeadlock, even when it is a valid end state. If anINVARIANTorPROPERTYalready usesNoDeadlock, the rule name isCHECK_DEADLOCK. Add a no-op end-state action toNext, such asDone == phase \in {"paid", "failed"} /\ UNCHANGED vars, and label it instep().
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.colorsmaps each group name toblue,orange,purple,yellow,teal,tan, orpink.titlesets 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
Установить statechart в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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 запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic