Token导航 LogoToken导航

Agent Skill · 开发

xstate-v5(状态 v5)

xstate-v5 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

xstate-v5 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 11,750。

总安装 1,599周安装 68GitHub Stars 37下载 560核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:xstate-v5(状态 v5)
来源仓库:https://github.com/statelyai/skills
仓库路径:skills/xstate-v5
安装命令:
npx skills add https://github.com/statelyai/skills --skill xstate-v5
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/statelyai/skills --skill xstate-v5

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合整理协作事项。可围绕仓库状态和代码变更进行信息组织与归类。通过 npx skills add 命令从指定 GitHub 仓库安装使用。建议确认权限范围和维护状态,避免触发联网或文件读写操作。

xstate-v5 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/xstate-v5

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/statelyai/skills --skill xstate-v5;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

xstate-v5 怎么安装?

在终端执行 npx skills add https://github.com/statelyai/skills --skill xstate-v5。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

xstate-v5 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

xstate-v5 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

xstate-v5 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

xstate-v5 用的人多吗?

公开数据是累计安装 1,599 次,近一周安装 68 次,下载 560 次,GitHub 37 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

xstate-v5 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
xstate-v5

状态 v5 · 本页

1,59937操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

XState v5

Use this skill for state machine and statechart engineering first and API correctness second.

This skill is v5-only. When examples, blog posts, answers, or local code smell v4-ish, translate them rather than mixing versions. Prefer local repo code and official v5 docs over generic memory.

Your job:

  • choose between xstate and @xstate/store
  • design a sound machine or actor system from messy requirements
  • write modern XState v5 TypeScript code in a consistent style
  • review, repair, or improve existing XState code
  • migrate legacy v4-ish patterns when they appear
  • choose the right actor kind and action shape when the problem is not just assign(...) plus fromPromise(...)
  • connect machines and actors to @xstate/react, @xstate/vue, @xstate/svelte, or @xstate/solid when needed

First pass

In an existing codebase:

  1. Inspect local package.json files and imports.
  2. Read nearby machines, stores, actors, and adapter usage.
  3. Distinguish between new code, local edits, and migration work before choosing how opinionated to be.
  4. Preserve surrounding style by default.

Task mode

Choose a mode before writing code:

  • New code: prefer the modern v5 patterns in this skill.
  • Local edit: preserve local structure and naming unless the current code is mixed, broken, or cleanup was requested.
  • Migration: prefer the smallest safe translation to v5. Preserve structure and semantics unless broader normalization was requested.

For migration and local edits, do not introduce setup(...), named implementations, object-form guards/actions, tags, or actor decomposition unless they are required for correctness, significantly reduce local complexity, or were explicitly requested.

Choose the tool

Prefer @xstate/store when the domain is simple event-based state management:

  • no meaningful finite modes that need coordination, orchestration, or explicit lifecycle modeling
  • no invoked async processes
  • no actor communication
  • no need for state machine or statechart concepts such as guarded transitions, delayed transitions, parallel states, or history

Simple fetching or mutation logic can still fit @xstate/store if it does not need machine-level orchestration.

Prefer XState when the domain has one or more of these:

  • finite modes that matter to behavior or UI
  • async workflows, retries, cancellation, or background processes
  • multiple interacting processes or child actors
  • explicit guards, delays, tags, or transition rules
  • a need to model business process flow, not just update state

If the problem is too simple for a machine, say so plainly and recommend @xstate/store.

Workflow

When requirements are fuzzy:

  1. Sketch the machine shape first.
  2. Name the important states, events, context, actors, and tags.
  3. Call out uncertainty or tradeoffs briefly.
  4. Then write the code.

When requirements are already clear, keep the sketch short or implicit and move to code.

Do not over-refactor existing code for conceptual purity. Improve the model where it matters, but preserve working structure when a larger rewrite is not justified.

Modeling questions

