upgrade-dependencies-pr
Upgrade Dependencies PR
Use this skill to take a JavaScript, TypeScript, or Python repository from outdated dependencies to a reviewable dependency-upgrade PR in one pass.
Preconditions
- Confirm the repository uses Git and GitHub, and that
ghis authenticated before attempting issue or PR creation. - Stop if the working tree contains unrelated user changes that would be risky to mix into the dependency branch.
- Detect the ecosystem and package manager from tracked manifests, lockfiles, and workspace config before changing anything.
- Read references/package-manager-playbook.md after detection and use only the relevant section.
Workflow
1. Inventory the project
- Find the tracked dependency manifests that actually govern this repo. For JS/TS, inspect
package.jsonfiles plus lockfiles and workspace config. For Python, inspectpyproject.toml,uv.lock,requirements*.in,requirements*.txt,constraints*.txt,setup.cfg, andsetup.py. - Identify whether the repo is JS/TS, Python, or mixed. Do not reject a repo just because there is no root
package.json; use the manifests that are actually present. - Record the current branch, package manager, lockfiles, workspace layout, and available validation commands such as
typecheck,lint,test,test:unit,build,pytest,ruff,mypy, and project-specific CI entrypoints. - Flag framework- or runtime-critical packages first: frameworks, bundlers, test runners, linters, TypeScript, Node tooling, auth, database clients, SDKs, deployment libraries, Python web frameworks, ORMs, packaging/build backends, and lint/type-check tooling.
2. Create the branch first
- Create a fresh branch before editing anything. Prefer
codex/deps-<project>-<yyyymmdd>unless the repo already uses a different branch convention. - Keep the branch scoped to dependency maintenance and directly related upgrade fallout.
3. Upgrade manifests and lockfiles
- Use the package-manager-specific commands from the reference file to move direct dependencies to their latest published versions.
- For JS/TS manifests, update entries in
dependencies,devDependencies,optionalDependencies, andpeerDependencieswhen the manifest owns those versions. Preserveworkspace:,file:,link:,portal:,catalog:, git, URL, and alias specs unless there is a clear reason to change them. - For Python manifests, update dependency declarations in
project.dependencies, optional-dependency groups, tool-managed dependency groups,requirements*.in,requirements*.txt, andconstraints*.txtonly when those files are repo-owned sources of truth. - Prefer
uvfor clearly uv-managed repos (uv.lock,tool.uv, or an establisheduvworkflow). Forrequirements.in/ compiledrequirements.txtrepos, reuse the repo's existing compiler workflow withuv pip compileorpip-compileif present. For hand-maintainedrequirements.txtrepos, update the tracked requirement specifiers directly, then re-install or sync with the repo's existing tool. - Preserve editable installs, local paths, VCS requirements, direct URLs, workspace links, and generated file headers unless there is a concrete reason to change them.
- After the main JS/TS upgrade step, run
node <skill-dir>/scripts/unpin-semver-ranges.mjs <repo-root>to convert exactx.y.zspecs and any straylatesttags into ranged versions like^1.2.3. If it updates any manifest, re-run the package manager install or update step so the lockfiles match. - After the final JS/TS install or update pass, run
node <skill-dir>/scripts/check-no-latest-specifiers.mjs <repo-root>. Do not proceed until it reports that no trackedpackage.jsonor lockfile still containslatest. - If a JS/TS upgrade introduces peer-dependency warnings or peer-range mismatches, especially around framework, compiler, or toolchain major versions, do not immediately roll the package back. Keep the latest candidate installed long enough to run validation unless the package manager refuses to install or the repo has an explicit no-peer-warning policy.
- Do not leave exact pinned JS semver strings in
package.jsonfiles unless the repo explicitly requires exact versions and the user asked to keep them. For Python, preserve the repo's existing pinning strategy unless the user asked to loosen it.
4. Assess relevance before writing the summary
- Compare manifests and lockfiles before and after the upgrade to get the set of changed packages.
- For each changed package that has a major bump, is runtime-critical, or is used directly in code or config, inspect official changelogs, migration guides, or release notes. Use primary sources only.
- Search the codebase for actual package usage before deciding whether a release is relevant to this project.
- For each package you inspect, explicitly look for newly introduced features, changed defaults, deprecations that became warnings or errors, and new enforced lint, type, compiler, formatting, security, or policy rules. Do not stop at obvious breakages.
- Every relevant new item you identify must end in one of two states before the PR is opened: adopted in the PR, or tracked in a follow-up GitHub issue with a concrete reason it was deferred.
- Classify relevance as one of:
- required compatibility work to keep the repo green,
- small project-specific cleanup worth doing in the same PR,
- optional follow-up or new feature worth tracking separately.
5. Fix required fallout now
- Apply compatibility fixes that are necessary for installs, builds, tests, or runtime correctness.
- Also apply very small project-relevant cleanup directly when it is obvious and low risk.
- If an upgrade introduces a new enforced lint, type, compiler, formatting, security, or policy rule, do not silently disable it just to keep the PR small. Either adopt the rule in this PR, or keep any suppression narrowly scoped and clearly temporary while creating a follow-up issue that names the deferred repo-wide work.
- Keep fixes tightly coupled to the upgrade. Avoid unrelated refactors.
6. Create follow-up issues for larger or optional work
- Open a GitHub issue when an upgrade reveals a useful new feature worth adopting later, a migration that is too large for the dependency PR, or cleanup that would materially expand review scope.
- Open a GitHub issue when an upgrade introduces a new rule, policy, or default that is relevant to this repo but would cause broad churn to adopt fully in the dependency PR.
- Also open a GitHub issue when the latest version appears viable in code but is still blocked by upstream peer-range declarations or ecosystem support policy, and the dependency PR intentionally holds that package back.
- Use
gh issue create. - The issue body should name the package and version jump, explain why it matters to this repo, summarize the deferred work, call out any temporary suppression or scope limitation left in the PR, and link the official source material plus the upgrading PR when available.
- Do not create issues for noise. File issues only when the package change is genuinely relevant to the project.
7. Verify aggressively
- Run the smallest complete validation set the repo supports. Prefer the repo's documented CI entrypoint when present. Otherwise use the relevant subset of:
typecheck,lint,test,test:unit,build,pytest,ruff check,mypy,pyright. - If the repo has a documented CI entrypoint, use it.
- For JS/TS repos, treat any remaining
latestspecifier in a tracked manifest or lockfile as a failed verification and fix it before committing. - If the only blocker is a peer warning or peer-range mismatch, run the full relevant validation suite against the upgraded version before deciding whether to keep or revert it.
- If that validation passes, make an explicit decision: either keep the upgraded version despite the warning and document the unsupported-peer state in the PR, or revert it, pin to the highest clearly supported version, and file a follow-up issue describing the upstream blocker and why the repo is intentionally one version behind.
- If validation fails and the failure is attributable to the unsupported upgrade, revert to the highest clearly supported version and document that decision.
- If an upgrade breaks validation, fix it if the remediation is required to keep the repository healthy. Do not ship a knowingly broken dependency PR.
- Before committing, confirm that newly introduced features, defaults, and enforced rules discovered during release-note review were either adopted in the PR or captured in follow-up issues. Do not leave them undocumented.
8. Commit, push, and open the PR
- Stage only the dependency upgrade work and directly related fixes.
- Use a commit title like
chore(deps): upgrade dependencies to latest. - Push the branch and create a PR with
gh pr create. - Make the PR body include notable package upgrades, required code or config fixes, issues created for deferred relevant work, the validation commands that were run, and any intentionally held-back packages with the reason.
- If the PR leaves a temporary suppression or narrow opt-out for a new lint, type, compiler, formatting, security, or policy rule, say so explicitly in the PR body and link the follow-up issue.
- Respect existing issue or PR templates when present.
Decision Rules
- Prefer primary documentation over blog posts or secondary summaries for release impact.
- Required compatibility work belongs in the PR. Optional adoption work belongs in an issue.
- Newly introduced features, defaults, and policy/rule changes must be explicitly triaged. Do not silently ignore them just because validation passes.
- Peer-dependency warnings are not an automatic rollback. Treat them as a compatibility signal that requires validation and an explicit keep-or-revert decision.
- When a package only fails declared peer support but passes validation, either keep it with clear PR documentation or revert it and file an issue documenting the upstream blocker. Do not silently hold it back.
- If a new enforced lint, type, compiler, formatting, security, or policy rule would cause broad repo churn, either implement it in the PR or leave only a clearly temporary, narrowly scoped suppression and file an issue for the remaining work. Never add a silent permanent disable.
- Never leave JS/TS
latesttags in tracked manifests or lockfiles. Convert them back to explicit semver ranges such as^1.2.3, regenerate the lockfiles, and verify they are gone before opening the PR. - If the repo is Python, support
uv,pip, and existingpip-toolsstyle compile/sync workflows instead of rejecting it as non-JS. - If the repo is mixed-language, use the manifests that are actually in scope for the requested upgrade instead of assuming the root ecosystem.
- Stop only if the repo is neither JS/TS nor Python, or if it uses dependency tooling that this skill does not yet support cleanly.
- If GitHub auth, push access, or PR creation is unavailable, finish the local upgrade work and report the blocker clearly.
Scripts
scripts/unpin-semver-ranges.mjs
Normalize exact semver strings and stray latest tags in package.json files to caret ranges while preserving workspace, file, git, URL, alias, and already-ranged specs. Use this only for JS/TS manifests.
Usage:
node /absolute/path/to/upgrade-dependencies-pr/scripts/unpin-semver-ranges.mjs /path/to/repo
scripts/check-no-latest-specifiers.mjs
Fail fast when a tracked JS/TS manifest or lockfile still contains latest after the upgrade flow. Run this after the final install or update pass.
Usage:
node /absolute/path/to/upgrade-dependencies-pr/scripts/check-no-latest-specifiers.mjs /path/to/repo
References
- Use references/package-manager-playbook.md for package-manager-specific upgrade commands.
- Use official package changelogs or migration guides for impact assessment.
More from uwe-schwarz/skills
github-pr-review-workflow
Complete workflow for handling GitHub PR reviews using gh pr-review extension
40coderabbit-review
Perform code review using CodeRabbit. Must use this skill if instructed to perform a CodeRabbit review.
9documentation
Automated documentation generation and management. Use for creating, updating, and maintaining project documentation including README files, API docs, and inline code comments.
8example-skill
An example skill demonstrating the Agent Skills format. Use this as a template for creating your own skills.
8code-review
Comprehensive code review guidelines for ensuring code quality, security, and maintainability. Use when reviewing pull requests, refactoring code, or ensuring best practices.
8cost-estimate
Estimate the replacement cost, engineering effort, calendar time, and market-rate value of a software project by analyzing a repository's size, architecture, complexity, and delivery maturity. Use when asked for a build-cost estimate, rebuild quote, delivery timeline, stakeholder-facing budget range, pricing sanity check, or ROI/value analysis for work produced by Claude, Codex, OpenCode, Crush, or another AI coding agent.
1