agentleFS
mo-cmykmo-cmyk/mazarbul/.claude/skills/merge/SKILL.md

merge

Skill2 starsChanged 35 days agoApache-2.0View on GitHub

Merges the current PR after the babysit loop reaches merge_ready. USE ONLY WHEN user explicitly says 'merge it' / 'merge this PR' / 'go ahead and merge' AFTER reviewing the PR. Refuses unless babysit-state.phase == merge_ready. Confirms once, then runs gh pr merge --squash (no --admin). Schedules post-merge deploy watch. NOT FOR auto-merge from any other skill or hook.

62 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use addskill, apply-firmware and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ryanportfolioSkill

    addskill

    Create, import, update, or install repo or personal skills: runtime ownership, resources, discovery checks.

    Also in 6 projects that use this

  • ryanportfolioSkill

    apply-firmware

    Bring current folder (plain folder, existing repo, old or partial firmware copy) up to full Harness Firmware in place. Mirror external repo → adopt-repo.

    Also in 6 projects that use this

  • +10 more from ryanportfolio

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 54 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    If branch protection requires extra approvals or status checks, gh pr merge will fail.

    line 105

“Common” is measured: kept by at least 6 in 10 of the 54 edited versions of this file we could read. “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

The ONLY skill in this project that runs gh pr merge. Hard-gated: requires babysit state to be at merge_ready AND explicit user confirmation in the most recent user message.

Steps

1. Resolve PR + verify state

PR="${ARGUMENTS:-$(gh pr view --json number -q .number)}"
STATE=".claude/babysit-state-${PR}.json"

if [ ! -f "$STATE" ]; then
  echo "REFUSED: no babysit state for PR #$PR. /merge requires a prior /babysit-pr run that reached merge_ready."
  exit 1
fi

PHASE=$(jq -r '.phase' "$STATE")
if [ "$PHASE" != "merge_ready" ]; then
  echo "REFUSED: PR #$PR is in phase '$PHASE', not merge_ready."
  echo "Run /babysit-tick manually to refresh state, or wait for the next Cron tick."
  exit 1
fi

2. Confirm destructive action

Pass the last user message to the guard:

.claude/scripts/guard-destructive.sh merge "$LAST_USER_MESSAGE"

(In Claude, that means: read your most recent user turn. Pass its text as arg 2. If guard-destructive.sh returns non-zero, abort and print its stderr message.)

3. Merge

gh pr merge $PR --squash --delete-branch
  • Never --admin , that bypasses branch protection.
  • Never --rebase , squash is the project default.
  • --delete-branch is fine; the babysit state still has the audit log.

4. Schedule post-merge deploy watch

Capture the merged commit SHA:

MERGED_SHA=$(gh pr view $PR --json mergeCommit --jq .mergeCommit.oid)

Update state:

source .claude/scripts/babysit-state.sh "$PR"
set_field merged_sha "$MERGED_SHA"
set_phase post_merge_watch
reset_iter post_merge_iter
log_audit "merged" "sha=$MERGED_SHA"

Schedule a fresh Cron (the previous one was deleted at merge_ready):

Invoke CronCreate with:

  • expression: */4 * * * *
  • durable: true
  • prompt: Run /babysit-tick for PR #$PR
  • description: babysit deploy for PR #$PR

The new job's ID is a different value from the pre-merge cron_job_id (already deleted). Persist it under a distinct key so /babysit-abort and the post_merge_watch exit branch can find it:

# After CronCreate returns the new job id:
set_field post_merge_cron_job_id "$NEW_CRON_ID"
log_audit "post_merge_cron_scheduled" "id=$NEW_CRON_ID"

5. Notify

PushNotification (proactive): "PR #$PR merged. Watching deploy actions. Notifications on success/failure."

6. Report

Print:

  • Merge SHA
  • Deploy watch state file
  • /babysit-abort $PR to stop the deploy watch early

Gotchas

  • Merge is irreversible (squash discards branch history). Refuse and ask if uncertain.
  • The post-merge Cron is a different job from the pre-merge one. Persist its ID under post_merge_cron_job_id; the post_merge_watch branch in /babysit-tick reads that key first and falls back to cron_job_id only for legacy state files.
  • If branch protection requires extra approvals or status checks, gh pr merge will fail. Read the error; don't bypass with --admin.

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.