shopify/fix-broken-major-upgrade
Process a major Dependabot PR: research breaking changes, apply fixes, validate CI
npx skills add https://github.com/Shopify/shopify-app-js --skill fix-broken-major-upgrade
You are orchestrating a major dependency upgrade from a Dependabot PR. The PR URL is:
$ARGUMENTS
Before launching any subagents, set up an isolated worktree so this workflow doesn't disturb the main repo checkout. This enables running multiple upgrade workflows in parallel across different terminal tabs.
gh pr view <number> --json state,headRefName,statusCheckRollup,mergeable to get the PR state, branch name, CI status, and mergeability.state is not OPEN, stop immediately — report that the PR is already merged/closed and there is nothing to do.statusCheckRollup (ignore Changelog, Contributor License Agreement (CLA), and Dependabot auto-merge workflows). CI is passing if every CI workflow check has conclusion of SUCCESS or SKIPPED. git fetch origin <branch> main
WORKTREE hereafter) at /tmp/dependabot-upgrade-pr-<number>: git worktree add /tmp/dependabot-upgrade-pr-<number> -B <branch> origin/<branch>
The -B flag resets the local branch to match origin/<branch>, which handles re-runs cleanly.
pnpm --dir WORKTREE installAll subsequent phases must operate within WORKTREE. Pass this path to every subagent.
All subagents MUST follow these rules to avoid unnecessary permission prompts:
cd <dir> && command. Claude Code is shell-operator aware and will not auto-approve compound commands joined by &&, ||, ;, or |.git -C WORKTREE <subcommand> instead of cd WORKTREE && git <subcommand>.pnpm --dir WORKTREE <subcommand> instead of cd WORKTREE && pnpm <subcommand>.npx --prefix WORKTREE <subcommand>.ls WORKTREE/path (absolute path) instead of cd WORKTREE && ls path.cd-ing first.Read tool over cat. Prefer the Grep tool over shell grep/rg. Prefer the Glob tool over shell find/ls for file searching.&&, ||, or pipes where possible. If you need multiple pieces of information, make multiple parallel tool calls.Execute this workflow in 3 phases using specialized subagents. An optional Conflict Resolver agent may also be needed between Phase 1 and Phase 2. Each phase must complete before the next begins.
Use the Task tool with subagent_type: "general-purpose" and max_turns: 30 to run a Planner agent. Pass it WORKTREE and the mission below.
gh pr view <number> --json title,body,files,headRefName,baseRefName,statusCheckRollup,commits,mergeable and gh pr diff <number>.gh api or WebFetch on https://github.com/<owner>/<repo>/releases)origin/main to be up to date — Phase 0 already fetched it):git merge-base --is-ancestor origin/main HEAD to check if the branch includes the latest main. If not, note how far behind it is.mergeable status from step 1. If it's CONFLICTING, note that the branch has merge conflicts with main that will need to be resolved before code changes.gh pr checks <number>. If checks failed:gh run view <run-id> --log-failedThe planner should NOT make any code changes. Research only.
After the Planner completes, check the plan for merge conflicts.
If the branch has merge conflicts with main, resolve them before proceeding:
origin main and run git merge origin/main in WORKTREE.subagent_type: "general-purpose" and max_turns: 30 to run a Conflict Resolver agent. Pass it WORKTREE and the Planner's analysis for context. Instruct it to:pnpm install to regenerate itgit addgit commit --no-editgit statusIf the branch is clean (no conflicts) or conflicts were successfully resolved, proceed to the breaking change gate.
After the Planner completes, review the plan yourself.
If the plan identifies any consumer-facing breaking changes, do NOT proceed to Phase 2. Instead:
AskUserQuestion tool to ask the user how they want to proceed. Offer options such as:If the upgrade can be completed with no consumer-facing breaking changes, proceed directly to Phase 2.
After passing the gates above, use the Task tool with subagent_type: "general-purpose" and max_turns: 75 to run an Implementer agent. Pass it WORKTREE and the complete plan from Phase 1. The Implementer handles coding, testing, and fixing — all in a single agent context so it can react to test failures with full knowledge of what it changed and why.
.changeset/dependabot-<PR_NUMBER>.md following the existing format in this repo. If this file already exists (from a previous run), overwrite it. The file should contain:patch for internal-only dependency updates, minor or major only if consumer-facing changes were approved)dependency-name from v2 to v3")---\n---).changeset/dependabot-*.md files for reference on the formatpnpm install to ensure dependencies resolve.pnpm build (or whatever build command is used — check package.json scripts).pnpm typecheck or pnpm tsc).pnpm lint to catch linting issues.pnpm test to run the test suite.Once local validation passes:
fix: apply breaking changes for <dep> v<version> upgradegit push origin HEAD)gh pr checks <PR_NUMBER> --watch --fail-level all. Run this with a 10-minute Bash timeout (timeout: 600000). If it times out before CI finishes, re-run the same command to continue waiting. Repeat until CI completes or fails.gh run view <run-id> --log-failedImportant: The Implementer should stick to the plan. If it discovers something unexpected, it should note it but still complete the planned changes. If tests reveal issues not covered in the plan, it should fix them using its own judgment while staying within the scope of the upgrade.
Once the Implementer reports success (CI passing), use the Task tool with subagent_type: "general-purpose" and max_turns: 30 to run a QA Reviewer agent. Give it:
WORKTREE so it can read filesThe QA Reviewer should:
After all phases complete (or if the upgrade was skipped/failed at a gate), present a summary. Use exactly this structured format so that batch tooling can parse the output:
## UPGRADE SUMMARY
- **Status**: COMPLETED | SKIPPED | FAILED
- **PR**: #<number>
- **Dependency**: <name> <old_version> → <new_version>
- **Risk**: high | medium | low
- **Consumer-facing breaking changes**: yes | no
- **Changeset written**: yes | no
### Breaking changes addressed
- <bullet list, or "None">
### Breaking changes requiring attention
- <bullet list, or "None">
### Consumer-facing breaking changes (if SKIPPED)
- <bullet list explaining what would break for consumers and why>
### Files modified
- <file path>: <brief description>
### Test results
- <pass/fail summary, or "Not run" if skipped>
### QA verdict
- <reviewer assessment, or "Not run" if skipped>
### Next steps
- <what the user should do>
Status meanings:
If anything needs manual attention, clearly call it out.
After all phases complete (regardless of status), remove the worktree to free disk space:
git worktree remove /tmp/dependabot-upgrade-pr-<number>
git worktree prune
If the worktree removal fails (e.g., due to uncommitted changes), use git worktree remove --force /tmp/dependabot-upgrade-pr-<number>.
Take shopify/fix-broken-major-upgrade from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, npx.
Without those the skill loads but fails at the first command.