add-a-lifecycle-machine

Installation
SKILL.md

Add a lifecycle machine

A lifecycle machine defines named states and the events that permit movement between them. Effect describes work with typed failures and required dependencies. A service is a named interface for one job. Schema defines accepted values and their runtime checks.

Copy packages/core/src/inspect-machine.ts when the work has states that matter. Keep a direct Effect when it does not.

A machine that calls a provider also follows durability: one timeout, bounded retries with the same key, and nothing held across the call.

Before changing Effect or XState code, read node_modules/effect/AGENTS.md. Then read the pinned XState and @xstate/effect source listed in AGENTS.md.

1. Write the states first

List the states and final results before writing the machine.

For file inspection, the states are reading, inspected, and unreadable. The final result is either Inspected with file stats or Unreadable with a FileStatsError.

Use an explicit result union when a known error should move the machine into a final state.

2. Put side effects in actors

Installs
45
GitHub Stars
214
First Seen
Sep 22, 2026