upstash-workflow-js — Claude Code skill: durable workflows
Teaches your agent to write long-running @upstash/workflow code that survives timeouts, retries and restarts in serverless functions.
npx skills add upstash/skills --skill upstash-workflow-js -a claude-codeWhat upstash-workflow-js does
This skill hands the agent the docs for the TypeScript/JavaScript @upstash/workflow SDK, which runs on QStash. It covers serve() for the workflow endpoint, context.run for steps, context.call for external APIs, waiting on events or webhooks, and invoking other workflows. Separate files walk through retries, failure callbacks and a DLQ, plus rate, concurrency and parallelism limits and the Client for triggering, cancelling and inspecting runs.
There are also sections on local development with the QStash dev server (turned on with QSTASH_DEV=true), realtime updates, human-in-the-loop approvals, middleware and safe migrations. Low-level REST endpoints and a troubleshooting file round it out. Think of it as a reference the agent pulls in when you ask for durable execution, a saga pattern or background jobs with checkpoints on Vercel, Next.js or Cloudflare Workers.
The package itself installs with npm install @upstash/workflow, and running a workflow needs a QSTASH_TOKEN environment variable. The client will not work without that token, so check it before asking the agent to generate trigger code.
What it helps with
- define a workflow endpoint with
serve() - split a long process into steps with
context.run - sleep for minutes or days without holding a function open
- set up retries, failure callbacks and a DLQ
- cap concurrency and request rate
Example prompts for the agent
- Write a
@upstash/workflowendpoint with three steps and an external API call viacontext.call. - Add retries and a failure callback to a workflow that hits a payment service.
- How do I start the local QStash dev server to debug a workflow?
How to install upstash-workflow-js
1Skills CLI (Vercel)
npx skills add upstash/skills --skill upstash-workflow-js -a claude-code2Manually: put the files in place
~/.claude/skills/upstash-workflow-js/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/upstash-workflow-js/
1Skills CLI (Vercel)
npx skills add upstash/skills --skill upstash-workflow-js -a codex2Manually: put the files in place
.agents/skills/upstash-workflow-js/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add upstash/skills --skill upstash-workflow-js -a cursor2Manually: put the files in place
.cursor/skills/upstash-workflow-js/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install upstash/skills upstash-workflow-js2Manually: put the files in place
.github/skills/upstash-workflow-js/SKILL.md1Skills CLI (Vercel)
npx skills add upstash/skills --skill upstash-workflow-js -a gemini-cli2Platform CLI
gemini skills install https://github.com/upstash/skills --path skills/upstash-workflow-jsManually: put the files in place
.devin/skills/upstash-workflow-js/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add upstash/skills --skill upstash-workflow-js -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about upstash-workflow-js
How do I install upstash-workflow-js in Claude?
Run npx skills add upstash/skills --skill upstash-workflow-js -a claude-code. The skill file lands at ~/.claude/skills/upstash-workflow-js/SKILL.md.
What does upstash-workflow-js do?
It gives the agent full documentation for the @upstash/workflow SDK: endpoints, steps, waits, webhooks, retries, flow control and the client for managing runs.
What do I need for a workflow to run?
The @upstash/workflow package and a QSTASH_TOKEN environment variable. For local work you can enable the QStash dev server with QSTASH_DEV=true.
Source text
SKILL.md · MIT
---
name: upstash-workflow-js
description: Work with the @upstash/workflow TypeScript/JavaScript SDK for durable, long-running workflows in serverless functions, multi-step processes that survive timeouts, retries, and restarts (built on QStash). Use when defining a workflow endpoint with serve(), running steps with context.run, sleeping for minutes to days without holding a function open, calling external APIs with context.call, waiting for an external event or webhook, invoking other workflows, configuring retries, failure callbacks, and a DLQ, controlling concurrency, rate, and parallelism, triggering, cancelling, or inspecting runs with the Workflow client, building AI agents and orchestrators, human-in-the-loop approvals, realtime updates, local development with the QStash dev server, adding middleware, or migrating workflows safely. Also use when the user asks for durable execution, step functions, saga or orchestration patterns, background jobs with checkpoints, or long-running tasks on Vercel, Next.js, Cloudflare Workers, or other serverless platforms.
license: MIT
metadata:
author: Upstash
homepage: https://upstash.com
---
# Upstash Workflow SDK
## Quick Start
The Upstash Workflow SDK lets you expose serverless workflow endpoints and run them reliably using QStash under the hood.
Install:
```bash
npm install @upstash/workflow
```
Define a simple workflow endpoint:
```ts
import { serve } from "@upstash/workflow";
export const { POST } = serve(async (context) => {
await context.run("step-1", () => console.log("step 1"));
await context.run("step-2", () => console.log("step 2"));
});
```
Trigger it from your backend:
```ts
import { Client } from "@upstash/workflow";
const client = new Client({ token: process.env.QSTASH_TOKEN! });
await client.trigger({ url: "https://your-app.com/api/workflow" });
```
## Other Skill Files
These files contain the full documentation. Use them for details, patterns, and advanced behavior.
- basics:
- **basics/serve** – How to expose workflow endpoints.
- **basics/context** – Full API for workflow `context` (steps, waits, webhooks, events, invoke, etc.).
- **basics/client** – Using the Workflow client to trigger, cancel, inspect, and notify runs.
- features:
- **features/invoke** – Cross‑workflow invocation.
- **features/reliability** – Retries, failure callbacks, and DLQ.
- **features/flow-control** – Rate limits, concurrency, and parallelism.
- **features/wait-for-event** – Notify and wait-for-event patterns.
- **features/webhooks** – Webhook creation and consumption.
- how to:
- **how-to/local-dev** – Local QStash dev server (auto via `QSTASH_DEV=true`) and tunneling.
- **how-to/realtime** – Realtime and human‑in‑the‑loop workflows.
- **how-to/migrations** – Migrating workflows safely.
- **how-to/middleware** – Adding middleware to workflows.
- other files:
- **rest-api** – Low-level REST endpoints for interacting with QStash/Workflow.
- **troubleshooting** – Common debugging and environment issues.
- **agents** – Using Workflow with agents, orchestrators, and automation patterns.
© Upstash · MIT · upstash/skills