home / skills / tkersey / dotfiles / fin

fin skill

/codex/skills/fin

This skill finalizes a GitHub PR end-to-end by updating branches, monitoring checks, squash-merging, and cleaning local/remote state.

npx playbooks add skill tkersey/dotfiles --skill fin

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.2 KB
---
name: fin
description: "Finalize GitHub PRs end-to-end: update branch/PR, monitor CI until green, squash-merge, and clean up local/remote state. Use when asked to $fin or to finish/land/merge/close a PR, watch checks or runs, squash-merge, delete the branch, and sync local state."
---

# Fin

## Overview
Finish a PR end-to-end: push updates, watch checks, squash-merge, and clean up state.

## Workflow
1) Identify the PR and target branch.
   - Use `gh pr view` (current branch) or `gh pr list` to locate it.

2) Update the PR.
   - Ensure the branch is up to date, run required checks, and push:
     - `git status`, fix issues, then `git push`.

3) Monitor checks until green.
   - Use `gh pr checks --watch` or `gh run watch <run-id>`.
   - If checks fail, fix, push, and re-watch.

4) Squash-merge the PR.
   - Prefer `gh pr merge --squash --delete-branch` unless repo policy dictates otherwise.
   - If approvals are missing, request them before merging.

5) Clean up local state.
   - Fetch the updated mainline, switch to it, and delete the merged branch.

## Guardrails
- Do not merge if required checks or approvals are missing.
- Keep the merge method aligned with repo policy.
- If any step is blocked, state the blocker and required next action.

Overview

This skill finalizes GitHub pull requests end-to-end: it updates the branch, monitors CI until checks pass, performs a squash-merge, and cleans up both remote and local state. It automates the checklist you follow when asked to finish, land, merge, or close a PR. Use it to ensure merges respect required checks and repo policies while keeping your local repository tidy.

How this skill works

The skill locates the PR (current branch or from a list), ensures the branch is up to date, and pushes any last changes. It then watches CI checks or specific workflow runs until they turn green, prompting for fixes if they fail. Once checks and approvals satisfy repo rules, it performs a squash-merge and deletes the feature branch remotely, then fetches and syncs your local mainline and removes the local branch.

When to use it

  • You are ready to land a feature and need to finish the PR end-to-end.
  • You want to push final fixes, watch CI until green, and then merge automatically.
  • You need to perform a squash-merge and delete the branch in one flow.
  • You want to ensure required checks and approvals are present before merging.
  • You need local repository cleanup after a merge.

Best practices

  • Identify the correct PR using gh pr view or gh pr list before taking action.
  • Do not merge until required checks and approvals are green; state blockers if present.
  • Prefer gh pr merge --squash --delete-branch unless repository policy requires a different merge method.
  • When checks fail, fix locally, run git status, then git push and re-watch the checks.
  • After merging, fetch and switch to the mainline branch, then delete the merged local branch to avoid drift.

Example use cases

  • Finish a current-branch PR: update, watch checks, squash-merge, and delete branch in one command sequence.
  • Recover a PR where CI failed: apply a fix, push, and resume watching until green before merging.
  • Merge a long-running feature branch once approvals and checks are satisfied, ensuring repo policy compliance.
  • Clean up local and remote branches after a successful merge to keep the repo tidy.

FAQ

What if required checks are missing or failing?

Do not merge. Report the failing checks, apply fixes or request necessary changes, push updates, and re-watch until checks pass.

Can the merge method be changed?

Yes—use the repository's policy as the source of truth. The default preferred method is squash; switch to merge or rebase if policy requires it.