xstate

xstate is a skill for Claude Code, Codex from mintuz/skills. It costs 118 tokens per session (1,443 once invoked), scanned A, original, MIT.

A set of instructions for using XState 5 to model application state, such as loading, errors, retries, cancellation, polling, and drag interactions. A state machine describes which states an application can be in and how it moves between them.

In plain words
What is it for?
It guides building, reviewing, testing, and visualising state machines in React applications. It applies when state changes depend on asynchronous answers or interruptible user actions.
Why use it?
It helps prevent conflicting flags, stale asynchronous results, forgotten timers, and event listeners that remain active after an interaction ends.

Skill for Claude CodeCodex

Part of the web plugin — 11 skills, 4 agents shipped together

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.

agentmods
npx agentmods add skills/mintuz/skills/xstate
Any agent
npx skills add mintuz/skills --skill xstate
Clone the repo
git clone --depth 1 https://github.com/mintuz/skills

Made for: Claude Code, Codex.

Or install web, the plugin that ships this one along with the rest of its 11 skills, 4 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 xstate

README.md
[![agentmods](https://agentmods.dev/badge/skills/mintuz/skills/xstate.svg)](https://agentmods.dev/skills/mintuz/skills/xstate)
Your own site
<a href="https://agentmods.dev/skills/mintuz/skills/xstate"><img src="https://agentmods.dev/badge/skills/mintuz/skills/xstate.svg" alt="Measured on agentmods" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,443 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00118 $0.01443
Opus 5 $0.00059 $0.00722
Sonnet 5 $0.00024 $0.00289
Haiku 4.5 $0.00012 $0.00144

Measured today against content hash d736796308d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

xstate 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 today.

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.

src/web/skills/xstate/SKILL.md · 79 lines

How it starts

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

XState

Treat a statechart as an executable ownership model for time, concurrency, and resource lifetimes.

Recognise a hand-rolled statechart

Each of the following is a lifecycle already being modelled by hand:

  • a useState flag for work in flight: isSubmitting, isLoading, pending;
  • a .then, .catch, or await block that sets two or more pieces of state in sequence;
  • a re-entry guard such as if (submitting) return;
  • a line that clears an error or a stale result before a retry;
  • a useEffect that starts asynchronous work and needs an ignore flag in its cleanup;
  • two booleans that must never both be true, such as isLoading with error;
  • a setTimeout or setInterval for retry, debounce, or polling that something must clear;
  • a pointerdown, dragstart, or gesture handler that binds listeners to the document and must unbind them;
  • handling for a response that arrives after cancel, replacement, or unmount.

Any one of them is the entry point to step 1, however small the request, and whether or not the file imports xstate. When the code already exists, name each defect it has today and the wrong behaviour a user would see, before you propose the machine that removes it.

For a visualisation-only request, inspect the current machine source and go to step 6 instead.

1. Establish the temporal boundary

Inventory the mounted journey, external authority, live resources, concurrent concerns, retry and cancellation policy, and every source of stale or duplicate work. Inspect existing actors and runtime integrations, and confirm the installed XState major version; the XState 4 and 5 APIs differ.

Use XState only where ordering, concurrency, retries, cancellation, stale results, or resource lifetimes make the behaviour temporal. Two tests find that lifetime; classify by what they show, not by what the state renders.

First, an external answer — a network response, a timer, another actor, the platform — makes state temporal whatever it looks like on screen. A disabled button or a spinner is the presentation of temporal state, not presentation state.

Read the full file on GitHub · 79 lines

Files

What ships with it

6 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. today Changed d736796308d0
  2. 4d ago First seen · 79 lines · 118 tokens per session scan A 3c485a2ceb3e

Subscribe to this mod's changes

xstate is a skill published in the GitHub repository mintuz/skills (29 stars, last pushed yesterday), licensed MIT. It adds 118 tokens to every session and 1,443 once invoked, about $0.0006 per session on Opus 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

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

HKUDS/DeepCode · 61 tokens

agentsop-conventions-pinning

SOP for writing, loading, and evolving a project-level convention file (CONVENTIONS.md / CLAUDE.md / .cursor/rules / .clinerules / AGENTS.md) so that a coder-agent reliably respects your codebase's style choices every session. Tool-agnostic; covers the four load mechanics (read-only attachment, ancestor-walk…

agentsope/SkillAlchemy · 104 tokens

agentsop-llm-artifact-versioning

Enhancement overlay — version the WHOLE deployable LLM-app artifact as one bundle: prompts + compiled programs + model snapshot pins + retrieval config + eval-set version, versioned together so a deploy is reproducible and rollback is atomic. Activate when preparing to deploy an LLM app, when asking "what exactly is…

agentsope/SkillAlchemy · 223 tokens

agentsop-output-format-by-model

Pick an LM output format per (task x consumer x model) rather than by reflex: different formats carry different cognitive load (e.g. code-in-JSON makes the same model write worse code than plain-text+diff, while asking for prose when you need a typed object fails the other way). Use when designing or debugging an LM's…

agentsope/SkillAlchemy · 111 tokens

agentsop-code-execution-decision

Decision rubric for when an LM agent should write-and-run code (Program-of-Thought / code interpreter) versus reason in natural language: classify each step as deterministic- computable (emit + execute code, feed the result back) vs judgment (stay in prose). Use when designing or debugging an agent step that does…

agentsope/SkillAlchemy · 141 tokens

agentsop-dify

SOP for building LLM applications on Dify — visual workflow + chatflow + agent + RAG knowledge base + plugin marketplace + observability, self-hostable. Use when shipping LLM apps fast with a "no-code to pro-code" gradient, especially when non-engineers need to co-author the flow.

agentsope/SkillAlchemy · 69 tokens