Upgrade project dependencies safely — inventories current→target versions from the actual manifest/lockfile, reads the real changelog/release notes for every major bump (a breaking-change claim without a changelog citation is a hypothesis), greps the codebase for each breaking API before declaring it safe, upgrades one major at a time with tests+build quoted green between batches, and reports a per-package table of what changed and what evidence backs "safe". Use this skill whenever the user says "upgrade dependencies", "update packages", "bump <package>", "is it safe to upgrade", "update to the latest", "fix the npm audit", "dependabot PR review", or "/upgrade-deps" — even if they don't explicitly say "dependency skill". Do not use for adding a NEW dependency (that's a design decision) or diagnosing a breakage after an upgrade already happened (use diagnose).
---
name: upgrade-deps
description: Upgrade project dependencies safely — inventories current→target versions from the actual manifest/lockfile, reads the real changelog/release notes for every major bump (a breaking-change claim without a changelog citation is a hypothesis), greps the codebase for each breaking API before declaring it safe, upgrades one major at a time with tests+build quoted green between batches, and reports a per-package table of what changed and what evidence backs "safe". Use this skill whenever the user says "upgrade dependencies", "update packages", "bump <package>", "is it safe to upgrade", "update to the latest", "fix the npm audit", "dependabot PR review", or "/upgrade-deps" — even if they don't explicitly say "dependency skill". Do not use for adding a NEW dependency (that's a design decision) or diagnosing a breakage after an upgrade already happened (use diagnose).
---
# Upgrade Deps
Upgrade dependencies as a verification exercise, not a version-number edit. The failure mode this skill exists to prevent: bump everything, build goes green, ship — then the runtime break surfaces in production because the breaking change lived in behavior, not in types. Every "safe to upgrade" claim here is backed by a named check: the changelog actually read, the breaking API actually grepped for, the suite actually run.
## When to use this skill
- The user says "upgrade dependencies", "update packages", "bump X to latest", "is it safe to upgrade X", "handle the dependabot/renovate PRs", "fix the audit warnings", "/upgrade-deps".
- A CVE or audit finding requires moving a package (composes with `security-review`).
- A framework/runtime upgrade (Node LTS, .NET major, Next.js major) that drags dependencies with it.
Do **not** auto-trigger for adding a new dependency (a design choice) or for debugging an already-broken upgrade (`diagnose`). If the repo has no tests at all, say up front that upgrade safety cannot be verified beyond compile — and ask whether to proceed anyway or pin a minimal net first (`write-tests`).
## Workflow
1. **Inventory from the tools, not from memory.** Run the ecosystem's outdated-check (`npm outdated`, `dotnet list package --outdated`, `pip list --outdated`, `cargo outdated`, `go list -u -m all`) and quote the output. Training-data version knowledge is stale by construction — never state a "latest version" you didn't just read from a tool or registry. Note which entries are direct vs transitive: transitives usually move by bumping the parent or the lockfile, not the manifest.
2. **Confirm scope.** Everything? Security-only? One package? If the user didn't say and the outdated list is long, ask once (`AskUserQuestion`): the plan for "patch the CVE" and "get current across the board" are different sizes. Classify the in-scope list: **patch/minor** (batchable) vs **major** (one at a time, each with its own evidence).
3. **Lock the baseline.** Full test suite (single-run mode, never watch mode) + build, summaries quoted. A result you didn't observe is "not run", never "passed". Red baseline → stop and surface: you can't attribute post-upgrade failures on a pre-broken repo.
4. **For every major bump: read the actual release notes.** Fetch the changelog / GitHub releases / migration guide for the versions being crossed (all of them — v2→v4 means reading v3's breaking changes too). Extract the breaking-change list. No changelog found → say so and downgrade confidence explicitly ("no changelog located; upgrading on test coverage alone").
5. **Grep before declaring unaffected.** For each breaking change, search the repo for the removed/renamed API, changed config key, or altered default. Cite hits (each becomes a migration edit) or state the negative concretely: "no usage — repo grep for `<symbol>` returned nothing". Behavioral breaking changes (changed defaults, stricter parsing, timezone/locale changes) don't grep well — list them separately as **runtime risks** and name which test would catch each, or that none would.
- ❌ "v5 has breaking changes but they probably don't affect us."
- ✅ "v5 removes `parser.lenient` (changelog §2). Grep: 2 call sites — `config.ts:12`, `import.ts:88` — both need the new `strict:false` option. Also v5 changes default timezone handling (runtime risk: covered by `date-roundtrip` tests)."
6. **Upgrade in evidence-sized batches.** Patch/minor: one batch, then tests+build, quoted. Majors: strictly one package at a time — apply the bump plus its migration edits from step 5, run tests+build, quote, commit (`conventional-commits`, `chore:` or `fix:`), next. When a batch goes red: read the error, change exactly one thing, retry once; still red → revert that bump, mark the package **blocked** with the quoted error, and continue with the rest. Two failures on the same package is a report item, not a loop.
7. **Lockfile and peer hygiene.** Regenerate the lockfile with the ecosystem's tool and commit it with the manifest — never hand-edit it. Never silence resolution errors with `--force` / `--legacy-peer-deps` without surfacing what conflict is being overridden and getting a yes. For a transitive CVE with no direct bump available, prefer the ecosystem's override mechanism (`overrides` / `resolutions` / central package management) and label it as a pin to revisit.
8. **Report the table + the honest residue.** Per package: from → to, breaking changes affecting THIS repo (with the grep/changelog evidence), migration edits made, test result. Then the residue, stated plainly: blocked packages and why, runtime risks no test covers, anything held back deliberately (e.g. "next stayed on 14 — the 15 migration is its own task"). Zero-affected upgrades are a valid, common outcome — a clean table is the report, not a reason to pad.
## Examples
### Example 1: the routine sweep
**User:** "Update this project's dependencies."
**Claude:** Runs `npm outdated` (quotes it: 14 minor, 3 major), confirms scope = all, baseline green (quoted), batches the 14 minors → suite green → commit; then majors one at a time: reads `zod` v4 release notes, greps the 3 renamed APIs (7 call sites migrated), suite green, commit; `eslint` v9 flat-config migration done the same way; third major's changelog reveals a Node engine bump beyond the repo's CI version → marked **blocked** with the evidence, not forced. Final table + residue.
### Example 2: CVE-driven, transitive
**User:** "npm audit is flagging lodash under some build plugin, fix it."
**Claude:** Runs `npm audit` (quotes the advisory + path), finds it transitive under a plugin whose latest still pins the bad range, adds an `overrides` entry, regenerates the lockfile, re-runs audit (quotes: 0), runs the build to prove the override didn't break resolution, labels the override as a revisit-when-upstream-fixes pin in the report.
## Anti-patterns
- ❌ Stating a package's latest version or breaking changes from memory — versions move; only tool output and fetched changelogs count.
- ❌ Bumping all majors at once — when the suite goes red you can't attribute the failure, and the debug costs more than the sequencing saved.
- ❌ "Build passes, so the upgrade is safe" — compilation proves the typed surface only; changed runtime defaults, dynamic access, and reflection sail through. Name the runtime risks instead of implying their absence.
- ❌ `--force` / `--legacy-peer-deps` / `--ignore-engines` applied silently to make the error go away — that's deferring the break to runtime and hiding the decision from the user.
- ❌ Hand-editing the lockfile, or committing the manifest without regenerating it.
- ❌ Retrying a red upgrade in a loop with mutations until something compiles — one informed retry, then revert, block, and report.
- ❌ Sneaking unrelated "while I'm here" refactors into upgrade commits — the diff should be bump + its migration edits, nothing else.
- ✅ Tool-derived inventory → changelogs actually read → breaking APIs grepped with citations → one major per commit, suite quoted between → table + honest residue.
## Notes
- Framework majors with published codemods (Next.js, React, MUI, AngularJS→ng) — check for an official codemod before hand-migrating; run it, then diff-review its output like any other change.
- Version-pinning policy belongs to the repo (exact pins vs ranges, Renovate config) — match what's there; don't impose a policy mid-upgrade.
- Apply `think-like-fable`: the risk lives in the majors and the runtime-behavior changes, so that's where the effort goes; every "unaffected" is a re-derived negative (grep quoted), never a vibe; the report leads with what the user must decide (blocked items, risks), not the chronology.
don't have the plugin yet? install it then click "run inline in claude" again.
split intent into dedicated section, added detailed inputs (ecosystem tools, registries, git), expanded procedure with 12 numbered steps including explicit git commands and table format, created decision points section for scope/baseline/errors/conflicts/codemods, defined output contract with table structure and evidence requirements, added outcome signal for verification and traceability.
Upgrade dependencies as a verification exercise, not a version-number edit. the failure mode this skill exists to prevent: bump everything, build goes green, ship, then the runtime break surfaces in production because the breaking change lived in behavior, not in types. every "safe to upgrade" claim here is backed by a named check: the changelog actually read, the breaking API actually grepped for, the suite actually run.
use this skill whenever the user says "upgrade dependencies", "update packages", "bump X to latest", "is it safe to upgrade X", "handle the dependabot/renovate PRs", "fix the audit warnings", or "/upgrade-deps" , even if they don't explicitly name the skill. it runs a structured verification: inventory from the tool (not memory), read the real changelogs for every major bump, grep the codebase for each breaking API, run tests+build between batches, then report a per-package table with evidence for every "safe" claim. do not auto-trigger for adding a new dependency (that's a design decision, use write-design instead) or for debugging an already-broken upgrade (use diagnose instead). if the repo has no tests at all, surface that up front: upgrade safety cannot be verified beyond compile, so ask whether to proceed anyway or pin a minimal net first (call write-tests).
package.json (npm), pyproject.toml or requirements.txt (pip), .csproj or packages.config (.NET), Cargo.toml (Rust), go.mod (Go), etc. , the actual source of truth for dependencies.package-lock.json, npm-shrinkwrap.json, poetry.lock, Pipfile.lock, packages.lock.json, Cargo.lock, go.sum , the pinned baseline.npm run build, dotnet build, cargo build, etc.) that must succeed between batches.npm outdated, dotnet list package --outdated, pip list --outdated, cargo outdated, go list -u -m all , run and quote the actual output.chore:, fix:, refactor: prefixes) and to revert a bump if tests fail.run the outdated inventory and quote it. invoke the ecosystem tool (npm outdated, dotnet list package --outdated, pip list --outdated, cargo outdated, go list -u -m all). paste the full output into the response. never state a "latest version" from training data or memory , only from the tool output or registry you just fetched. note which entries are direct dependencies vs transitive: transitive bumps usually move by bumping the parent or regenerating the lockfile, not by editing the manifest directly.
confirm scope with the user (once, if needed). if the user didn't specify "all, security-only, or one package" and the outdated list is long, ask: AskUserQuestion , "upgrade all, or only security/critical patches?" the plan for "patch the CVE" and "get current across the board" are different sizes. classify the in-scope list into patch/minor (batchable together) vs major (one at a time, each with its own evidence and commit).
establish and quote the baseline. run the full test suite in single-run mode (never watch mode), quote the result. run the build command, quote the result. if either is red, stop. surface it directly: "baseline is broken (test suite: [quoted error]); cannot attribute post-upgrade failures to the upgrade. fix baseline first or proceed at risk." a result you didn't observe personally is "not run", never "assumed passed". commit the baseline state with a message like chore: baseline before upgrade-deps.
batch patch and minor upgrades. collect all patch and minor upgrades. apply them all at once to the manifest, regenerate the lockfile with the ecosystem tool (never hand-edit it), commit with chore: bump patch and minor dependencies. run tests+build, quote the result. if green, continue; if red, revert that commit, mark the batch blocked with the quoted error, and move to step 5 (majors) , the patch batch is a single failure threshold.
for each major upgrade: fetch and read the changelog. for the package and version range being crossed (e.g., v2→v4 means reading both v3 and v4 release notes), locate the changelog / GitHub releases / official migration guide. fetch it and include it in your response. extract the breaking-change list. if no changelog is found, say so explicitly and downgrade confidence: "no changelog located for X v7; upgrading on test coverage alone." do not guess or infer breaking changes.
grep the codebase for each breaking API. for each breaking change listed in the changelog, search the repo for the removed/renamed API, changed config key, or altered default. cite the hits with file and line: "grep for lenient found 2 call sites: config.ts:12, import.ts:88". or state the negative concretely: "no usage , grep for <symbol> returned nothing, repo unaffected." behavioral breaking changes (changed defaults, stricter parsing, timezone/locale changes) don't grep well , list them separately under runtime risks and name which test would catch each, or acknowledge that none would. do not write "this probably doesn't affect us".
migrate each breaking API. for each grep hit in step 6, apply the codebase edits (e.g., add strict:false option to the two call sites, change config key, rename the import). keep the diff clean: only bump + migration edits. apply the bump to the manifest, regenerate the lockfile, commit with chore: upgrade <package> to vX (migration: <edits>) or fix: upgrade <package> to vX (migration: <edits>) if it fixes a CVE.
run tests+build, quote the result. after each major bump commit, run the full suite and the build. quote the output. if green, move to the next major; if red, read the error carefully. check whether it's an unrelated flake (rerun once), or a genuine breakage from this bump. if genuinely red after one retry, revert that commit immediately and mark the package blocked with the quoted error. do not loop with mutations trying to make it pass , two failures is a block, not a debugging session. continue with the remaining majors.
regenerate lockfile and commit it with the manifest. after each batch and each major, regenerate the lockfile with the ecosystem's tool (npm ci --package-lock-only, pip freeze > requirements.txt, cargo update, etc.). commit the manifest and lockfile together in the same commit. never hand-edit the lockfile. if the ecosystem raises a peer-dependency conflict or engine mismatch, surface it before forcing: "v8 requires Node 18+, but CI runs 16 , upgrade Node in CI first or pin to v7?". never silence with --force, --legacy-peer-deps, or --ignore-engines without naming what's being overridden and getting explicit user consent.
for transitive CVEs with no direct bump, use ecosystem overrides. if a transitive dependency has a CVE and the direct parent won't bump, use the ecosystem's pinning mechanism: overrides (npm), resolutions (yarn), central package management (.NET), etc. commit it and label it in the report as "override until upstream fixes". re-run the audit/scan to confirm the flag is gone.
report: build the per-package table. create a table with rows for each touched package: from version, to version, breaking changes affecting this repo (with grep/changelog evidence), migration edits made (with file names), test result (pass/fail/skipped). group majors and patch/minor separately. example:
| package | from | to | breaking changes in this repo | migration | tests+build |
|---|---|---|---|---|---|
| zod | 3.x | 4.x | z.lenient() removed (call sites: config.ts:12, import.ts:88) |
changed to strict:false option |
✓ pass |
| eslint | 8.x | 9.x | flat config required | rewrote .eslintrc.js → eslint.config.js | ✓ pass |
AskUserQuestion. do not guess. the effort levels are different.--force, --legacy-peer-deps, or --ignore-engines silently. get explicit consent for the override, then note it in the report.overrides, resolutions, etc.) and label it in the report as a pin-to-revisit, not a permanent solution.write-tests first.chore: upgrade <package> to vX or fix: upgrade <package> to vX (if CVE), followed by migration notes if applicable. all manifests and lockfiles committed together.