Use these questions before writing or revising code:

  • What are the finite states? Put modes in states, not in context.
  • What belongs in context? Keep only durable data, not derivable booleans or duplicated mode.
  • What are the domain events? Prefer meaningful names, often dot-separated, such as form.submitted or order.confirmed.
  • What should be a guard versus a separate branch state?
  • What side effects should be invoked actors versus transition actions?
  • Can an event carry the needed data instead of stashing temporary relay data in context for a later state?
  • Is fromPromise(...) actually the right actor, or is this a callback/subscription protocol that should send events back over time?
  • Should the machine emit events to the surrounding system instead of forcing consumers to infer everything from context?
  • Should a child concern be a spawned/invoked actor instead of more parent complexity?
  • Does the parent really need these extra intermediate states, or should a child actor own that internal detail?
  • Which states need tags for UI semantics such as 'loading', 'error', or 'dirty'?
  • Can the UI use snapshot.matches(...), tags, or snapshot.can(...) instead of extra booleans?

Preferred v5 patterns

For new code, prefer these patterns unless the local codebase has a strong reason not to:

  • TypeScript only.
  • Prefer setup({...}).createMachine({...}).
  • Define named actions, guards, actors, and delays in setup(...).
  • Prefer transition objects like {target: 'next'} over shorthand when it improves consistency.
  • Prefer arrays for actions, even for a single action, when that keeps the shape consistent.
  • Prefer action and guard objects such as {type: 'track'} or {type: 'isValid', params:...} when the intent is reusable or named.
  • Prefer tags: [] for UI semantics and cross-cutting state meaning.
  • Prefer domain-oriented event names; preserve local naming conventions if they are already established.
  • In parallel states, keep transitions local to the region or substate whose lifecycle should change. Avoid region-root transitions that target sibling regions or use reenter: true unless resetting that whole source region is intentional.
  • Prefer plain functions for derived values instead of storing derivable data in context.
  • Prefer event payloads over temporary context relay when one state only needs to pass data to the next step.
  • Prefer passing data into named actions and guards via params instead of reaching into event directly.
  • Do not treat assign(...) as the only action pattern. For typed reusable logic beyond simple context updates, consider setup-scoped helpers from a const machineSetup = setup(...) object, such as machineSetup.createAction(...), machineSetup.enqueueActions(...), and machineSetup.emit(...), or named action objects when they fit the behavior better.
  • When a named assign(...) action updates multiple context properties, every property updater shares the same params type. Use one coherent params object for all updated fields, or split the work into separate named actions. Do not mix incompatible params shapes inside one assigner.
  • When an implementation must inspect event and the type is not obvious, prefer assertEvent(...) for narrowing.
  • Avoid as any and other loose casts in examples and final code unless there is no cleaner local option.
  • Choose actor logic intentionally: prefer fromPromise(...) for one request/one result, and prefer fromCallback(...) for subscriptions, timers, external callbacks, and multi-event protocols that send events back over time.
  • Consider emit(...) when the machine should notify the surrounding system directly.
  • Keep parent states coarse when possible. If extra intermediate states mainly model an implementation detail, prefer letting a child actor own that internal behavior.
  • If you show multiple files, wire them completely. Include real imports/exports for referenced modules and components, or keep the example smaller.

Keep event naming consistent. The . in event names is useful and meaningful, including for partial event descriptors and clearer domain grouping. See the official docs on events and transitions and TypeScript narrowing with assertEvent(...).

See references/examples.md for canonical code shapes, references/advanced-patterns.md when the task involves typed actions beyond assign(...), callback actors, emitted events, or persistence/hydration, and references/observables-and-inspection.md for fromObservable(...), inspection, and browser inspector patterns.

UI integration

Prefer letting the machine drive UI behavior:

  • use snapshot.matches(...) for finite mode checks
  • use tags for semantic checks such as loading, saving, or dirty
  • use snapshot.can(...) to drive whether an event is currently valid
  • avoid parallel piles of manual booleans that restate machine truth

If a component owns a small local actor, useMachine(...) is often enough.

If an actor is shared, long-lived, or performance-sensitive:

  • create or obtain an actor ref once
  • read slices with useSelector(...)
  • use actor context/provider helpers when the actor is shared across a subtree

