generate-machine
БесплатноБез исполняемых скриптовНе проверенAuthor a @statelyai/agent workflow as JSON and check it before it runs. Use when asked to generate or author an agent machine, create a workflow config, write…
от statelyai★ 86 звёзд на GitHubОб этом скилле
Generate an agent machine
Targets
@statelyai/agent2.0 alpha, as on thenextbranch. APIs change between alphas: when a call here does not match the installed package, checknode_modules/@statelyai/agent/CHANGELOG.md.
An agent machine is data. You author a JSON AgentWorkflowConfig, then run it through verifyAgentConfig, whose gates all work with no API key: validate → vocabulary → lower → lint → explore. Do not hand back a config that has not passed every gate.
split environment/policy → author (description = goal) → verifyAgentConfig → repair (≤ 3) → persist traces → hand back
To improve an existing policy from its traces, use the improve-machine skill instead.
0. Split environment and policy
Decide what is fixed before you write any JSON.
- Environment (TypeScript, fixed): the rules of the world and the business invariants, as states and guards. People author it and verify it with
canReach/explorePathsfrom@statelyai/agent/testing. You never generate it, and no generated config may change it. - Policy (JSON, generated): how the agent works toward the goal: which step next, which tool, when to ask a person, cheap judgment vs model call. This is the
AgentWorkflowConfigyou author. - The policy plugs into the environment at its decision points and outputs one event; the environment's guards decide whether to accept it.
- No split needed for a single judgment inside a fixed workflow, or for a workflow where every step is dictated by rules. Author one machine.
If the request asks you to generate a business rule (an approval threshold, a payout limit), stop: that belongs in the environment, in TypeScript, reviewed by a person. Say so.
Before editing an existing machine, read it as text:
import { describeMachine } from "@statelyai/agent";
const text = describeMachine(machine); // "Machine <id>", then "Goal: …", states, transitions, events
Pass { snapshot } to mark the active states with *. Concept page: Environment and policy.
1. Read the schema
The config shape is fixed by a shipped JSON Schema. Read it first; it is the contract.
- Consuming the package:
node_modules/@statelyai/agent/schemas/agent-workflow.json(importable as@statelyai/agent/agent-workflow.json) - In the
statelyai/agentrepo:schemas/agent-workflow.json
2. Author the config
Start with the root description: it is the machine's goal, the overall objective plus measurable success criteria. describeMachine renders it first as Goal: …, and an improver later climbs toward it. Write criteria a scorer can compute from outcomes (terminal states, effects in the world, cost), not "be helpful":
"description": "Resolve each support ticket in one session. Success: escalations only for tickets that need a human; every reply approved before sending; at most 2 model calls per ticket."
Rules the runtime enforces. Each one maps to a build error or a lint diagnostic:
- Every value is a JSON literal or a whole-string
"{{ }}"expression reading a dot path oninput,context, orevent. No JavaScript. - Guard expressions are truthy-only: no comparisons, operators, or negation.
- A model call is either a named
requestsentry invoked withsrc: "<requestName>", or an inline invoke withsrc: "agent.decide"plus anallowedEventslist. Arequestsentry's templates read only its owninput("{{ input.ticket }}"); the invoke'sinputmaps context into it. - A state invoking
agent.decideMUST handle every allowed event in itson. - An
agent.decideinvoke has noonDone(a decision produces no output). UseonErrorfor the retries-exhausted path. - A request invoke resolves with
{ result, messages }, soonDone.assignreads its result from"{{ event.output.result.<field> }}"("{{ event.output.result }}"for a plain-text request). A non-requestactorsinvoke reads"{{ event.output.<field> }}"directly. - Every path must reach a
"type": "final"state, and each final state needs anoutputwhenschemas.outputis declared. - Do not invent guard or action names. Only
"{{ }}"guards,assign, andemitexist unless the host tells you which named guards/actions it implements. - Model refs are strings (
"openai/gpt-6-luna"); the host resolves them. - To make a decision a closed choice, add
payloadsto theagent.decideinput: one payload list per event type, withouttype("payloads": { "REFUND": [{ "amount": 20 }, { "amount": 50 }], "ESCALATE": [] }). The model then picks one listed event instead of writing a payload. A type with no key is offered as{ type };[]withholds it. - An idle human step can carry
meta.interactionfor the host to render withgetInteraction: alabel,events(one button per event type),choices(one button per full event, `{ "label": "Refund $20", "even
Установить generate-machine в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл generate-machine?
Author a @statelyai/agent workflow as JSON and check it before it runs. Use when asked to generate or author an agent machine, create a workflow config, write an AgentWorkflowConfig, or produce an LLM-authored state machine for an agent — and when a generated config fails verifyAgentConfig, Ajv validation, or agent lint and needs repair.
Как установить скилл generate-machine?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл generate-machine запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic