An autonomous agent that identifies CI failures in a PR, rebases branches, and implements necessary code fixes.

Install

mkdir -p .claude/skills/fix-pr && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3917" && unzip -o skill.zip -d .claude/skills/fix-pr && rm skill.zip

Installs to .claude/skills/fix-pr

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Fix a failing PR by analyzing CI logs and fixing errors. Autonomous workflow that identifies failures, rebases, fixes issues, and pushes.
137 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Validate the state of a pull request
  • Identify CI failures using a subagent
  • Checkout and rebase a pull request branch
  • Fix failures based on type (format, lint, build, unit test)
  • Commit and push fixes to the pull request

How it works

The skill validates a PR, delegates CI failure identification to a subagent, rebases the branch, applies fixes based on failure type, runs a quality checklist, and then commits and pushes the changes.

Inputs & outputs

You give it
A pull request number
You get back
A fixed pull request with CI failures resolved and pushed changes

When to use fix-pr

  • Fix CI build failures in a pull request
  • Rebase stale branches automatically
  • Resolve linting or formatting errors
  • Debug failing unit tests in CI

About this skill

Fix Failing PR

Autonomous workflow to fix CI failures for a PR. Delegates failure identification to subagent, then applies fixes.

Usage

/fix-pr 19882

Workflow

Phase 0: Validate PR

Before doing anything, verify the PR is valid:

gh pr view <PR> --repo AztecProtocol/aztec-packages --json state,baseRefName,headRefName

Abort if:

  • state is not OPEN → "PR #<N> is <state>, nothing to fix."

Phase 1: Identify Failures

Spawn the identify-ci-failures subagent:

Use Task tool with subagent_type: "identify-ci-failures"
Prompt: "Identify CI failures for PR <number>"

This returns:

  • Failure type (build/format/lint/unit-test/e2e-test)
  • Test names, hashes, error snippets
  • Local file paths for logs

If the subagent cannot find CI logs, ask the user for:

  • The CI log URL directly
  • Or the CI password if authentication is needed

Phase 2: Checkout and Rebase

gh pr checkout <PR>
git fetch origin <base-branch>
git rebase origin/<base-branch>

If there are conflicts:

  1. Resolve the conflicts
  2. git add <resolved-files>
  3. git rebase --continue

Important: Always REBASE, never merge.

Phase 3: Bootstrap (if needed)

Check if changes exist outside yarn-project:

git diff origin/<base-branch>...HEAD --name-only | grep -v '^yarn-project/'

If yes, run bootstrap:

(cd $(git rev-parse --show-toplevel) && ./bootstrap.sh build yarn-project)

Phase 4: Fix Based on Failure Type

Run from yarn-project directory.

Failure TypeFix Action
FORMATyarn format
LINTyarn lint
BUILDyarn build, fix TypeScript errors, repeat
UNIT TESTyarn workspace @aztec/<package> test <file>, fix, repeat
E2E TESTFor simple failures, fix. For complex failures, suggest /debug-e2e

Phase 5: Quality Checklist

Before committing, run from yarn-project:

yarn build
yarn format
yarn lint

Run tests for modified files:

yarn workspace @aztec/<package> test <file>.test.ts

Phase 6: Commit and Push

If the PR targets next, amend to keep it as a single commit:

git add .
git commit --amend --no-edit
git push --force-with-lease

Otherwise, create a normal commit:

git add .
git commit -m "fix: <description of fix>"
git push

Key Points

  • Validate first: Only fix PRs that are open
  • Delegate identification: Use identify-ci-failures subagent, don't analyze logs directly
  • Rebase, don't merge: Always rebase on the base branch
  • Amend only for PRs targeting next: Other PRs use normal commits
  • Bootstrap when needed: Only if changes outside yarn-project
  • Escalate e2e failures: Complex e2e issues need /debug-e2e

Reference

  • See CLAUDE.md for project conventions
  • See /debug-e2e skill for complex e2e failure analysis

When not to use it

  • When the PR state is not OPEN
  • When complex e2e test failures occur, which require a different skill
  • When direct analysis of CI logs is preferred over subagent delegation

Limitations

  • Aborts if the PR state is not OPEN.
  • Complex e2e test failures are escalated to a different skill.
  • Requires the `identify-ci-failures` subagent for failure identification.

How it compares

This skill automates the entire process of fixing a failing PR, from validation and failure identification to rebase, fixing, and pushing, unlike manual debugging and git operations.

Compared to similar skills

fix-pr side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
fix-pr (this skill)14moReviewIntermediate
resolve-checks16moReviewIntermediate
agent-github-pr-manager16moReviewIntermediate
agent-github-modes16moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry