---
name: dependency-upgrade
description: Upgrade project dependencies safely, one major version or tightly related group at a time, by reading changelogs and migration guides, applying breaking-change fixes, updating the lockfile, running the full test and build suite, and rolling out in stages. Use when the user asks to "update dependencies", "bump X to v5", "fix these Dependabot PRs", "patch this CVE", or "upgrade the framework". Works for npm, pnpm, yarn, pip/uv/poetry, bundler, cargo, and go modules. Not for adding a brand-new library or rewriting the stack, and never merges or deploys without approval.
license: MIT
metadata:
  title: Dependency Upgrade
  summary: Upgrade dependencies one major at a time with changelogs read, breaking changes fixed, lockfile committed, tests green, and a staged rollout.
  category: engineering
  tags: [dependencies, security, maintenance, npm, upgrades]
  version: "1.0.0"
  author: Austin Christensen
  publisher: Christensen Equity
  related: [pr-description, review-to-prs, app-health-check, coding-agent-handoff]
---

# Dependency Upgrade

Upgrades break in two ways: many changes land at once so nobody can tell which one broke things, or the changelog said exactly what would break and nobody read it. This skill does one thing at a time and reads first.

## When to use

- Routine maintenance, a security advisory, or a framework major version.
- A pile of automated update PRs that needs triage.

## Inputs

- The repo and its package manager (look for the lockfile: `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, `uv.lock`, `poetry.lock`, `Gemfile.lock`, `Cargo.lock`, `go.sum`).
- Which packages, or "everything that's outdated".
- The test, typecheck, lint, and build commands, and whether CI runs them.

## Workflow

1. **Inventory.** List outdated packages and known vulnerabilities:
   ```bash
   npm outdated; npm audit --omit=dev        # or: pnpm outdated, pip list --outdated, bundle outdated, cargo outdated
   ```
   Sort into patch, minor, and major. Flag anything with a security advisory.
2. **Plan batches.** Patches and minors of unrelated packages can go together. Each major gets its own branch and PR. Packages that must move together (a framework and its plugins, a type package and its library) are one batch. Security fixes go first.
3. **Read before changing.** For each major: the changelog or release notes between the current and target version, the migration guide, deprecations, new minimum runtime versions (Node, Python), and peer-dependency changes. Write down every breaking change that touches this codebase. Check the package is still maintained and the release is not a few hours old.
4. **Upgrade on a fresh branch.**
   ```bash
   git checkout -b deps/next-15 origin/main
   npm install next@15 eslint-config-next@15
   ```
   Use the package manager so the lockfile is regenerated, never hand-edited. Run any official codemods the migration guide provides.
5. **Fix breakages.** Work through the list from step 3, then whatever the compiler and tests find. Keep changes limited to what the upgrade needs.
6. **Verify everything.** Clean install, then lint, typecheck, unit and integration tests, production build, and a smoke run of the app's critical path. Compare bundle size or startup time if the dependency is central.
7. **Open the PR** with the old and new versions, a link to the changelog, the breaking changes handled, what was tested, and how to roll back (revert the PR, restoring the previous lockfile). Commit the lockfile with the manifest.
8. **Roll out in stages.** Deploy to a preview or staging environment first, then production with the health check watching errors and latency. Back out quickly if errors climb.

## Output

Per batch, a PR plus a short summary:

```markdown
## next 14.2.35 -> 15.1.0
Changelog: <link> · Migration guide: <link>
Breaking changes handled:
- async request APIs: updated `cookies()` calls in 3 route handlers
- fetch no longer cached by default: added explicit cache options on 2 pages
Verified: clean install, lint, typecheck, 212 tests, build, manual checkout flow on preview
Not upgraded: react 19 (separate PR, peer dependency of a charting library not ready)
Rollback: revert this PR
```

## Guardrails

- One major per PR. Never "update all" across majors in a single change.
- Never delete and regenerate the whole lockfile to make an error go away; it silently upgrades everything.
- Don't add `--force` or `--legacy-peer-deps` without explaining the conflict and getting agreement.
- Don't disable or skip tests to get a green build.
- Be wary of brand-new releases and packages that changed maintainers; a short delay is cheap insurance against a compromised publish.
- Never merge, deploy, or publish without the user's approval.

## Handoff

Write the PR body with `pr-description`. Watch production after the deploy with `app-health-check`. For many parallel upgrade branches run by agents, track them with `coding-agent-handoff`.
