agentleFS
ambient-codeambient-code/platform/skills/pr-fixer/SKILL.md

pr-fixer

Skill131 starsChanged 6 months agoMITView on GitHub

Trigger the Amber Handler to automatically fix a pull request (rebase, address review comments, run lints/tests, push fixes). Posts @ambient-code on the PR to trigger the fix prompt. Use when user types /pr-fixer <number>, says "fix PR", "run pr-fixer", "address PR comments", or "auto-fix pull request".

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check the PR exists and its state:

    line 27
  2. Distinctive:

    If the exit code is non-zero: abort with "PR #N not found in <owner/repo>."

    line 32
  3. Very specific:

    If state is CLOSED or MERGED: abort with "PR #N is already <state>.

    line 33
  4. Very specific:

    Only proceed if state is exactly OPEN.

    line 34
  5. Very specific:

    If PR is from a fork (isCrossRepository: true), warn: "PR #N is from a fork.

    line 35
  6. Distinctive:

    Wait a few seconds for the run to register

    line 43
  7. Distinctive:

    If 30 minutes elapse without completion, notify: "PR Fixer timed out after 30 minutes.

    line 61
  8. Distinctive:

    When the run reaches a terminal state, notify with:

    line 62
  9. Very specific:

    Run conclusion (success/failure/cancelled)

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PR Fixer Skill

Triggers the Amber Handler (amber-issue-handler.yml) to automatically fix a pull request. Posting @ambient-code on a PR triggers the fix prompt, which creates an ACP session that rebases the PR, evaluates reviewer comments (fixes valid issues, responds to invalid ones), runs lints and tests, and pushes the fixes.

Usage

/pr-fixer <pr-number>

The PR number is required. Example: /pr-fixer 1234

What It Does

  1. Validate prerequisites
    • Confirm gh CLI is authenticated (gh auth status)
    • Detect the repo from the local git remote (gh repo view --json nameWithOwner --jq .nameWithOwner)
  2. Pre-flight PR check
    • Check the PR exists and its state:
      gh pr view <N> --repo <owner/repo> --json state,isCrossRepository --jq '{state, isCrossRepository}'
    • gh pr view returns state in uppercase: OPEN, CLOSED, or MERGED. A non-zero exit code (with stderr error) means the PR does not exist.
    • If the exit code is non-zero: abort with "PR #N not found in <owner/repo>."
    • If state is CLOSED or MERGED: abort with "PR #N is already <state>. Nothing to fix." (use the actual uppercase value returned)
    • Only proceed if state is exactly OPEN.
    • If PR is from a fork (isCrossRepository: true), warn: "PR #N is from a fork. The Amber Handler skips fork PRs. Push the branch to the org repo and re-open the PR, or fix locally."
  3. Trigger the fix
    gh pr comment <N> --repo <owner/repo> --body "@ambient-code"
  4. Locate the triggered run
    • Wait a few seconds for the run to register
    • Find it via:
      gh run list --workflow=amber-issue-handler.yml --repo <owner/repo> --limit 5 --json databaseId,status,createdAt,event
    • Match the most recent issue_comment-triggered run created after the comment
  5. Print the run URL immediately so the user has it:
    PR Fixer dispatched for PR #<N>
    Run: https://github.com/<owner/repo>/actions/runs/<run-id>
    PR:  https://github.com/<owner/repo>/pull/<N>
    
    Monitoring in background — you'll be notified when it completes.
  6. Spawn a background agent to monitor the run (30-minute timeout):
    • Poll gh run view <run-id> --repo <owner/repo> --json status,conclusion every 30 seconds
    • If 30 minutes elapse without completion, notify: "PR Fixer timed out after 30 minutes. Check the run manually."
    • When the run reaches a terminal state, notify with:
      • Run conclusion (success/failure/cancelled)
      • Session name and phase (parse from gh run view <run-id> --repo <owner/repo> --json jobs — look for the "Session summary" step output)
      • Whether commits were pushed (check gh pr view <N> --repo <owner/repo> --json commits count before and after)
      • Links to the GHA run and the PR

Error Handling

  • No PR number provided: Print usage: /pr-fixer <pr-number>
  • gh not authenticated: "Error: GitHub CLI is not authenticated. Run gh auth login first."
  • Fork PR detected: "Warning: PR #N is from a fork. The Amber Handler skips fork PRs. Push the branch to the org repo and re-open the PR, or fix locally."
  • Run not found after dispatch: "Warning: Could not locate the triggered run. Check manually: https://github.com/<owner/repo>/actions/workflows/amber-issue-handler.yml"
  • All session steps skipped: The Amber Handler's fix steps have conditions (non-fork, correct prompt type). If steps are skipped, check the run logs for why.

When to Invoke This Skill

Invoke when users say things like:

  • "/pr-fixer 1234"
  • "Fix PR 1234"
  • "Run the PR fixer on 1234"
  • "Trigger pr-fixer for PR #1234"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.