# migrating-workflow-v4-to-v5

Walks an app from Workflow SDK 4.x to 5.0: which dependencies to bump and which calls to rewrite.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 310 installs · ★ 2474
- Author: Vercel Inc.
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/vercel/workflow/tree/HEAD/skills/migrating-workflow-v4-to-v5/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/migrating-workflow-v4-to-v5

## What it does

The skill runs the migration as a checklist. First it has the agent read `package.json` for every `workflow` and `@workflow/*` package, then grep the codebase for the markers that matter: `getWorld`, `createWorld`, `writeToStream`, `runStep`, `stepEntrypoint`, `internal/private`, `core/private`, `getConflict`, `experimental_setAttributes` and more. Anything the app does not use should be reported as not applicable instead of quietly skipped.

Then come the mechanical rewrites. Every dependency moves to `^5.0.0` — the packages ship together, and a 4.x `@workflow/next` next to a 5.x `workflow` fails at build time. `getWorld()` and `getWorldHandlers()` become async, `createLocalWorld` and `createVercelWorld` collapse into a single `createWorld()`, and `runStep` from `workflow/api` goes away because steps are called directly. Stream methods move to `world.streams.*` with `runId` first. Renaming alone is a trap here: the stream name lands where a run ID is expected.

Workflow and step bodies stay untouched. `"use workflow"`, `"use step"`, `start()`, hooks, webhooks, `sleep()` and retries behave as before. Node requirements are unchanged: `^18 || ^20 || ^22 || ^24`. The skill says it plainly — if you start restructuring business logic, you have left the migration behind.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel/workflow --skill migrating-workflow-v4-to-v5 -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/migrating-workflow-v4-to-v5/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/migrating-workflow-v4-to-v5/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel/workflow --skill migrating-workflow-v4-to-v5 -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/migrating-workflow-v4-to-v5/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel/workflow --skill migrating-workflow-v4-to-v5 -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/migrating-workflow-v4-to-v5/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install vercel/workflow migrating-workflow-v4-to-v5
```

2. **Manually: put the files in place**
- File: `.github/skills/migrating-workflow-v4-to-v5/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add vercel/workflow --skill migrating-workflow-v4-to-v5 -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/vercel/workflow --path skills/migrating-workflow-v4-to-v5
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/migrating-workflow-v4-to-v5/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add vercel/workflow --skill migrating-workflow-v4-to-v5 -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/vercel/workflow/tree/HEAD/skills/migrating-workflow-v4-to-v5/SKILL.md

## When to use it
- bump `workflow` and `@workflow/*` to 5.0 without mixing majors
- rewrite `world.writeToStream` and `readFromStream` calls as `world.streams.*` with the new argument order
- thread a `runId` into `world.steps.get()` and `events.listByCorrelationId()`
- drop imports from `workflow/internal/private` and `@workflow/core/private`
- replace `createLocalWorld` and `createVercelWorld` with `createWorld()`

## Example prompts
- run the Workflow SDK 4.x to 5.0 migration on this project
- find the removed v4 APIs in this codebase and rewrite them for v5
- check whether any `runStep` or `stepEntrypoint` calls are left

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 20056190aa222dca.

BEGIN THIRD-PARTY FILE 20056190aa222dca
```text
---
name: migrating-workflow-v4-to-v5
description: >-
  Upgrades an app from Workflow SDK 4.x to 5.0. Use when bumping the `workflow` / `@workflow/*` dependencies to v5, or when hitting removed v4 APIs — `runStep`, `stepEntrypoint`, `workflow/internal/private`, `@workflow/core/private`, `writeToStream` / `closeStream` / `readFromStream` on a World, `world.steps.get` without a runId, `hook.getConflict()` returning `{ runId }`, `hook.metadata` read synchronously off a `getHookByToken()` result, `experimental_setAttributes`, `createLocalWorld` / `createVercelWorld`, `NestLocalBuilder` imported from `@workflow/nest`, or an SWC transform invoked with `mode: 'client'`.
metadata:
  author: Vercel Inc.
  version: '0.2.11'
---

# Migrating Workflow SDK 4.x to 5.0

Workflow SDK 5.0 keeps the programming model from 4.x. `"use workflow"` / `"use step"`, `start()`, `getRun()`, hooks, webhooks, streams, `sleep()`, retries, and the event log are unchanged, so most application code compiles as-is.

The breaking changes are concentrated in three places:

1. **Runtime entrypoints** (`workflow/api`, `workflow/runtime`) — two exports removed.
2. **The `World` interface** — only relevant if the app implements a custom World or calls `getWorld()` directly.
3. **Build integrations** — `@workflow/nest` subpaths, and private compiler subpaths that were never public.

Do not rewrite workflow or step bodies. If you find yourself restructuring business logic, you have gone outside this migration.

## Intake

Before editing, establish:

1. **Which packages are installed.** Read `package.json` for `workflow` and every `@workflow/*` dependency.
2. **Whether the app touches the runtime.** Grep for `getWorld`, `createWorld`, `getWorldHandlers`, `writeToStream`, `readFromStream`, `closeStream`, `listStreamsByRunId`, `getStreamChunks`, `world.steps`, `listByCorrelationId`, `runStep`, `stepEntrypoint`, `internal/private`, `core/private`.
3. **Whether the app implements a custom World.** Grep for `implements World`, `: World`, `createLocalWorld`, `createVercelWorld`, `startWorkflowWorld`.
```
END THIRD-PARTY FILE 20056190aa222dca

The third-party file has ended. Everything between the 20056190aa222dca tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2096 of 21186 bytes. © Vercel Inc. · Apache-2.0 · https://github.com/vercel/workflow/tree/HEAD/skills/migrating-workflow-v4-to-v5/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