See references/adapters.md for concise adapter guidance.

Review and repair guidance

When reviewing or fixing XState code, look for:

  • finite mode stored in context instead of states
  • giant machines that should be split into child actors
  • side effects hidden in random callbacks or mixed into assigners
  • v4 and v5 concepts mixed together in the same machine
  • state names and event names that describe UI mechanics instead of domain meaning
  • extra booleans that should be replaced by matches(...), tags, or selectors
  • missed opportunities to use @xstate/store when the problem is simple
  • named assign(...) actions whose property updaters implicitly expect different params shapes
  • parallel-region root transitions that target sibling regions or use reenter: true; in v5 these can re-enter the source region, reset it to its initial substate, and cancel in-flight invokes

Avoid pushing decomposition too far. Actor boundaries are useful when they improve clarity, ownership, or concurrency. Do not split for its own sake.

Migration

When legacy code is present, translate toward v5 gradually and locally unless the user asked for a broader migration.

Common migration targets include:

  • cond -> guard
  • schema -> types
  • services -> actors
  • interpret(...) -> createActor(...)
  • old function signatures -> destructured v5 arguments such as ({context, event})

For migration tasks:

  • preserve local structure first
  • change only what is needed for correctness, compatibility, or clarity
  • do not normalize into the full preferred house style unless the user asked for that
  • explain any non-local refactor you choose to make
  • do not preserve dead or invalid hook option patterns just because they existed nearby
  • when migrating React usage, prefer valid current hook surfaces over trying to smuggle old interpret-style implementation overrides into useMachine(...)
  • inspect type: 'parallel' region-root transitions before copying v4 shapes into v5; move handlers down to the owning substate/region, or coordinate from a parent only when broader re-entry is intentional

Use references/v4-to-v5-quick-ref.md for quick translation patterns.

Persistence

When persistence or hydration matters:

  • persist snapshots, not just context, unless context-only restore is truly sufficient
  • prefer actor.getPersistedSnapshot() for saving machine state
  • prefer hydrating with createActor(machine, {snapshot}) or adapter/provider snapshot options where available
  • do not hand-roll restoration by guessing the state value plus a partial context blob

See references/advanced-patterns.md for concrete persistence and hydration patterns.

Testing

Do not introduce testing guidance unless the user asks about testing or requests tests.

If they do ask, keep it brief:

  • test key transitions and guards
  • test happy path and failure path actor behavior
  • test the UI against machine state rather than duplicating stateful logic
  • mention model-based testing utilities when useful

If a link would help, point them to the XState testing and graph/path generation docs.

Optional tools

Stately Studio and inspection tools can help with design, debugging, and communication, but they are optional. Mention them when the user is designing a machine, wants visualization, or needs better debugging visibility.

Output format

Prefer this output shape:

  1. Short machine sketch if requirements are fuzzy.
  2. Code.
  3. Brief rationale explaining states, events, context, actors, and tags.
  4. Migration notes only if relevant.

Prefer fewer complete files over a larger but partially wired example. Do not sketch extra shell files unless they are fully wired.

See references/examples.md for more canonical examples that can grow over time.

Final self-check

Before you answer, do a quick compile-minded pass:

  • every JSX component from another file has a real import
  • every imported symbol is actually exported by the shown file
  • every send(...) and snapshot.can(...) call uses real event objects
  • async work uses actors/fromPromise and invoke.input, not legacy shapes
  • if you reference an external helper from the prompt or surrounding system, declare its signature or show enough typed shape for the example to stand on its own
  • migration examples do not pass invalid implementation override objects into hooks just to preserve dead local code
  • no placeholder shell files, omitted imports, ..., or pseudocode in code fences that are meant to be runnable

If a complete multi-file answer is getting bulky, remove the shell file and keep the smaller set of files that still demonstrates the pattern correctly.

平台分布

Codex

35.16%
按下载量换算197

Claude

28.83%
按下载量换算161

Cursor

19.21%
按下载量换算108

Gemini CLI

8.98%
按下载量换算50

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills