agentleFS
mick-gskmick-gsk/drift/.github/skills/drift-pr-review-loop/SKILL.md

drift-pr-review-loop

Skill14 starsChanged 7 months agoMITView on GitHub

Drives a GitHub PR through an automated agent review loop using drift pr-loop. Covers preconditions, command usage, exit code interpretation, escalation handling, and dry-run workflows. Trigger words: pr-loop, review loop, agent review, automated review, PR review loop Before running drift pr-loop, verify: When exit code is 1 (ESCALATED): - A PR comment has been posted listing all unresolved comments/verdicts - The state file is saved to work_artifacts/pr-loop-<PR_NUMBER>.json - Do not force-merge — notify the human maintainer - Inspect the JSON…

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before running drift pr-loop, verify:

    line 15
  2. Very specific:

    When exit code is 1 (ESCALATED):

    line 69
  3. Very specific:

    Before running in production, use --dry-run to verify the loop logic:

    line 82

≈ “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

Skill: drift-pr-review-loop

Description

Drives a GitHub PR through an automated agent review loop using drift pr-loop. Covers preconditions, command usage, exit code interpretation, escalation handling, and dry-run workflows.

Trigger words: pr-loop, review loop, agent review, automated review, PR review loop


Preconditions

Before running drift pr-loop, verify:

  1. gh CLI authenticated: gh auth status must succeed. If not, run gh auth login.
  2. drift.yaml has pr_loop section: Minimum required config:
    pr_loop:
      reviewers:
        - github-copilot[bot]
      max_rounds: 5
      poll_interval_seconds: 60
      poll_timeout_seconds: 600
  3. On a feature branch: The command pushes fix commits; ensure you are not on main/master.

Step 1: Run the loop

drift pr-loop <PR_NUMBER> [OPTIONS]

Options:

OptionDefaultPurpose
--repo owner/repoauto-detectedOverride GitHub repo
--config PATHdrift.yamlConfig file path
--format rich|jsonrichOutput format
--dry-runfalseNo GitHub side-effects
--exit-zerofalseAlways exit 0

Example:

drift pr-loop 42 --dry-run   # Verify without side-effects
drift pr-loop 42              # Full run
drift pr-loop 42 --format json | jq .status  # Machine-readable

Step 2: Exit Code Interpretation

Exit CodeMeaningAgent Action
0APPROVED — all reviewers approvedProceed to merge or close loop
1ESCALATED — max rounds reached or unresolved conflictNotify maintainer, do not merge
2ERROR — loop failed unexpectedlyCheck logs, fix root cause, re-run
3Precondition failedRun gh auth login or add pr_loop: to drift.yaml

Step 3: Escalation Handling

When exit code is 1 (ESCALATED):

  • A PR comment has been posted listing all unresolved comments/verdicts
  • The state file is saved to work_artifacts/pr-loop-<PR_NUMBER>.json
  • Do not force-merge — notify the human maintainer
  • Inspect the JSON state for escalation_reason:
    cat work_artifacts/pr-loop-42.json | jq .escalation_reason

Step 4: Dry-Run Verification

Before running in production, use --dry-run to verify the loop logic:

drift pr-loop 42 --dry-run --format json

No gh pr comment, git push, or gh pr request-reviewers calls will be made. State is NOT written to work_artifacts/.


References

  • Spec: specs/004-agent-pr-review-loop/spec.md (FR-001–FR-013)
  • Config schema: drift.schema.json → pr_loop section
  • State artifact: work_artifacts/pr-loop-<PR_NUMBER>.json
  • Engine: src/drift/pr_loop/_engine.py
  • Side-effects: src/drift/pr_loop/_gh.py

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.