kojiromike

finalize-pr

0
0
# Install this skill:
npx skills add kojiromike/dot-claude --skill "finalize-pr"

Install specific skill from multi-skill repository

# Description

This skill should be used when the user asks to "finalize my PR", "prepare PR for merge", "squash my commits", "clean up PR", "make PR ready for review", or needs to prepare a feature branch for merge by rebasing, squashing commits, and ensuring metadata is consistent.

# SKILL.md


name: finalize-pr
description: This skill should be used when the user asks to "finalize my PR", "prepare PR for merge", "squash my commits", "clean up PR", "make PR ready for review", or needs to prepare a feature branch for merge by rebasing, squashing commits, and ensuring metadata is consistent.
version: 1.0.0


Finalize PR

Prepare a feature branch for merge by rebasing, squashing, and ensuring all metadata is consistent.

Workflow

1. Rebase onto base branch

Use the rebase-pr skill to fetch the base branch, rebase onto it, and resolve any conflicts.

2. Squash commits

After rebasing, determine the base branch:

gh pr view --json baseRefName --jq '.baseRefName'

Count commits since diverging from base:

git rev-list --count origin/<base-branch>..HEAD

If more than one commit:

  1. Review all commits: git log --oneline origin/<base-branch>..HEAD
  2. Squash into a single commit using interactive rebase:
    bash git rebase -i origin/<base-branch>
  3. Mark all commits except the first as squash (or s)
  4. Craft a commit message that:
  5. Has a subject line following Conventional Commits (e.g., feat(scope): description)
  6. Includes a body explaining the "why" if needed
  7. Ends with Co-Authored-By: Claude <[email protected]> if Claude helped

3. Verify PR metadata

Get current PR info:

gh pr view --json title,body,number,url

Ensure:
- Title matches the commit message subject line exactly
- Description accurately reflects the changes with:
- Summary section
- Test plan (if applicable)
- Issue reference (Fixes #123 or Closes #123)

Update if needed:

gh pr edit --title "new title" --body "new body"

4. Check linked issues (if any)

If the PR references an issue:
- View the issue: gh issue view <number>
- Ensure the issue description aligns with what was implemented
- Update the issue if the scope changed during implementation

5. Check draft status

Check if the PR is a draft:

gh pr view --json isDraft --jq '.isDraft'

If the PR is a draft, ask the user if it should be marked ready for review. If yes:

gh pr ready

6. Force push

git push --force-with-lease

Notes

  • Always use --force-with-lease instead of --force to avoid overwriting others' changes
  • The commit message is the source of truth - PR title should match it exactly
  • If squashing reveals issues missed during rebase, abort and restart from step 1

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.