Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add upstash/skills --skill upstash-workflow-js -a claude-code
Open on GitHub

What 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/workflow endpoint with three steps and an external API call via context.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-code

2Manually: put the files in place

~/.claude/skills/upstash-workflow-js/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/upstash-workflow-js/

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

Similar skills

All skills for Backend and APIs →

From the same set14

upstash-redis-js Get guidance for using @upstash/redis in TypeScript and JavaScript, from caching to search. Use it when adding Redis features or moving a project from another Redis client. CX Codex +1 22,400installs upstash-ratelimit-js A skill that teaches your coding agent to add request limits with the @upstash/ratelimit SDK in API routes, Next.js middleware or edge runtimes. CX Codex +1 22,300installs upstash A skill that bundles docs for every Upstash SDK: Redis, Ratelimit, QStash, Workflow, Vector, Search, Box and Blob. Useful when your agent writes serverless or edge code. CX Codex +1 3,800installs upstash-qstash-js A skill for the @upstash/qstash SDK: publishing messages, queues, cron schedules, delayed delivery and webhook signature checks. Useful when you have no long-running worker. CX Codex +1 2,200installs upstash-cli Use this skill to run Upstash CLI commands from a shell, script, or CI job. It fits tasks that need JSON output or must run without Upstash MCP tools in the session. CX Codex +1 1,500installs upstash-vector-js A skill that teaches your agent the @upstash/vector TypeScript SDK: upserting embeddings, similarity search, RAG and semantic caching. CX Codex +1 1,300installs upstash-redis-start This skill spins up a temporary Upstash Redis database from a single POST. No account, no API key, no SDK wiring — the response carries the endpoint and token. CX Codex +1 1,300installs upstash-box-js A skill that teaches your agent the @upstash/box SDK: cloud sandbox containers with agents, shell, git and cron. CX Codex +1 1,200installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor