ditch-vercel
npx skills add https://github.com/umarmuhandis/ditch-vercel --skill ditch-vercel
Agent 安装分布
Skill 文档
Ditch Vercel â Migration Orchestrator
You are running the ditch-vercel migration skill. Follow the 5-phase flow below exactly in order. Do NOT skip phases. Do NOT make any file changes until Phase 4 (after explicit user approval in Phase 3).
Visual Style
All user-facing output must use the cyberpunk “Escape Sequence” visual language. Follow these rules when rendering output in every phase:
- Major frames (Phase 1 banner, Phase 5 completion): Use double-line box-drawing characters â
âââââââ - Reports and sub-panels (Phase 2 report, Phase 3 plan): Use single-line rounded box-drawing â
âââââââ - Narrative/status lines: Prefix with
>â e.g.> VERCEL LOCK-IN DETECTED - Progress bars (Phase 4):
ââfor filled segments,ââfor empty segments - Status tags (Phase 4 tracker):
CLEAR(completed),ACTIVE(in progress),QUEUED(pending),FAILED(error),SKIPPED(user skipped) - Prefix symbols used across phases:
[â]â done / automated[!]â needs attention[â]â blocker / critical+â add-â remove~â modifyÃâ deleteââ manual action
Phase 1: SCAN
Silently detect framework, Vercel features, and target platform in one pass. Minimal output â the report comes in Phase 2.
Pre-flight check
Verify the project is a git repository by checking for a .git directory. If not a git repo, warn the user: “This project is not a git repository. The safety checkpoint (Phase 4) requires git for rollback. Initialize with git init first, or proceed without rollback protection.” Ask the user whether to continue or stop.
1a. Detect framework
Read package.json â examine dependencies and devDependencies. Check for framework config files. Match against this table (first match wins):
| Framework | package.json indicator | Config file pattern |
|---|---|---|
| Next.js | next in deps |
next.config.* |
| Astro | astro in deps |
astro.config.* |
| Remix | @remix-run/* in deps |
remix.config.* (optional) |
| SvelteKit | @sveltejs/kit in deps |
svelte.config.* |
| Nuxt | nuxt in deps |
nuxt.config.* |
| Static | None of the above framework deps | N/A |
Read the corresponding knowledge file:
- Next.js: frameworks/nextjs.md
- Astro: frameworks/astro.md
- Remix: frameworks/remix.md
- SvelteKit: frameworks/sveltekit.md
- Nuxt: frameworks/nuxt.md
- Static: frameworks/static.md
1b. Detect ALL Vercel features
Scan for every Vercel-specific feature. Check every item â do NOT skip any.
Configuration:
vercel.jsonâ Read it fully if present. Note: rewrites, redirects, headers, cron, functions config, regions.
Vercel SDK packages â Check package.json deps and devDeps for:
@vercel/analytics@vercel/speed-insights@vercel/blob@vercel/kv@vercel/postgres@vercel/edge@vercel/og@vercel/edge-config- Any other
@vercel/*package
Framework-specific Vercel features â Scan source files:
- Edge Runtime: Search for
export const runtime = 'edge'orexport const runtime = "edge"in route/API files. - next/image: Search for
import.*from ['"]next/image['"]â Vercel’s image optimization is used. - ISR: Search for
export const revalidateorrevalidate:in page/route files. - API Routes: Search for
app/api/**/route.{ts,js}orpages/api/**/*.{ts,js}(Next.js), or equivalent in other frameworks. - Middleware: Check for
middleware.{ts,js}at project root orsrc/. - Cron jobs: Check
vercel.jsonforcronsfield. - Environment variables: Check for
.env*files. Note which env vars exist (names only, never values). - Serverless/Edge functions config: Check for
export const config = { runtime: ... }patterns.
1c. Select target platform
Ask the user to choose the target platform:
Where do you want to migrate?
- Cloudflare (Workers/Pages â serverless edge) (Recommended)
- Railway (Node.js â managed infrastructure with native DBs)
- VPS (Node.js + PM2 + Nginx â self-managed server)
- Other targets coming soon (Netlify, Fly.io)
Read the target knowledge file:
- Cloudflare: targets/cloudflare.md
- Railway: targets/railway.md
- VPS: targets/vps.md
1d. Output
Display the opening banner, then the themed scan results:
ââââââââââââââââââââââââââââââââââââââââââââââââ
â âââââââ ââââââââââââ ââââââââââ âââ â
â âââââââââââââââââââââââââââââââ âââ â
â âââ ââââââ âââ âââ ââââââââ â
â âââ ââââââ âââ âââ ââââââââ â
â âââââââââââ âââ âââââââââââ âââ â
â âââââââ âââ âââ ââââââââââ âââ â
â VERCEL â
ââââââââââââââââââââââââââââââââââââââââââââââââ
> VERCEL LOCK-IN DETECTED
> INITIATING ESCAPE SEQUENCE...
Framework lock identified : [Framework] [version] ([variant])
Hostile packages found : [N] Vercel-specific features
Escape route : [Target platform]
Example values: Next.js 15 (App Router), 8, Cloudflare Workers/Pages
Phase 2: REPORT
The anxiety reducer. Show the developer exactly how hard this migration is BEFORE asking them to commit to anything.
2a. Calculate complexity score
Cross-reference every detected Vercel feature against the target’s compatibility matrix (from the target knowledge file) and the framework knowledge file’s compatibility notes.
Deduplication rule: When the same feature appears in BOTH the target matrix and the framework compatibility notes:
- Use the target file’s Weight as the base score
- If the framework file lists a lower weight for the same feature on the same target, use the lower weight (the framework’s adapter may handle it automatically)
- Count each feature exactly once â never sum from both files
For each detected feature:
- Look up its Weight and Category â target file is primary, framework file can override downward only
- Sum all weights â total complexity score
- Determine the traffic light:
- ð¢ GREEN (0-2): ~1-2 hours â mostly automated
- ð¡ YELLOW (3-6): ~3-5 hours â several manual steps
- ð´ RED (7+): ~1-2 days â significant refactoring or blockers
2b. Categorize features into 3 groups
- Automated (Weight 0): ditch-vercel handles these entirely
- Attention (Weight 1): Works but needs minor manual adjustment
- Blocker (Weight 3): Significant effort, may prevent migration
2c. Output the report
> THREAT ASSESSMENT COMPLETE
ââââââââââââââââââââââââââââââââââââââââââââââââ
â LOCK-IN SEVERITY : [ð¢ GREEN / ð¡ YELLOW / ð´ RED] â
â Estimated extraction time : [time estimate] â
ââââââââââââââââââââââââââââââââââââââââââââââââ
NEUTRALIZED (auto-handled):
[â] [feature] â [what happens]
[â] [feature] â [what happens]
...
REQUIRES OPERATOR INTERVENTION:
[!] [feature] â [what the developer needs to do]
[!] [feature] â [what the developer needs to do]
...
CRITICAL THREATS:
[â] [feature] â [why it's a blocker and what's needed]
...
Only include sections that have items. If there are no Critical Threats, omit that section. If there are no Operator Intervention items, omit that section.
Phase 3: PLAN + APPROVE
Generate a concrete migration plan, get explicit approval, then create the task list.
3-pre. Cross-reference official docs
Before generating the plan, verify migration steps against current official documentation.
- Read the
## Reference URLssection from the loaded framework file and target file - Prefer
llms.txtURLs (lines prefixed withllms.txt:) â these are machine-readable doc indexes optimized for LLMs. Fetch thellms.txtURL and use the index to locate the specific migration/deployment page, then fetch that page. If nollms.txtentry exists for a source, fall back to the regular doc URLs. - Fetch each URL and extract: current migration steps, required packages, config format, and any breaking changes or deprecation notices
- Compare fetched content against the migration steps in the framework knowledge file. Look for:
- Package name changes (e.g. adapter renamed)
- New required config fields
- Deprecated CLI flags or commands
- Changed build output directories
- If discrepancies found: note them. They will be incorporated into the plan in 3a and flagged for the user in the plan output.
- If fetching fails for any URL: skip silently, proceed with framework file instructions
3a. Generate the migration plan
Based on Phases 1-2 and the doc verification in 3-pre, produce a specific plan. List exact file paths, package names, and what changes will be made. Tag each item with its category. If doc verification found discrepancies with the knowledge file, use the official docs as the source of truth and note the discrepancy in the relevant plan item.
> EXTRACTION PLAN GENERATED
ââââââââââââââââââââââââââââââââââââââââââââââââââ
[Framework] on Vercel â [Target]
ââââââââââââââââââââââââââââââââââââââââââââââââââ
PAYLOADS TO DEPLOY:
+ [package] [AUTO]
+ [package] [AUTO]
...
PAYLOADS TO JETTISON:
- [package] [AUTO]
- [package] [AUTO]
...
FILES TO INJECT:
+ [filepath] â [description] [AUTO]
...
FILES TO PATCH:
~ [filepath] â [description] [AUTO/MANUAL]
...
FILES TO PURGE:
à [filepath] [AUTO]
...
POST-EXTRACTION OPS:
â [item] [MANUAL]
...
Each entry must be specific enough that the developer understands exactly what will happen. Tag each item [AUTO] for automated or [MANUAL] for attention/blocker items.
3b. Approval gate
This is a hard gate. Do NOT proceed without explicit approval.
Ask the user:
> AUTHORIZE EXTRACTION?
[1] Yes â execute extraction sequence
[2] Modify â adjust the plan
[3] Abort â no changes, exit clean
If “Modify”: loop â gather feedback, revise the plan, present for approval again.
If “Abort”: stop gracefully. Output: > EXTRACTION ABORTED. No files changed. Run /ditch-vercel anytime to re-engage.
CRITICAL: Do NOT create, modify, or delete any project files before receiving approval (option 1).
3c. Build the execution checklist
After the developer approves, build an ordered checklist of every migration action. Track each item’s progress throughout Phase 4 (announce when starting and completing each step). If your agent supports built-in task tracking, use it.
Execution order:
- Create git safety checkpoint
- One item per dependency to install
- One item per dependency to remove
- One item per file to create
- One item per file to modify
- One item per file to delete
- Run build verification
- Run local dev server verification
Each item must describe one atomic action with the exact command or file change.
Phase 4: EXECUTE
Execute the approved plan with safety nets and real-time task tracking.
Output the extraction authorization header:
> EXTRACTION SEQUENCE AUTHORIZED
ââââââââââââââââââââââââââââââââââââââââââââââ
4a. Git safety checkpoint
Begin the git safety checkpoint.
- Check
git status. If working tree is dirty:
Warning: Only stage tracked files (git add -u && git commit -m "chore: pre-migration checkpoint (ditch-vercel)"git add -u). Do NOT usegit add -Aâ it can accidentally commit.envfiles or credentials. If there are important untracked files the user wants to preserve, tell them togit addthose specific files first. - If working tree is clean, note the current HEAD SHA.
- Store the checkpoint SHA for rollback.
- Mark the checkpoint step as done.
- Output:
> Safety checkpoint locked (commit: <sha-short>). Emergency rollback: git reset --hard <sha>
4b. Detect package manager
Check the project root for lock files (first match wins):
| Lock file | Package manager |
|---|---|
bun.lockb or bun.lock |
bun |
pnpm-lock.yaml |
pnpm |
yarn.lock |
yarn |
package-lock.json |
npm |
If no lock file found, default to npm.
4c. Execute each task
For each remaining task (dependencies, files, deletions):
Important: Follow the migration steps section in the framework knowledge file that matches the selected target platform. For example, if the target is VPS, follow ## Migration Steps (VPS). If the target is Cloudflare, follow ## Migration Steps (Cloudflare). Use the corresponding ## Compatibility Notes ([target]) section for replacement guidance.
- Execute the action:
- Install dep:
[pkg-manager] add <pkg>/[pkg-manager] add -D <pkg> - Remove dep:
[pkg-manager] remove <pkg> - Create file: Create the file
- Modify file: Edit the file
- Delete file: Delete the file (e.g.
rm)
- Install dep:
- If successful: mark the step as done
- If failed: show the error and ask the developer:
- “Fix it” â Read the error, attempt a fix, retry the action
- “Skip this step” â Mark done with
SKIPPED, continue - “Rollback everything” â Run
git reset --hard <checkpoint-sha>, skip all remaining steps, stop execution
Progress tracker rendering: After each step completes, re-render the full progress tracker showing all steps. Use this format:
[03/14] ââââââââââââââââââââââââââââââ ACTIVE Installing @opennextjs/cloudflare
âââââââââââââââââââââââââââââââââââââââââââââââ
[01/14] ââââââââââ CLEAR Git safety checkpoint
[02/14] ââââââââââ CLEAR Remove @vercel/analytics
[03/14] ââââââââââ ACTIVE Installing @opennextjs/cloudflare
[04/14] ââââââââââ QUEUED Create wrangler.toml
...
Status tags: CLEAR (completed), ACTIVE (in progress), QUEUED (pending), FAILED (error), SKIPPED (user skipped). The top line shows the current step; the list shows all steps.
On failure after the user chooses rollback, output:
> ABORT EXTRACTION? Reset to checkpoint <sha>
4d. Build verification
After all file changes are complete:
- Begin build verification
- Detect the build command:
- Next.js + Cloudflare:
<pkg> run build:cf(or the build:cf script added in migration) - Next.js + VPS:
<pkg> run build - Astro:
<pkg> run build(runsastro build) - Remix:
<pkg> run build(runsremix vite:build) - SvelteKit:
<pkg> run build - Nuxt:
<pkg> run build(runsnuxt build) - Next.js + Railway:
<pkg> run build - Astro + Railway:
<pkg> run build - Remix + Railway:
<pkg> run build - SvelteKit + Railway:
<pkg> run build - Nuxt + Railway:
<pkg> run build - Static + Railway:
<pkg> run build(or skip if no build step) - Static with build script:
<pkg> run build - Static without build: skip (no build needed)
- Next.js + Cloudflare:
- Run the build command
- If build passes: mark step as done
- If build fails:
- Show the error output (first 50 lines)
- Ask the developer:
- “Fix it” â Read the error, attempt to fix the code, re-run the build
- “Rollback everything” â Run
git reset --hard <checkpoint-sha>, skip remaining steps, stop - “Continue anyway” â Note “[BUILD FAILED – manual fix needed]” and continue
4e. Local dev server verification
After build passes, verify the app starts and responds locally.
- Begin local dev server verification
- Detect the preview command:
- Next.js + Cloudflare:
npx wrangler dev(port 8787) - Next.js + VPS:
node .next/standalone/server.js(port 3000) - Astro + Cloudflare:
npx wrangler pages dev dist/(port 8788) - Astro + VPS:
node dist/server/entry.mjs(port 4321) - Remix + Cloudflare:
npx wrangler pages dev build/client(port 8788) - Remix + VPS:
npx remix-serve build/server/index.js(port 3000) - SvelteKit + Cloudflare:
npx wrangler pages dev .svelte-kit/cloudflare(port 8788) - SvelteKit + VPS:
node build/index.js(port 3000) - Nuxt + Cloudflare:
npx wrangler pages dev .output/public(port 8788) - Nuxt + VPS:
node .output/server/index.mjs(port 3000) - Static + Cloudflare:
npx wrangler pages dev <output-dir>(port 8788) - Next.js + Railway:
node .next/standalone/server.js(port 3000) - Astro + Railway:
node dist/server/entry.mjs(port 4321) - Remix + Railway:
npx remix-serve build/server/index.js(port 3000) - SvelteKit + Railway:
node build/index.js(port 3000) - Nuxt + Railway:
node .output/server/index.mjs(port 3000) - Static + Railway:
npx serve <output-dir>(port 3000) - Static + VPS:
npx serve <output-dir>(port 3000)
- Next.js + Cloudflare:
- Start the preview command in the background
- Wait ~5 seconds for the server to start
- Run
curl -s -o /dev/null -w "%{http_code}" http://localhost:<port>/to check for a 200 response - Kill the background process
- If curl returns 200: mark step as done
- If curl fails or non-200:
- Show the output
- Ask the developer:
- “Fix it” â investigate, fix, retry
- “Skip” â mark done with “[DEV SERVER CHECK SKIPPED]”
- “Rollback everything” â Run
git reset --hard <checkpoint-sha>, skip remaining steps, stop
Phase 5: DONE
Output the final migration summary with everything the developer needs.
5a. Migration summary
ââââââââââââââââââââââââââââââââââââââââââââââââ
â âââââââââââââââ ââââââââââââââââ â
â ââââââââââââââââââââââââââââââââ â
â ââââââ ââââââââââââââ ââââââ â
â ââââââ ââââââââââââââ ââââââ â
â âââ âââ âââââââââââââââââââ â
â âââ âââ âââââââââââââââââââ â
ââââââââââââââââââââââââââââââââââââââââââââââââ
> EXTRACTION COMPLETE
> You are no longer locked in.
Created : [list files]
Patched : [list files]
Purged : [list files]
Deployed : [list packages]
Removed : [list packages]
REMAINING OPS:
â [item from report that wasn't fully automated]
...
NEXT MOVES:
1. [deploy command] â deploy to [target]
2. Set environment variables in [target] dashboard
3. [any other manual items]
EMERGENCY ROLLBACK:
git reset --hard [checkpoint-sha]
Only include “REMAINING OPS” if there are remaining items. Derive the local dev command, deploy command, and manual items from the target knowledge file and framework knowledge file.
General Rules
- Be precise: Use exact file paths, package names, and commands. Never be vague.
- Be safe: Never touch files outside the project directory. Never expose env var values.
- Be transparent: Show the user what you found and what you plan to do before doing it.
- Handle errors: If a knowledge file is missing, work from your own knowledge but warn the user. If a scan finds nothing, say so explicitly rather than guessing.
- One framework only: If multiple frameworks are detected, ask the user to clarify which one is the primary framework.
- Monorepo awareness: If the project root contains
apps/orpackages/directories, ask the user which app to migrate. - Track progress through each step during Phase 4. Use your agent’s task tracking if available.
- Step #1 must always be the git safety checkpoint.
- Never mark a step as done if the action failed. Failed steps need recovery options presented to the developer. Note: user-initiated skips (where the developer explicitly chooses “Skip this step”) are NOT failures â mark these done with a “[SKIPPED]” tag.