Skip to content

flurdy/agent-skills / skills/ready-to-merge

ready-to-merge

Verified

Pre-merge gate — verify a PR is green, approved, in sync, and free of obvious risk, then (on explicit approval) squash-merge it. Composes /pr-status, /contract-check, and /review-pr rather than reimplementing them.

FileKindSize
SKILL.mdskill md23.1 KB
references/default-sync.mdmarkdown6.9 KB
scripts/default-sync.pyscript11.8 KB
scripts/gh-branch-delete.pyexecutablescript417 B
scripts/gh-branch-view.pyexecutablescript280 B
scripts/git-unpushed.shexecutablescript204 B
scripts/github_branch.pyscript2.0 KB
scripts/merge-timing.pyexecutablescript9.1 KB
tests/test-skill-contract.shexecutablescript2.8 KB
tests/test_branch_wrappers.pyscript7.6 KB
tests/test_default_sync.pyscript11.5 KB
tests/test_merge_timing.pyscript11.0 KB

tests/test-skill-contract.sh

View on GitHub
#!/usr/bin/env bash
set -euo pipefail

skill_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
skill_file="$skill_dir/SKILL.md"
wrapper="$skill_dir/scripts/git-unpushed.sh"
grant='Bash(~/.agents/skills/ready-to-merge/scripts/git-unpushed.sh:*)'

[[ -x "$wrapper" ]] || { echo "git-unpushed wrapper must be executable" >&2; exit 1; }
[[ $(grep -F -- 'allowed-tools:' "$skill_file" | grep -Fo -- "$grant" | wc -l) -eq 1 ]] || {
  echo "ready-to-merge must grant exactly its git-unpushed wrapper" >&2
  exit 1
}

for script in gh-branch-view.py gh-branch-delete.py merge-timing.py; do
  [[ -x "$skill_dir/scripts/$script" ]] || { echo "$script must be executable" >&2; exit 1; }
  grant="Bash(~/.agents/skills/ready-to-merge/scripts/$script:*)"
  grep -F -- 'allowed-tools:' "$skill_file" | grep -Fq -- "$grant" || {
    echo "missing narrow grant for $script" >&2
    exit 1
  }
done

for forbidden in 'Bash(gh:*)' 'Bash(gh api:*)' 'gh api '; do
  if grep -Fq -- "$forbidden" "$skill_file"; then
    echo "unexpected raw API access: $forbidden" >&2
    exit 1
  fi
done

for invariant in \
  'fresh confirmation' \
  'Never infer deletion permission from merge approval' \
  'defaultBranchRef' \
  'headRefOid' \
  'fork' \
  'dependent PRs' \
  '404 does not prove auto-deletion' \
  'does not provide atomic compare-and-delete' \
  'standalone tool call' \
  'refuse a `GH_HOST` gh does not know' \
  "cleanup when the PR's host differs rather than changing hosts"; do
  grep -Fq -- "$invariant" "$skill_file" || { echo "missing cleanup invariant: $invariant" >&2; exit 1; }
done

for invariant in \
  'without a policy, timing is never checked or rendered' \
  'PR cannot relax its own restriction' \
  'never clear' \
  'never pass it here' \
  'still reports applicable timing' \
  'If timing is `required` or `unknown`, stop here: do not offer the merge' \
  'Do not wait, sleep, schedule or retry' \
  'Recheck timing immediately before merging' \
  'timing change, and a recheck never merges, waits or schedules' \
  'No override bypasses a `required` restriction'; do
  grep -Fq -- "$invariant" "$skill_file" || { echo "missing timing invariant: $invariant" >&2; exit 1; }
done

sync_contract="$skill_dir/references/default-sync.md"
grep -Fq 'references/default-sync.md' "$skill_file" || { echo 'missing post-merge update handoff' >&2; exit 1; }
for invariant in \
  'two separate confirmations' \
  'Never use `git pull`' \
  'merge --ff-only --no-autostash' \
  'No automatic retries' \
  'not an atomic lock' \
  'never acquire an unrelated lease' \
  'Never fall back to raw Git' \
  'mergeCommit.oid' \
  'source/target branches and inventory membership to remain unchanged' \
  'local update failed/unconfirmed; PR remains merged'; do
  grep -Fq "$invariant" "$sync_contract" || { echo "missing local-sync invariant: $invariant" >&2; exit 1; }
done

echo "ready-to-merge skill contract tests passed"
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall