Skip to main content
command CX Codex

dependency-upgrade — Claude Code command: what it does, how to install

The dependency-upgrade command for Claude Code updates packages one by one, runs tests after each upgrade, and rolls back changes on failures.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/dependency-upgrade.md
Open on GitHub

What dependency-upgrade does

This command automates package updates across Node.js, Python, Rust, and Go environments. It starts by detecting the current package manager, verifying a clean git working tree, and establishing a test baseline. If existing tests fail, the workflow halts immediately to prevent compounding issues.

Outdated dependencies are categorized into patch, minor, and major risks. The command upgrades packages sequentially, starting with lowest-risk patches. Before touching files, it inspects release notes or changelogs for breaking changes. Each successful upgrade generates a dedicated git commit, while test failures trigger an immediate revert via git checkout -- . and lockfile restoration.

A working test suite is mandatory because the workflow relies directly on test passes before committing any change.

What it helps with

  • upgrade packages sequentially with immediate test verification
  • revert breaking package updates automatically without human intervention
  • categorize outdated libraries by risk into patch, minor, and major tiers
  • generate clean git commits for individual dependency bumps

Example prompts for the agent

  • /dependency-upgrade
  • /dependency-upgrade typescript
  • /dependency-upgrade ruff

How to install dependency-upgrade

Manually: put the files in place

.claude/commands/dependency-upgrade.md

Call it with /dependency-upgrade. For all projects use ~/.claude/commands/

Questions about dependency-upgrade

How to install dependency-upgrade in Claude Code?

Place the command specification file into .claude/commands/dependency-upgrade.md inside your repository.

What does dependency-upgrade do?

It identifies outdated dependencies, ranks them by semver risk, applies upgrades individually, and runs project tests after every change.

How does it handle broken updates?

When tests fail, it executes git checkout -- ., reinstalls dependencies from the unchanged lockfile, logs the failure, and proceeds to the remaining packages.

Source text

dependency-upgrade.md · MIT
---
allowed-tools: Bash(git:*), Bash(npm:*), Bash(npx:*), Bash(yarn:*), Bash(pnpm:*), Bash(bun:*), Bash(pip:*), Bash(uv:*), Bash(python:*), Bash(cargo:*), Bash(go:*), Read, Edit, WebFetch
description: Safe, one-at-a-time dependency upgrades with verification after each. Detects package manager automatically.
argument-hint: "[specific package name, or blank for all outdated]"
---

# Dependency Upgrade

Safely upgrade dependencies one at a time with testing between each upgrade.

## Context

- Project root files (infer the package manager from the lockfile present): !`ls -a`
- Current branch: !`git branch --show-current`
- Working tree status: !`git status --short`
- Node version (if applicable): !`node --version 2>/dev/null || echo "N/A"`
- Python version (if applicable): !`python3 --version 2>/dev/null || echo "N/A"`

## Workflow

### Phase 1: Detect Environment

1. Identify the package manager from context above
2. Confirm a clean working tree. If there are uncommitted changes, stop and ask the user how to proceed — do not stash or commit their work yourself
3. Ensure tests pass BEFORE any upgrades — this is the baseline:
   - Node.js: `npm test` / `yarn test` / `pnpm test` / `bun test`
   - Python: `pytest` / `python -m pytest`
   - Rust: `cargo test`
   - Go: `go test ./...`
4. If baseline tests fail, STOP and report — do not upgrade on a broken baseline

### Phase 2: List Outdated Dependencies

Run the appropriate outdated command:

- npm: `npm outdated --json`
- yarn: `yarn outdated`
- pnpm: `pnpm outdated`
- bun: `bun outdated`
- pip/uv: `uv pip list --outdated` or `pip list --outdated --format=json`
- cargo: `cargo outdated` (if installed) or check Cargo.toml
- go: `go list -m -u all`

### Phase 3: Categorize Updates

Sort dependencies into risk categories:

