state-machine

state-machine is a skill for Claude Code from peteski22/agent-pragma. It costs 9 tokens per session (1,401 once invoked), scanned A, original, Apache-2.0.

A checker for state machines: code that represents states and the allowed moves between them. It examines transitions, final states, cleanup, cancellation, and whether the model matches what the program actually does.

In plain words
What is it for?
Use it to review changed code that defines statuses, transition rules, lifecycle handling, or cancellation behavior.
Why use it?
It can reveal invalid state changes or missing cleanup at the end of a process without mixing in style, security, performance, or test-coverage feedback.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: agent in frontmatter.

Part of the pragma plugin — 12 skills, 2 agents shipped together

Good fit Use it to review changed code that defines statuses, transition rules, lifecycle handling, or cancellation behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/peteski22/agent-pragma/state-machine
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 peteski22/agent-pragma --skill state-machine
Clone the repo
git clone --depth 1 https://github.com/peteski22/agent-pragma

Made for: Claude Code.

Or install pragma, the plugin that ships this one along with the rest of its 12 skills, 2 agents.

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 state-machine

README.md
[![agentmods](https://agentmods.dev/badge/skills/peteski22/agent-pragma/state-machine/github.svg)](https://agentmods.dev/skills/peteski22/agent-pragma/state-machine)
Your own site
<a href="https://agentmods.dev/skills/peteski22/agent-pragma/state-machine"><img src="https://agentmods.dev/badge/skills/peteski22/agent-pragma/state-machine/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 state-machine

Your own site · 80×15
<a href="https://agentmods.dev/skills/peteski22/agent-pragma/state-machine"><img src="https://agentmods.dev/badge/skills/peteski22/agent-pragma/state-machine.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,401 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00009 $0.01401
Opus 5.5 $0.00004 $0.00560
Sonnet 5.5 $0.00002 $0.00280
Haiku 4.5 $0.00001 $0.00140

Measured 1mo ago against content hash 86739f8378e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

state-machine 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 1mo ago.

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.

plugins/pragma/skills/state-machine/SKILL.md · 202 lines

How it starts

The opening of the file, as written. The whole thing — 202 lines — stays where its author put it; the contents beside it link to each section on GitHub.

State Machine Validator

You are a deterministic state machine validation agent.

Scope Declaration

This validator checks ONLY:

  • State machine definitions (enums, consts, status fields)
  • State transition logic and guards
  • Terminal and final state classifications
  • Cleanup and cancellation enforcement at terminal transitions
  • Model-vs-runtime consistency (does the code's model match what actually happens?)

This validator MUST NOT report on:

  • Code style or formatting (handled by language-specific validators)
  • Language idioms (handled by language-specific validators)
  • Security vulnerabilities (handled by security)
  • Performance
  • Test coverage

You do NOT rewrite code unless explicitly asked. You do NOT run linters.

Your task is to validate that state machine definitions, transitions, and terminal classifications are correct and consistent with runtime behavior.


Input

Get all changed files. Combine committed, staged, and unstaged changes to capture all recent work:

{ git diff HEAD~1 HEAD --name-only --diff-filter=ACMRT 2>/dev/null; git diff --cached --name-only --diff-filter=ACMRT 2>/dev/null; git diff --name-only --diff-filter=ACMRT 2>/dev/null; } | sort -u

Filter out generated/vendor files:

grep -v -E '(node_modules|vendor|\.min\.|\.generated\.|__pycache__|\.pyc$)'

Detection Step

Before running full analysis, check whether the diff contains state-machine-relevant changes. Grep the changed files for patterns like:

  • Enum/const definitions with status/state-related names (e.g., StatusRunning, StateFinal, TIMED_OUT)
  • Terminal/final state sets or classifications (e.g., terminalStates, isFinal, isTerminal)
  • Transition functions or status-setting logic (e.g., transition, setState, updateStatus)
  • State machine libraries or patterns (e.g., StateMachine, FSM, workflow)

If no state-machine-relevant changes are detected, output a clean pass:

{
  "validator": "state-machine",
  "applied_rules": [
    "Finite State Machine design principles"
  ],
  "files_checked": [],
  "pass": true,
  "hard_violations": [],
  "should_violations": [],
  "warnings": [],
  "summary": {
    "hard_count": 0,
    "should_count": 0,
    "warning_count": 0
  },
  "note": "No state machine changes detected"
}

Read the full file on GitHub · 202 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 202 lines · 9 tokens per session scan A 86739f8378e3

Subscribe to this mod's changes

state-machine is a skill published in the GitHub repository peteski22/agent-pragma (24 stars, last pushed yesterday), licensed Apache-2.0. It adds 9 tokens to every session and 1,401 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

explain-issue

Explain a GitHub issue: the background problem and the proposed solution.

dyoshikawa/rulesync · 18 tokens

hpc-runtime-doctor

Diagnose HPC runtime and scheduler problems for materials simulations, including MPI/OpenMP/GPU layout, modules, CUDA/Kokkos hints, scratch paths, walltime, job arrays, restart strategy, scheduler portability, and resource mismatch. Use when an ALREADY-SUBMITTED job failed, ran slowly, got killed, or behaved…

HeshamFS/materials-simulation-skills · 99 tokens

simulation-failure-triage

First-response triage for cross-code (LAMMPS/VASP/QE/MOOSE) simulation failures: classifies the failure signature (nonconvergence, NaN/Inf, exploding energy, unstable timestep, pressure blow-up, missing potentials/pseudopotentials, memory exhaustion, process crash/segfault, corrupted output, incomplete runs) and…

HeshamFS/materials-simulation-skills · 141 tokens

simplifier

Replatform mode ("lift, tinker, and shift") — simplify a 1:1-lifted legacy system in place: modernize code and remove external dependencies, one pass at a time, each bracketed by characterization-tests replays, structure preserved. Owns the stack-neutral pass discipline; the transformation catalog and dependency…

AdamBien/airails · 146 tokens

agent-config-sync

Provider-neutral planner for synchronizing MCP configuration, skills and rule files across agent providers and app classes. It discovers evidenced local options and lets the user choose truth, targets, direction and conflicts.

ellmos-ai/skills · 42 tokens

error-handling

Apply error handling and recovery patterns in JavaScript/TypeScript or Node.js. Use when implementing error handling, retry logic, or when the user mentions domain errors, error recovery, error escalation.

metarhia/metaskills · 43 tokens