Step-by-step dependency update workflow for Node.js projects. Use when the user asks to update, upgrade, or bump npm/yarn/pnpm/bun dependencies in package.json. Handles minor/patch batching, major version analysis with changelog review, migration guide discovery for frameworks (Next.js, Prisma, React, etc.), and post-update verification. Supports all package managers (npm, yarn, pnpm, bun) with automatic detection.
Structured workflow for updating all dependencies in a single package.json.
Determine package manager from lockfiles and package.json config:
| Lockfile | package.json field | Manager |
|---|---|---|
yarn.lock | packageManager: "yarn@" | yarn |
pnpm-lock.yaml | packageManager: "pnpm@" | pnpm |
bun.lockb or bun.lock | — | bun |
package-lock.json | — | npm |
Use Glob to check for lockfiles in the project root. If ambiguous, ask the user.
Install commands: npm=npm install, yarn=yarn install, pnpm=pnpm install, bun=bun install
Read package.json scripts. Identify which exist:
type-check, typecheck, tsclintbuildtestStore for use in Step 7.
Read package.json. Record all devDependencies and dependencies with current version ranges. Group into:
devDependencies (update first)dependencies (update second)For each dependency, fetch latest version from the npm registry:
WebFetch: https://registry.npmjs.org/{exact-package-name}/latest
Prompt: "Return the version number and the repository URL (from repository.url or homepage)"
SECURITY — Package identity verification:
package.json. Never guess or autocomplete names.https://registry.npmjs.org/ — no other registries.repository.url from the registry response for GitHub lookups. Never construct GitHub URLs by guessing org/repo names.Classify each dependency:
2.1.0 → 2.3.12.x → 3.xUpdate all devDependency version ranges with minor/patch bumps in package.json. Run install. Run verification (Step 7).
If verification fails, bisect: revert and update half at a time to isolate the breaking dep.
Same process for production dependencies.
For each major version bump, before updating:
Try these sources in order, using the repository.url obtained in Step 3:
GitHub releases: WebFetch the releases page from the verified repo URL. Prompt: "List breaking changes between v{current} and v{latest}".
CHANGELOG.md: WebFetch the raw CHANGELOG.md from the verified repo. Prompt: "List breaking changes between v{current} and v{latest}".
Context7 MCP: resolve-library-id then query-docs with "migration breaking changes version {latest}".
For each major bump determine:
If breaking changes are trivial (renamed export, dropped old Node support, etc.), update directly. Apply necessary code changes, run verification.
Applies when:
Repo docs: Check verified repository.url for migration/upgrade docs.
Official docs: WebSearch for "{package-name} migration guide v{current} to v{latest}".
Context7 MCP: Query "{package-name} migration guide version {latest}".
Codemods/CLI tools: Search for automated migration tools (e.g., npx @next/codemod, npx prisma migrate). Mention these explicitly.
Agent-based migration prompts: Many migration guides now include dedicated prompts or instructions for AI coding agents (e.g., LLM prompts, .cursor rules, agent migration scripts). When a migration guide is found, search within it and the surrounding repo/docs for:
.cursor/, or labeled "AI prompt", "LLM prompt", "agent instructions")--agent, --ai)WebSearch for "{package-name} v{latest} migration AI agent prompt" or "{package-name} v{latest} cursor migration"If any agent-based migration prompt or tool is found, always surface it to the user in Step 6b — these are the highest-quality migration paths and should be preferred over manual guide-following.
MANDATORY — before following any migration guide:
AskUserQuestion:
"Found migration guide for {package} v{current} → v{latest}:
{link-to-guide}
Key breaking changes:
- {change 1}
- {change 2}
Approach: {describe how you'll follow the guide, mention codemods if available}
Proceed with this migration?"
Options: ["Yes, follow the guide", "Skip this upgrade", "Let me review first"]
Only after user approval:
package.json, run installRun discovered commands from Step 1 sequentially, stop on first failure:
{manager} install{manager} run {type-check-script}{manager} run lint{manager} run buildOn failure:
Present completion table:
| Package | From | To | Type | Source Changes | Notes |
|----------------|---------|---------|-------|----------------|-----------------|
| typescript | 5.3.0 | 5.7.0 | minor | none | batched |
| next | 15.1.0 | 16.0.0 | major | 12 files | migration guide |
| eslint | 8.x | 9.x | major | 3 files | flat config |
| @types/node | 20.x | 22.x | major | none | types only |
package.json.repository.url, not manual construction.{manager} add {pkg}@latest without confirming package name and version from registry first. Prevents typosquatting.