Skip to content
Agent loop · Build & CI

Dependency Upgrades Until Green

Upgrade outdated packages one at a time, run the tests after each bump, and revert anything that breaks, so every upgrade in the batch is known good.

Up to 15 iterationsStop rules and safety limits
The prompt

Copy the Dependency Upgrades Until Green loop

Stops when every outdated package is either upgraded with passing tests or listed as blocked, or after 15 iterations. Edit the settings block, then paste the whole prompt into your agent.

dependency-upgrades-until-green.prompt.md
You are running the "Dependency Upgrades Until Green" loop.

Settings (edit before running):
- Outdated command: npm outdated
- Install command: npm install
- Check command: npm run build && npm test
- Include major versions: no
- Max upgrades attempted: 15

Goal: upgrade as many outdated packages as possible while keeping the check command green.

Before the loop: run the check command once. If it already fails, stop and report, because results would be meaningless.

Each iteration:
1. Pick the next package from the outdated list. Do patch and minor upgrades first, majors only if enabled above. Move packages that must change together (for example a framework and its type definitions) as one unit.
2. Upgrade it to the newest allowed version and run the install command.
3. Run the check command.
4. If it passes, keep the change. If it fails, read the release notes or changelog and attempt one small fix. If it still fails, revert the package and lockfile changes for this upgrade.
5. Log: package, old version, new version, result (kept, fixed, reverted) and the reason.

Stop when:
- Every outdated package has been tried. Success.
- You reach the max number of upgrades attempted.

Rules:
- Upgrade one unit at a time. Never run a bulk "upgrade everything" command.
- Do not add new dependencies, remove existing ones, or change version ranges for packages you are not upgrading.
- Do not edit or delete tests to make an upgrade pass.
- Keep the lockfile in sync with the manifest after every step.

Final report: a table of kept, fixed, and reverted upgrades, plus the migration notes for each reverted one.
When to use it

When this loop fits

  • Your dependencies are months behind and a single bulk upgrade would break too much to debug.
  • Automated update pull requests keep failing and nobody has time to triage them one by one.
  • You want a record of which upgrades are safe and which need real migration work.
How it works

What happens on each pass

The agent repeats these steps until the stop condition holds or it runs out of iterations.

  1. List what is outdated. Run the package manager's outdated command and sort the list so patch and minor bumps come before majors.
  2. Upgrade one package. Bump a single package, or a set that must move together, and reinstall.
  3. Run the checks. Run the build and test suite against the upgrade.
  4. Keep or revert. Keep the upgrade if everything passes. Otherwise try one small migration fix, and revert if the checks still fail.
  5. Record and continue. Log the result with the old and new versions, then move to the next package.
Recommended servers

MCP servers for this loop

The 6 strongest of 889 matching servers, ranked by how closely they fit and then by trust score.

More in Developer tools
  • Trust score 71 of 100, Good

    npm registry MCP server — package intelligence, security audits, dependency analysis

    Registry
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 23 days ago.
    2 stars156/wk weekly downloads— tools
  • Trust score 67 of 100, Good

    Npm

    by pipeworx-io · TypeScript

    npm MCP — wraps the npm Registry API (free, no auth)

    RegistryRemote
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 10 days ago.
    0 stars28/wk weekly downloads— tools
  • Trust score 67 of 100, Good

    Pypi

    by pipeworx-io · JavaScript

    PyPI MCP — wraps the Python Package Index (PyPI) JSON API (free, no auth).

    RegistryRemote
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 9 days ago.
    0 stars34/wk weekly downloads— tools
  • transports logo
    Trust score 58 of 100, Fair

    transports

    by webmcp-org · TypeScript

    Browser transport implementations for Model Context Protocol (MCP) - postMessage, Chrome extension messaging, and iframe communication for…

    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: B. 70/100 for listing completeness. Lost points: no listed tools.Maintenance: A. Last commit or release 13 days ago.
    105 stars217.8K/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Local-first MCP server for LLM output verification — risk signals, injection and PII checks.

    Registry
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Production security for Node.js apps: investigate live attacks, block IPs, tune detections.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
Run it

How to run this loop

  1. Connect the tools. Install a server the loop can use, for example npm Registry MCP Server, or rely on your agent's built-in terminal and file access.
  2. Edit the settings block. Replace the example commands, targets, and limits with your project's own. Keep the iteration cap low on the first run.
  3. Paste it into an agent session. Start a fresh session in Claude Code, Cursor, or VS Code agent mode, in the repository root, and paste the prompt.
  4. Review before you merge. Read the final report and the diff. The loop leaves its work for you to review rather than shipping it.
FAQ

Dependency Upgrades Until Green questions

When does the Dependency Upgrades Until Green loop stop?

It stops as soon as every outdated package is either upgraded with passing tests or listed as blocked. It also stops after 15 iterations by default, or earlier when the prompt's own stop rules say it is stuck, and then reports what changed and what is left. Change the cap in the settings block at the top of the prompt.

Should the loop attempt major version upgrades?

Start without them. Patch and minor upgrades should be backwards compatible, so the loop clears most of the backlog quickly. Run it again with majors enabled once the easy upgrades are in, so each breaking change is isolated and easier to review.

Why upgrade one package at a time instead of all at once?

When ten packages move together and a test breaks, you cannot tell which one caused it. One upgrade per pass makes every failure attributable, every revert clean, and the final diff easy to split into separate commits if you prefer.

Keep exploring
All loops