Update Dependencies
Update Ruby gems and JavaScript dependencies safely.
This skill supports three modes:
- Update specific dependencies.
- Update all outdated Ruby gems.
- Update all outdated JavaScript packages.
The workflow is conservative by default: establish a baseline, review upstream changes before editing dependencies, prefer incremental updates when risk is high, and verify the result with tests.
When to Use
- The user asks to update a Ruby gem, npm package, or a mix of both.
- The user wants help checking whether a dependency update is safe.
- The user wants changelog-aware dependency updates instead of a blind
bundle update or npm update.
Trigger Patterns
Activate this skill when the user says things like:
- "update rails"
- "update all outdated gems"
- "update all outdated npm packages"
- "run bundle update safely"
- "check which dependencies can be upgraded"
Inputs
- One dependency name, or a list of names.
- Or an instruction to update all outdated dependencies.
- Optional version constraints or upgrade targets.
If the request is ambiguous, clarify whether the user wants:
- Ruby gems, npm packages, or both.
- One dependency only.
- Several named dependencies.
- Every outdated dependency.
Procedure
Identify the requested scope.
- Determine whether the user wants Bundler updates, npm updates, or both.
- If the user named one dependency, update only that dependency unless they explicitly ask for related packages too.
- If the user asked for all outdated dependencies, inspect outdated lists first and separate high-risk upgrades from low-risk ones.
Establish a baseline before changing dependencies.
- Inspect the working tree and avoid overwriting unrelated user changes.
- Check the current dependency state with Bundler and/or npm based on requested scope.
- Record the currently locked version and the requested target if one was provided.
- If the project already has failing tests, note that before updating so regressions can be attributed correctly.
- Use
bundle outdated for Ruby and npm outdated for JavaScript.
- Run
npm install before npm outdated to ensure the lockfile is up to date.
Review upgrade risk before running update commands.
- Read changelog, releases, upgrade guide, or release notes for each dependency and version jump being crossed.
- For gems, watch for dropped Ruby or Rails support, generator changes, and native extension requirements.
- For npm packages, watch for dropped Node/browser support, module format changes (ESM/CJS), renamed exports, build tool changes, and required config updates.
- Prefer official sources first. Use the guidance in changelog and testing.
- Summarize the relevant breaking changes before modifying files.
Choose the update strategy.
- Ruby gems:
- For a single gem, prefer
bundle update GEM_NAME.
- For several explicitly named gems, update only that set.
- npm packages:
- For one package to newest version, use
npm install PACKAGE@latest (or --save-dev for dev dependencies).
- For many packages in one category, use targeted install commands instead of a blind bulk update when risk is high.
- Use
npm update only when the user wants in-range updates constrained by current semver ranges.
- For all outdated dependencies:
- Prefer incremental or grouped updates when there are major version bumps or updates to framework-level gems, build tooling, or core frontend libraries.
- If the user explicitly wants one bulk pass, proceed, but still call out high-risk updates first.
- Do not edit unrelated dependency constraints unless needed for the requested upgrade.
Apply the update.
- Update the requested gem set with Bundler and/or npm.
- If the Ruby upgrade includes
rails, run bin/rails app:update after Bundler finishes, then review and reconcile the generated file changes before continuing.
- If the Ruby upgrade includes
good_job, run bin/rails generate good_job:update after Bundler finishes, then review and reconcile the generated file changes before continuing.
- Review
Gemfile.lock and package-lock.json diffs plus transitive dependency changes.
- If either Bundler or npm resolves to a surprising set of additional upgrades, explain that and decide whether to continue or narrow the update.
Verify the update incrementally.
- Run targeted tests for the directly affected area when the impacted subsystem is clear.
- Then run the project's standard verification command.
- In this repository, prefer:
bin/rails test <file> -n '/test name/' for targeted checks.
bin/rails test <file> for focused file-level verification.
bin/rails test for broader validation.
bin/rubocop <file> for files changed as part of the update when linting is relevant.
npm run eslint-all for JavaScript linting after npm updates.
npm run stylelint-all for stylesheet linting after npm updates.
- If updating all outdated gems, escalate from targeted tests to a broader suite before calling the work complete.
- If updating all outdated npm packages, escalate from targeted checks to broader JS and app verification before calling the work complete.
Handle failures explicitly.
- If tests fail after the update, inspect the failures and determine whether they are caused by the dependency change.
- If the root cause is clear and within scope, fix compatibility issues and rerun verification.
- If the failures point to a breaking change that requires product or design decisions, stop and report the blocker clearly.
- Do not claim success while post-update tests are failing.
Report the result.
- List which dependencies changed and the before and after versions.
- Summarize important changelog findings and any breaking changes reviewed.
- Link to the relevant changelog entries, upgrade guides, release notes, or security advisories.
- Report which tests were run and whether they passed.
- Call out residual risks, follow-up work, or upgrades intentionally deferred.
Decision Rules
- Apply release-age gates unless the release is explicitly a security fix:
- Minor version updates: wait at least 7 days after the initial minor release.
- Major version updates: wait until the first point release (for example,
2.0.1) is available.
- If a release is a security fix, the waiting rules above do not apply; proceed with normal risk review and verification.
- If a dependency jump crosses a major version, treat it as high risk until changelog review says otherwise.
- If multiple framework gems or major frontend/build packages are outdated, avoid doing them all at once unless the user explicitly wants a bulk upgrade.
- If changelog information cannot be found, say so and treat the update as higher risk.
- If baseline tests already fail, report that clearly before using test failures as evidence against the upgrade.
- If an update requires a multi-step migration (Rails or frontend tooling), break the work into smaller hops instead of forcing a single large jump.
Stop Conditions
Stop and ask the user before continuing if:
- The request is ambiguous about which dependency ecosystem to update (Ruby, npm, or both).
- A requested non-security update does not meet the release-age gate yet (minor is less than 7 days old, or major has no first point release).
- The update pulls in unexpected high-risk dependency changes.
- The work tree is not clean and the update would overwrite unrelated user changes.
- Changelog review reveals a breaking migration that needs product-level decisions.
- The project has pre-existing failing tests that make regression attribution unclear.
Completion Checks
- Only the intended gem or gem set was updated.
- Only the intended dependency set was updated.
- If
rails was upgraded, bin/rails app:update was run and the generated config changes were reviewed.
- Relevant changelogs or release notes were reviewed and summarized.
Gemfile.lock and/or package-lock.json changes were inspected.
- Post-update tests were run.
- Any new failures were either fixed or reported clearly as blockers.
- Final output includes changed dependencies, links to changelogs, notable risks or potential breaking changes, and verification results.
References
1---2name: update-dependencies3description: Update Ruby gems or JavaScript packages. Use for upgrading one or all outdated dependencies with Bundler or npm, reviewing changelogs and breaking changes, and running verification after dependency updates.4---56# Update Dependencies78Update Ruby gems and JavaScript dependencies safely.910This skill supports three modes:1112- Update specific dependencies.13- Update all outdated Ruby gems.14- Update all outdated JavaScript packages.1516The workflow is conservative by default: establish a baseline, review upstream changes before editing dependencies, prefer incremental updates when risk is high, and verify the result with tests.1718## When to Use1920- The user asks to update a Ruby gem, npm package, or a mix of both.21- The user wants help checking whether a dependency update is safe.22- The user wants changelog-aware dependency updates instead of a blind `bundle update` or `npm update`.2324## Trigger Patterns2526Activate this skill when the user says things like:2728- "update rails"29- "update all outdated gems"30- "update all outdated npm packages"31- "run bundle update safely"32- "check which dependencies can be upgraded"3334## Inputs3536- One dependency name, or a list of names.37- Or an instruction to update all outdated dependencies.38- Optional version constraints or upgrade targets.3940If the request is ambiguous, clarify whether the user wants:4142- Ruby gems, npm packages, or both.43- One dependency only.44- Several named dependencies.45- Every outdated dependency.4647## Procedure48491. Identify the requested scope.50 - Determine whether the user wants Bundler updates, npm updates, or both.51 - If the user named one dependency, update only that dependency unless they explicitly ask for related packages too.52 - If the user asked for all outdated dependencies, inspect outdated lists first and separate high-risk upgrades from low-risk ones.53542. Establish a baseline before changing dependencies.55 - Inspect the working tree and avoid overwriting unrelated user changes.56 - Check the current dependency state with Bundler and/or npm based on requested scope.57 - Record the currently locked version and the requested target if one was provided.58 - If the project already has failing tests, note that before updating so regressions can be attributed correctly.59 - Use `bundle outdated` for Ruby and `npm outdated` for JavaScript.60 - Run `npm install` before `npm outdated` to ensure the lockfile is up to date.61623. Review upgrade risk before running update commands.63 - Read changelog, releases, upgrade guide, or release notes for each dependency and version jump being crossed.64 - For gems, watch for dropped Ruby or Rails support, generator changes, and native extension requirements.65 - For npm packages, watch for dropped Node/browser support, module format changes (ESM/CJS), renamed exports, build tool changes, and required config updates.66 - Prefer official sources first. Use the guidance in [changelog and testing](./references/changelog-and-testing.md).67 - Summarize the relevant breaking changes before modifying files.68694. Choose the update strategy.70 - Ruby gems:71 - For a single gem, prefer `bundle update GEM_NAME`.72 - For several explicitly named gems, update only that set.73 - npm packages:74 - For one package to newest version, use `npm install PACKAGE@latest` (or `--save-dev` for dev dependencies).75 - For many packages in one category, use targeted install commands instead of a blind bulk update when risk is high.76 - Use `npm update` only when the user wants in-range updates constrained by current semver ranges.77 - For all outdated dependencies:78 - Prefer incremental or grouped updates when there are major version bumps or updates to framework-level gems, build tooling, or core frontend libraries.79 - If the user explicitly wants one bulk pass, proceed, but still call out high-risk updates first.80 - Do not edit unrelated dependency constraints unless needed for the requested upgrade.81825. Apply the update.83 - Update the requested gem set with Bundler and/or npm.84 - If the Ruby upgrade includes `rails`, run `bin/rails app:update` after Bundler finishes, then review and reconcile the generated file changes before continuing.85 - If the Ruby upgrade includes `good_job`, run `bin/rails generate good_job:update` after Bundler finishes, then review and reconcile the generated file changes before continuing.86 - Review `Gemfile.lock` and `package-lock.json` diffs plus transitive dependency changes.87 - If either Bundler or npm resolves to a surprising set of additional upgrades, explain that and decide whether to continue or narrow the update.88896. Verify the update incrementally.90 - Run targeted tests for the directly affected area when the impacted subsystem is clear.91 - Then run the project's standard verification command.92 - In this repository, prefer:93 - `bin/rails test <file> -n '/test name/'` for targeted checks.94 - `bin/rails test <file>` for focused file-level verification.95 - `bin/rails test` for broader validation.96 - `bin/rubocop <file>` for files changed as part of the update when linting is relevant.97 - `npm run eslint-all` for JavaScript linting after npm updates.98 - `npm run stylelint-all` for stylesheet linting after npm updates.99 - If updating all outdated gems, escalate from targeted tests to a broader suite before calling the work complete.100 - If updating all outdated npm packages, escalate from targeted checks to broader JS and app verification before calling the work complete.1011027. Handle failures explicitly.103 - If tests fail after the update, inspect the failures and determine whether they are caused by the dependency change.104 - If the root cause is clear and within scope, fix compatibility issues and rerun verification.105 - If the failures point to a breaking change that requires product or design decisions, stop and report the blocker clearly.106 - Do not claim success while post-update tests are failing.1071088. Report the result.109 - List which dependencies changed and the before and after versions.110 - Summarize important changelog findings and any breaking changes reviewed.111 - Link to the relevant changelog entries, upgrade guides, release notes, or security advisories.112 - Report which tests were run and whether they passed.113 - Call out residual risks, follow-up work, or upgrades intentionally deferred.114115## Decision Rules116117- Apply release-age gates unless the release is explicitly a security fix:118 - Minor version updates: wait at least 7 days after the initial minor release.119 - Major version updates: wait until the first point release (for example, `2.0.1`) is available.120- If a release is a security fix, the waiting rules above do not apply; proceed with normal risk review and verification.121- If a dependency jump crosses a major version, treat it as high risk until changelog review says otherwise.122- If multiple framework gems or major frontend/build packages are outdated, avoid doing them all at once unless the user explicitly wants a bulk upgrade.123- If changelog information cannot be found, say so and treat the update as higher risk.124- If baseline tests already fail, report that clearly before using test failures as evidence against the upgrade.125- If an update requires a multi-step migration (Rails or frontend tooling), break the work into smaller hops instead of forcing a single large jump.126127## Stop Conditions128129Stop and ask the user before continuing if:130131- The request is ambiguous about which dependency ecosystem to update (Ruby, npm, or both).132- A requested non-security update does not meet the release-age gate yet (minor is less than 7 days old, or major has no first point release).133- The update pulls in unexpected high-risk dependency changes.134- The work tree is not clean and the update would overwrite unrelated user changes.135- Changelog review reveals a breaking migration that needs product-level decisions.136- The project has pre-existing failing tests that make regression attribution unclear.137138## Completion Checks139140- Only the intended gem or gem set was updated.141- Only the intended dependency set was updated.142- If `rails` was upgraded, `bin/rails app:update` was run and the generated config changes were reviewed.143- Relevant changelogs or release notes were reviewed and summarized.144- `Gemfile.lock` and/or `package-lock.json` changes were inspected.145- Post-update tests were run.146- Any new failures were either fixed or reported clearly as blockers.147- Final output includes changed dependencies, links to changelogs, notable risks or potential breaking changes, and verification results.148149## References150151- [Changelog and testing](./references/changelog-and-testing.md)152- [Upgrading Ruby on Rails](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html)