next-on-workers
Publish a Next.js + Tailwind app to Cloudflare Workers, and prove the live URL serves this build: no surprise resources, a preview in workerd first.
npx skills add robfold/next-on-workersEnglish · 한국어
Publish a Next.js + Tailwind CSS app to Cloudflare Workers, and prove the live URL serves this build. This skill is for coding agents that deploy Next.js with the OpenNext adapter, where next dev passes, the CLI prints a version ID, and the live page is still broken, unstyled, or public when it should not be.
- No resource nobody chose. The agent writes the Wrangler config by hand from a template. It runs
migrateonly after you agree to the R2 bucket it creates, then reviews every binding it added. - The account is checked.
account_idin the config andwrangler whoamimust agree before anything writes. - The cache fits the pages. Static-assets cache unless pages revalidate. With Cache Components on and no cache, every page hung in workerd; the skill does not ship that.
- Secrets stay out of the bundle. A local build copies
.env*values into the Worker. The preflight script lists bundled keys and fails on secret-looking ones. - Previewed in workerd first.
opennextjs-cloudflare preview, one route of each kind, and the dry-run size against the plan limit. - You decide who can open it.
workers.devand preview URLs stay off until you pick public, a custom domain, or Cloudflare Access. - Live means this build. The live check matches the build ID, a Tailwind class the page uses, and text only the dynamic part renders. A status code alone does not count.
Shape
pin the target: account, Worker name, audience, cache need
→ set up: create-next-app --tailwind + adapter from templates
→ make it run on workerd: cache, env files, preflight.py
→ preview in workerd: check_live.py on 127.0.0.1, dry-run size
→ decide who can open it: workers.dev / custom domain / Access
→ deploy one clean commit, capture the version ID
→ prove it is live: check_live.py on the host + deployments status
→ record in the README and read back
| Reference | Settles |
|---|---|
| setup.md | New and existing apps, Tailwind v4 wiring, the hand setup, what migrate writes and what to decide for each line, static export |
| runtime.md | The cache table, cache interception, where env values end up, proxy, database clients, memory, size, images |
| exposure.md | Wrangler's public defaults, custom domains, Access, checking from outside |
| deploy.md | Preconditions, deploy and upload, messages, version check, rollback, the README block |
| sources.md | Which rules came from something that happened, which were set in advance, and the docs read |
Two scripts, standard-library Python, no network except GETs to the URL you give:
- preflight.py reads the project and prints FAIL, WARN, and INFO lines: config, bindings, public defaults, cache wiring, Tailwind wiring,
.env*keys bundled into the Worker, and the dry-run size. - check_live.py checks a preview or a live URL: page status, expected text, linked CSS and Tailwind classes, the build ID at
/BUILD_ID, a real 404, extra paths, or--private --signin-host <host>for an app behind sign-in.
Templates: wrangler.jsonc and open-next.config.ts. The Korean text of the skill is in SKILL.ko.md and sources.ko.md. The agent loads only the English SKILL.md.
Install
Claude Code:
/plugin marketplace add robfold/next-on-workers
/plugin install next-on-workers@next-on-workers
Other agents, with the skills CLI:
npx skills add robfold/next-on-workers
Or copy skills/next-on-workers/ into your agent's skills folder (for Claude Code, ~/.claude/skills/).
Use
Tell your agent "deploy this Next.js app to Cloudflare Workers", "ship it with OpenNext", or "it works in next dev but breaks on Workers", or call it directly:
$next-on-workers Publish this Next.js + Tailwind app to Cloudflare Workers on app.example.com. Pages do not revalidate. Prove the live page is this build.
The skill:
- Asks for the account, Worker name, audience, and whether pages revalidate, and checks the CLI account.
- Sets up the adapter from templates, or reviews what
migratewrote. - Picks the cache, moves secrets out of
.env*files, and runs the preflight script. - Builds and previews in workerd, checks each kind of route, and measures the upload size.
- Keeps the app unreachable until you choose who can open it.
- Deploys one clean commit after your yes, and captures the version ID.
- Checks the live host for the build ID, a Tailwind class, and dynamic text, and confirms the version serves all traffic.
- Writes the deploy block into your README and reads it back, with what was not checked.
Sources
The rules come from Next.js apps deployed to Workers with OpenNext and from a probe app that checked each claim on Next.js 16.4.6, @opennextjs/cloudflare 1.20.19, and Wrangler 4.169.1, against the OpenNext, Cloudflare Workers, and Next.js docs. sources.md lists what happened, what was set in advance, and what was not run.