Restate durable execution for fault-tolerant services and workflows. Triggers on restate, durable, ctx.run, ctx.sleep, awakeable.
Builds durable, fault-tolerant services using Restate with TypeScript. Triggers when you mention "restate", "durable", "ctx.run", "ctx.sleep", or "awakeable" to create services with automatic retries and exactly-once execution.
/plugin marketplace add settlemint/agent-marketplace/plugin install devtools@settlemintThis skill inherits all available tools. When active, it can use any tool Claude has access to.
<mcp_first> CRITICAL: Use the Restate docs MCP server if available, or OctoCode.
MCPSearch({ query: "restate" })
If Restate MCP available:
mcp__restate_docs__SearchRestate({
query: "virtual object state management"
})
Otherwise use OctoCode:
mcp__octocode__githubSearchCode({
keywordsToSearch: ["service", "handler", "ctx.run"],
owner: "restatedev",
repo: "sdk-typescript",
path: "packages/restate-sdk/src",
mainResearchGoal: "Understand Restate SDK",
researchGoal: "Find service definition patterns",
reasoning: "Need current API for Restate services"
})
</mcp_first>
<quick_start> Service definition:
import * as restate from "@restatedev/restate-sdk";
const myService = restate.service({
name: "MyService",
handlers: {
process: async (ctx: restate.Context, input: string): Promise<string> => {
// Durable step - automatically retried on failure
const result = await ctx.run("fetch-data", async () => {
const response = await fetch("https://api.example.com/data");
return response.json();
});
// Durable sleep - survives restarts
await ctx.sleep(5000);
return `Processed: ${result}`;
},
},
});
// Serve the service
restate.endpoint().bind(myService).listen(9080);
Register with Restate:
restate deployments register http://host.docker.internal:9080
</quick_start>
<context_methods>
| Method | Purpose | Example |
|---|---|---|
ctx.run(name, fn) | Durable step with retries | await ctx.run("api-call", () => fetch(...)) |
ctx.sleep(ms) | Durable delay | await ctx.sleep(60000) |
ctx.awakeable() | Wait for external signal | const { id, promise } = ctx.awakeable() |
ctx.serviceClient(svc) | Call another service | ctx.serviceClient(other).method(input) |
ctx.objectClient(obj, key) | Call Virtual Object | ctx.objectClient(counter, "user-1").increment() |
| </context_methods> |
const counter = restate.object({
name: "Counter",
handlers: {
increment: async (ctx: restate.ObjectContext): Promise<number> => {
const current = (await ctx.get<number>("count")) ?? 0;
const newCount = current + 1;
ctx.set("count", newCount);
return newCount;
},
},
});
Workflows (Long-running):
const orderWorkflow = restate.workflow({
name: "OrderWorkflow",
handlers: {
run: async (ctx: restate.WorkflowContext, order: Order): Promise<void> => {
await ctx.run("validate", () => validateOrder(order));
// Wait for human approval
const approval = ctx.awakeable<boolean>();
await notifyForApproval(approval.id);
const approved = await approval.promise;
if (approved) {
await ctx.run("fulfill", () => fulfillOrder(order));
}
},
},
});
</patterns>
<constraints>
**Banned:** Starting Restate server manually (use Docker), blocking without `ctx.run()`
Required:
ctx.run() for durabilityctx.sleep() for delays (not setTimeout)restate deployments register http://host.docker.internal:9080
restate services list
restate sql "SELECT * FROM sys_invocation LIMIT 10"
</commands>
<success_criteria>
- [ ] MCP docs fetched for current API
- [ ] External calls wrapped in `ctx.run()`
- [ ] Using `ctx.sleep()` not `setTimeout`
- [ ] Service registered with Restate
- [ ] Handlers are idempotent
</success_criteria>
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.