Skip to content
Back to skills

Statechart

ASecurity

Model a stateful flow, check its invariants within stated bounds, and explain counterexample paths.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agentsgit

Works with

  • cursor
  • terminal

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add umararshad4/honey-stack --skill statechart --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Statechart?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Statechart
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/umararshad4-statechart/badge)](https://www.skillsdirectory.com/skills/umararshad4-statechart)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: statechart
description: "Model a stateful flow, check its invariants within stated bounds, and explain counterexample paths."
disable-model-invocation: true
license: MIT
metadata:
  reviewed: "2026-11-01"
  sources: "cursor/plugins 4dd1d05818d19792e7cd6e818f1667f95f7e1dbe pstack/skills/statechart/SKILL.md and pstack/skills/create-formal-verification-skill/SKILL.md (ideas distilled)"
---

# Statechart

Use for queues, retries, workflows, protocols and concurrency where ordering can break an invariant. This is optional, not a gate for routine edits. A statechart illustrates a model; passing a model checker does not prove the production implementation.

## 1. State the property

Read the actual transition handlers, persistence and existing tests. List the states, actions, actors and failures in user/domain terms. State the invariant before modeling it: for example, a failed evaluation cannot reach release, or a retry cannot charge twice. Map each action to its source location and name abstractions such as omitted timing, bounded workers or an assumed atomic write.

Work in a scratch directory outside the repo unless the user wants a maintained model. Use `domain` for disputed terms and `debug` if a concrete incident still needs diagnosis.

Done when: the property, code mapping, assumptions and finite bounds are written down.

## 2. Build and check

For event ordering, model with TLA+ and check with TLC. Read [the model-checking recipe](references/model-checking.md). If the question is better answered by an existing language-specific verifier or property-test harness, use it and state its bounds instead.

Represent retries, failures and competing actors, not only the successful path. Encode safety as invariants; check liveness only with explicit fairness assumptions. A legitimate terminal state gets a stuttering action, rather than disabling deadlock checking globally. Do not weaken the property to make the check pass.

If no checker is available, report **model drafted, unverified** with the missing prerequisite. A hand-drawn diagram or source inspection is not a completed check.

Done when: the checker terminates with its command, version, exit result, coverage and log saved, or the unavailable prerequisite is explicit.

## 3. Explain the result

Produce a Mermaid statechart with domain labels. Label it **model**, and distinguish modeled transitions from observed production behavior. For a violation, show the shortest counterexample returned by the checker; if the checker did not minimize it, call it a counterexample, not the shortest one. Include the invariant violated and the input/action sequence needed to reproduce it.

Turn a useful counterexample into a real implementation regression test via `tdd`. A model fix and a code fix need separate verification. For a reusable project verification entry point, offer the explicit `project-verify` command.

Done when: the report states what was checked, what was excluded, and whether the counterexample reproduces in real code.

Files in this skill

  • SKILL.md3 KB
  • agents/openai.yaml158 B
  • references/model-checking.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.