agentleFS
Aryansharma28Aryansharma28/skills-aryan/drive-pr/SKILL.md

drive-pr

Skill8 starsChanged 6 months agoMITView on GitHub

Take a PR all the way through merge AND clean up the local artifacts it leaves behind. The "babysit-pr" sister skill that also tears down the worktree + docker volumes + temp branches — but ONLY after the merge actually lands. Use when the user says "drive PR N", "/drive-pr N", "merge and cleanup", "ship it then tear it down", or asks you to land a PR and not leave debris on disk.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. drewdrewthis/claude-skills★ 2same name
    2. 0xdeafcafe/skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 5 are distinctive, and 5 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.

  • 5

    Very specific

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

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

    If you only want "get it merged," use babysit-pr.

    line 10
  2. Distinctive:

    Cleanup runs ONLY after the merge state is confirmed: Not after CI passes, not after the merge command returns, not after the queue accepts …

    line 14
  3. Very specific:

    If state != MERGED, stop. Don't clean.

    line 22
  4. Distinctive:

    Use whichever method the repo accepts:

    line 34
  5. Very specific:

    Add --auto if the repo has branch-protection rules that require all checks.

    line 42
  6. Very specific:

    If the worktree didn't run any compose stack (e.g.

    line 65
  7. Distinctive:

    After cleanup, give the user a one-paragraph summary:

    line 103
  8. Distinctive:

    If the user says "drive PR but keep the worktree, just stop docker" — honor that.

    line 126
  9. Very specific:

    When the user invokes /drive-pr N (or asks to land + clean up):

    line 130
  10. Distinctive:

    If MERGED → run cleanup Section 4.

    line 135

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

drive-pr

Driving a PR is more than getting it green. The local cost of a feature PR — a worktree on disk, per-worktree docker volumes (10s of GB), a feature branch — sticks around forever unless someone cleans up. This skill drives the PR through merge and then, and only then, tears down the local artifacts it created.

If you only want "get it merged," use babysit-pr. If you also want "no debris on disk afterward," use drive-pr.

The hard rule

Cleanup runs ONLY after the merge state is confirmed. Not after CI passes, not after the merge command returns, not after the queue accepts an auto-merge. The PR's actual state must read MERGED via gh pr view before a single docker volume rm or git worktree remove runs.

This protects against:

  • Auto-merge that gets dequeued by a late failing check.
  • Network blips that hang the merge mid-flight.
  • A reviewer hitting "request changes" between the gh pr merge call and CI completion.
  • The user changing their mind during the gap.

If state != MERGED, stop. Don't clean. Report status and hand back.

Sequence

1. Drive the PR

Same as babysit-pr — get CI green, resolve conflicts, address review comments, run /review, etc. See that skill if the PR needs deep babysitting.

Resolve merge conflicts only with the user's standing authorization. For conflicts in auth / routes / feature-flag registries / migrations / security code, ask before guessing — wrong calls here are silent.

2. Merge

Use whichever method the repo accepts:

gh pr merge <N> --repo <owner>/<repo> --squash    # most repos
gh pr merge <N> --repo <owner>/<repo> --rebase    # if squash is blocked
gh pr merge <N> --repo <owner>/<repo> --merge     # if merge commits allowed

Add --auto if the repo has branch-protection rules that require all checks; otherwise it errors with "Auto merge is not allowed for this repository". When --auto fails, drop the flag and re-run (immediate merge).

3. CONFIRM merged

gh pr view <N> --repo <owner>/<repo> --json state,mergedAt,mergeCommit

Block on state == "MERGED". If state == "OPEN" (merge queue, stuck CI, declined request), report and STOP. Do not proceed to cleanup.

4. Cleanup (ONLY after state == MERGED)

Cleanup happens in the worktree the PR was driven from. Steps:

4a. Stop the local dev stack tied to this worktree

# Use the same VOLUME_PREFIX the user originally launched with so we
# target this worktree's containers, not a sibling worktree's stack.
VOLUME_PREFIX="$(basename "$PWD")" \
  docker compose -f compose.dev.yml --profile full down

If the worktree didn't run any compose stack (e.g. the PR was tooling-only), docker compose down is a no-op — safe.

4b. Remove per-worktree docker volumes

# Worktree-isolated volumes (declared with ${VOLUME_PREFIX:-langwatch}-* names
# in compose.dev.yml). Removing these reclaims the GBs of node_modules,
# bullboard deps, and goose binaries that this worktree alone used.
for v in app-modules bullboard-modules goose-bin; do
  docker volume rm "${PWD##*/}-${v}" 2>/dev/null || true
done

Do NOT remove the SHARED stateful volumes (langwatch-db-data, langwatch-clickhouse-data, langwatch-redis-data) — other worktrees use them, and they hold the user's signed-up account + project data. The shared volumes survive across worktrees by design.

4c. Remove the git worktree

# From the *parent* repo's directory, not the worktree itself.
# `git worktree remove` refuses to nuke the worktree you're standing in.
cd "$(git rev-parse --git-common-dir)/.." 2>/dev/null || cd ..
git worktree remove <worktree-path> --force

--force because the .env, .env.dev-up overlay, and other locally-created files are intentional artifacts you want gone.

4d. Delete the merged feature branch

gh api -X DELETE "repos/<owner>/<repo>/git/refs/heads/<branch-name>" 2>/dev/null || true
# Local copy:
git branch -D <branch-name> 2>/dev/null || true

Skip this step for stacked PRs whose head branch is the BASE of another open PR.

5. Report

After cleanup, give the user a one-paragraph summary:

PR #N merged at <timestamp>. Local cleanup:
  ✓ docker compose --profile full down
  ✓ removed volumes: <worktree>-app-modules, <worktree>-bullboard-modules, <worktree>-goose-bin
  ✓ git worktree remove <path>
  ✓ branch <name> deleted (origin + local)

Shared stateful volumes preserved: langwatch-db-data,
langwatch-clickhouse-data, langwatch-redis-data.

What this skill does NOT do

  • It does not clean if the merge didn't happen. Ever. The check at step 3 is non-negotiable.
  • It does not touch the shared stateful db/redis/clickhouse volumes — those hold the user's data across worktrees.
  • It does not delete the SOURCE repo (the parent clone), only the worktree.
  • It does not stop or remove containers belonging to OTHER worktrees. The VOLUME_PREFIX scoping ensures we only touch this PR's stack.
  • It does not delete the head branch when the PR is stacked and its head is some other PR's base. Check before deleting.

When the user wants partial cleanup

If the user says "drive PR but keep the worktree, just stop docker" — honor that. The standard sequence is the default, not a mandate. The hard rule (no cleanup before merge) still applies regardless.

Activating

When the user invokes /drive-pr N (or asks to land + clean up):

  1. Confirm the PR number and base/target.
  2. Drive it to merge per Section 1–2 (delegating to babysit-pr behaviors as needed).
  3. Block on state == MERGED per Section 3.
  4. If MERGED → run cleanup Section 4. If not → stop and report.
  5. Summarize per Section 5.

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.