/restate:restatefrom restate
Builds resilient distributed systems with Restate's durable execution framework. Covers services, virtual objects, workflows, automatic retries, state management, and fault tolerance.
Ships in restate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Restate is a durable execution framework that makes applications resilient to failures. Use this skill when building:
Use Restate when:
Restate supports three service types:
Services - Stateless handlers with durable execution
Virtual Objects - Stateful handlers with K/V state isolated per key
Workflows - Special Virtual Objects where run handler executes exactly once
See Services Concepts for detailed comparison.
Restate provides these building blocks through the SDK context:
ctx.run()) - Persist results of side effectsctx.get/set/clear) - K/V state for Virtual Objectsctx.sleep()) - Durable sleep that survives restartsctx.serviceClient()) - RPC with automatic retriesnpm install @restatedev/restate-sdk
import * as restate from "@restatedev/restate-sdk";
const myService = restate.service({
name: "MyService",
handlers: {
greet: async (ctx: restate.Context, name: string) => {
return "Hello, " + name + "!";
},
},
});
restate.endpoint().bind(myService).listen(9080);
const counter = restate.object({
name: "Counter",
handlers: {
add: async (ctx: restate.ObjectContext, value: number) => {
const current = (await ctx.get<number>("count")) ?? 0;
ctx.set("count", current + value);
return current + value;
},
get: restate.handlers.object.shared(
async (ctx: restate.ObjectSharedContext) => {
return (await ctx.get<number>("count")) ?? 0;
}
),
},
});
const paymentWorkflow = restate.workflow({
name: "PaymentWorkflow",
handlers: {
run: async (ctx: restate.WorkflowContext, payment: Payment) => {
// Step 1: Reserve funds
const reservation = await ctx.run("reserve", () =>
reserveFunds(payment)
);
// Step 2: Wait for approval (awakeable)
const approved = await ctx.promise<boolean>("approval");
if (!approved) {
await ctx.run("cancel", () => cancelReservation(reservation));
return { status: "cancelled" };
}
// Step 3: Complete payment
await ctx.run("complete", () => completePayment(reservation));
return { status: "completed" };
},
approve: async (ctx: restate.WorkflowSharedContext) => {
ctx.promise<boolean>("approval").resolve(true);
},
reject: async (ctx: restate.WorkflowSharedContext) => {
ctx.promise<boolean>("approval").resolve(false);
},
},
});
// Journaled action - result persisted, replayed on retry
const result = await ctx.run("action-name", async () => {
return await callExternalApi();
});
// Durable timer - survives restarts
await ctx.sleep(60_000); // 60 seconds
// Call another service
const client = ctx.serviceClient(OtherService);
const response = await client.handler(input);
// Async call (fire and forget)
ctx.serviceSendClient(OtherService).handler(input);
// Delayed call
ctx.serviceSendClient(OtherService, { delay: 60_000 }).handler(input);
// Awakeable - wait for external signal
const { id, promise } = ctx.awakeable<string>();
// Give `id` to external system, then:
const result = await promise;
// Random (deterministic)
const value = ctx.rand.random();
const uuid = ctx.rand.uuidv4();
npx @restatedev/restate-server
npx ts-node src/app.ts
npx @restatedev/restate deployments register http://localhost:9080
# Service handler
curl localhost:8080/MyService/greet -H 'content-type: application/json' -d '"World"'
# Virtual Object handler (with key)
curl localhost:8080/Counter/user123/add -H 'content-type: application/json' -d '5'
# Start workflow
curl localhost:8080/PaymentWorkflow/order-456/run -H 'content-type: application/json' -d '{"amount": 100}'
ctx.run()Side effects must be wrapped in ctx.run() - External calls, random values, timestamps must go through the context to be journaled and replayed correctly.
State access only in Virtual Objects/Workflows - Plain Services don't have state access.
Handlers must be deterministic - Same inputs should produce same outputs. Use ctx.rand for randomness.
One handler per Virtual Object key at a time - Restate ensures consistency by queuing concurrent requests to the same key.
Workflows run handler executes exactly once - Use other handlers to query/signal the workflow.
Register services after code changes - Run restate deployments register to update handler definitions.
Generated from Restate documentation. Run scripts/sync-docs.sh to update.
The content in the references/ directory is derived from the Restate documentation and TypeScript SDK.
SKILL.template.md (opens in a new tab)references/architecture.md (opens in a new tab)references/concepts-durable-building-blocks.md (opens in a new tab)references/concepts-durable-execution.md (opens in a new tab)references/concepts-invocations.md (opens in a new tab)references/concepts-services.md (opens in a new tab)references/guide-cron.md (opens in a new tab)references/guide-databases.md (opens in a new tab)references/guide-durable-webhooks.md (opens in a new tab)references/guide-error-handling.md (opens in a new tab)references/guide-lambda-ts.md (opens in a new tab)references/guide-parallelizing-work.md (opens in a new tab)references/guide-sagas.md (opens in a new tab)references/invoke-clients.md (opens in a new tab)references/invoke-http.md (opens in a new tab)references/invoke-kafka.md (opens in a new tab)references/local-dev.md (opens in a new tab)references/operate-introspection.md (opens in a new tab)references/operate-invocation.md (opens in a new tab)references/operate-overview.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub schpet/toolbox --plugin restateOther plugins' skills for the same job