Automated Dependency Upgrade and Rollback Protocol

Generate a safe, step-by-step dependency upgrade plan that includes strict semver validation, lockfile parity checks, and automated rollback triggers.

Agent prompt for ChatGPT

Prompt

Prompt
You are a Senior DevOps Engineer. Create a safe dependency upgrade plan for a software project. First, ask these 3 questions: 1. What is the name of the package and the current vs. target version? 2. Is this a minor, patch, or major upgrade? 3. What is the primary build tool or package manager used? Once I answer, provide the plan following these rules: 1. List specific commands to verify current dependencies before changes. 2. Define strict semver boundaries to identify breaking changes. 3. Include a command to verify lockfile integrity post-update. 4. Provide a clear rollback checklist if downstream test suites fail. Output format: ## Pre-Upgrade Audit ## Upgrade Steps ## Post-Upgrade Verification ## Rollback Criteria. This guide is for technical guidance and does not replace your own security or regression testing.

Example output

Example for: Updating lodash from 4.17.15 to 4.17.21 in a Node.js project.

Pre-Upgrade Audit

  1. Run npm list lodash to confirm the current installed version and dependency tree.
  2. Execute npm audit to identify existing vulnerabilities that the upgrade might address.
  3. Create a snapshot of package-lock.json to ensure you can revert to the exact known-good state.

Upgrade Steps

  1. Run npm install lodash@4.17.21 to update the package.
  2. Run npm shrinkwrap to lock the dependency tree if using older versions or npm dedupe to optimize.
  3. Verify the change in package.json by running cat package.json | grep lodash.

Post-Upgrade Verification

  1. Run npm test to execute the full suite of downstream unit tests.
  2. Check for any unexpected changes in package-lock.json using git diff package-lock.json.
  3. Run a smoke test on the main entry point to ensure the package initializes correctly.

Rollback Criteria

  1. If npm test returns a non-zero exit code, immediately stop deployment.
  2. If the application throws runtime errors related to lodash functions, revert using git checkout package.json package-lock.json.
  3. Run npm install to restore the previous state based on the reverted lockfile.
  4. Re-run tests to confirm the system is back to the last stable baseline.
Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a pre-upgrade audit to establish a baseline state.
  • Categorizes steps to prevent accidental breaking changes.
  • Requires a defined rollback path for every upgrade action.

Use this prompt when you need to update critical infrastructure or application dependencies without breaking production environments. Works best in ChatGPT or Claude to generate a safe execution path before running commands in your terminal.

Common edits

  • Add specific test framework commands if you use Jest or Cypress.
  • Include additional steps for CI/CD pipeline integration if needed.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Codex

Draft Security Guardrails for AGENTS.md Configuration

Generate a robust security policy for AGENTS.md to restrict dangerous shell operations, credential access, and destructive commands in automated environments.

AI Coding AgentsClaude Code

Design a Sandbox Security Policy for Autonomous Coding Agents

Generate a rigorous security policy for autonomous agents to define allowed shell commands, file access boundaries, and network restrictions.

AI Coding AgentsClaude Code

Create Automated Verification Loops for Long-Running Coding Agents

Generate a deterministic shell pipeline that combines linting, isolated unit testing, and diff-budget monitoring to validate AI agent code changes.

Create Selective Pre-Commit Hooks for Claude Code

This prompt generates a bash script that triggers specific tests and typechecks only for packages modified in your current git branch.

AI Coding AgentsClaude Code

Generate Reproducible Bug Fix Specs for Coding Agents

Get a standalone reproduction test script and a precise technical plan to fix a bug, ensuring your AI agent stays focused and avoids unnecessary file changes.

Headless Claude Code Script for CI: claude -p Task With Exit Codes and Output Checks

Writes a CI step that runs Claude Code non-interactively with claude -p, scoped tools, a turn limit and JSON output, and fails safely on errors, with a dry-run mode and secrets kept out of the repo.