```
## Outdated Dependencies

### Patch Updates (safe — bug fixes only)
| Package | Current | Latest | Notes |
|---------|---------|--------|-------|
| ...     | ...     | ...    | ...   |

### Minor Updates (review — new features, possible deprecations)
| Package | Current | Latest | Notes |
|---------|---------|--------|-------|
| ...     | ...     | ...    | ...   |

### Major Updates (careful — breaking changes expected)
| Package | Current | Latest | Notes |
|---------|---------|--------|-------|
| ...     | ...     | ...    | ...   |
```

If `$ARGUMENTS` specifies a package, focus only on that package.

### Phase 4: Upgrade One at a Time

Process in this order: patches first, then minors, then majors.

For EACH dependency:

1. **Announce** which package is being upgraded and from/to versions
2. **Check changelog/release notes** for breaking changes:
   - Look at the package's GitHub releases or CHANGELOG
   - For major upgrades, summarize breaking changes before proceeding
3. **Upgrade** the single package:
   - npm: `npm install package@latest`
   - yarn: `yarn upgrade package@latest`
   - pnpm: `pnpm update package@latest`
   - bun: `bun update package`
   - uv: `uv lock --upgrade-package package && uv sync`
   - pip: `pip install --upgrade package`
   - cargo: update version in Cargo.toml, then `cargo update -p package`
   - go: `go get package@latest && go mod tidy`
4. **Run tests** immediately
5. **If tests PASS:**
   - Commit: `chore(deps): upgrade [package] from [old] to [new]`
   - Continue to next package
6. **If tests FAIL:**
   - Revert: `git checkout -- .`, then reinstall from the restored lockfile (`npm ci`, `yarn install --frozen-lockfile`, `pnpm install --frozen-lockfile`, `uv sync`) so the installed packages match it again
   - Record the failure reason
   - If it is a minor/patch with failing tests, flag as unexpected
   - Move to the next package

### Phase 5: Summary Report

```
## Dependency Upgrade Report

### Successfully Upgraded
| Package | From | To | Type |
|---------|------|----|------|
| ...     | ...  | ...| patch/minor/major |

### Failed (Reverted)
| Package | From | To | Failure Reason |
|---------|------|----|----------------|
| ...     | ...  | ...| ...            |

### Skipped
| Package | From | To | Reason |
|---------|------|----|--------|
| ...     | ...  | ...| ...    |

### Test Results
- Baseline: [pass/fail]
- Final: [pass/fail]
- Total upgrades attempted: [count]
- Successful: [count]
- Reverted: [count]
```

## Target

$ARGUMENTS

If no target specified, process all outdated dependencies in order of risk (patches first).

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar slash commands

All slash commands for DevOps and infrastructure →

From the same set46

The whole set →
analyzing-projects analyzing-projects walks through an unfamiliar codebase step by step: stack, structure, patterns, dev commands — useful when onboarding onto a project. CX Codex +1 ★ 1,424repo stars plan Creates and maintains a structured PLAN.md file in your project root to track phases, task dependencies, and progress logs. CX Codex +1 ★ 1,424repo stars refactor-guided refactor-guided guides structural refactoring in small steps and runs tests after each change. It keeps feature work separate from code restructuring. CX Codex +1 ★ 1,424repo stars convex-backend convex-backend is a Claude Code skill that loads Convex guidelines for TypeScript functions, schemas, validators, queries, mutations, actions, subscriptions, and file storage. It supports type-safe backend development. CX Codex +1 ★ 1,424repo stars designing-apis designing-apis — a Claude Code skill that designs REST and GraphQL APIs: structures endpoints, defines request and response formats, configures error handling and versioning. CX Codex +1 ★ 1,424repo stars parallel-analyze parallel-analyze starts four subagents at once: architecture, security, performance, testing. Their findings land in one report, ranked by priority. CX Codex +1 ★ 1,424repo stars managing-git managing-git guides Claude Code through Git workflows, branch naming conventions, Conventional Commits formatting, and pull request review checklists. CX Codex +1 ★ 1,424repo stars code-reviewer code-reviewer — a Claude subagent that reads the changed files first, then reports findings by severity: correctness, security, performance, tests. CX Codex ★ 1,424repo stars

Project sponsors

Companies that keep this analytics open