granite.build: Command for Claude Code

.claude/commands/pr-post-merge.md

pr-post-merge is a command for Claude Code from ibm-granite/granite.build. It costs 19 tokens per session (763 once invoked), scanned A, original, Apache-2.0.

A Git workflow for cleaning up after a pull request has been merged. It closes the related fork issue, updates the local branch, and deletes the issue branch after checking the repository state.

In plain words
What is it for?
Use it after a pull request is merged to finish issue cleanup, synchronize local code with the main branch, and remove the completed branch.
Why use it?
It removes repetitive post-merge cleanup and helps avoid deleting the wrong branch or acting from an unexpected worktree.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: positional $N argument.

This is ibm-granite/granite.build's own configuration. It tells Claude Code how to work on granite.build itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything granite.build configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ibm-granite/granite.build. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ibm-granite/granite.build/main/.claude/commands/pr-post-merge.md
Clone the repo
git clone --depth 1 https://github.com/ibm-granite/granite.build

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pr-post-merge

README.md
[![agentmods](https://agentmods.dev/badge/commands/ibm-granite/granite.build/pr-post-merge/github.svg)](https://agentmods.dev/commands/ibm-granite/granite.build/pr-post-merge)
Your own site
<a href="https://agentmods.dev/commands/ibm-granite/granite.build/pr-post-merge"><img src="https://agentmods.dev/badge/commands/ibm-granite/granite.build/pr-post-merge/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pr-post-merge

Your own site · 80×15
<a href="https://agentmods.dev/commands/ibm-granite/granite.build/pr-post-merge"><img src="https://agentmods.dev/badge/commands/ibm-granite/granite.build/pr-post-merge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 763 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.00763
Opus 5 $0.00010 $0.00381
Sonnet 5 $0.00004 $0.00153
Haiku 4.5 $0.00002 $0.00076

Measured 5d ago against content hash 7233580063d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

pr-post-merge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/pr-post-merge.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Post-merge cleanup

You are helping a developer clean up after a PR has been merged into upstream/main. Follow these steps in order.

Fork issue number: $ARGUMENTS

Step 1: Validate

  1. Derive the fork owner and repo:

    FORK_OWNER=$(git remote get-url origin | sed -E 's|.*[:/]([^/]+)/.*|\1|')
    FORK_REPO=$(git remote get-url origin | sed -E 's|.*[:/][^/]+/(.*)$|\1|' | sed 's/\.git$//')
    
  2. Detect if we are running inside a git worktree:

    WORKTREE_DIR=$(git rev-parse --show-toplevel)
    MAIN_REPO=$(git worktree list --porcelain | head -1 | awk '{print $2}')
    IS_WORKTREE=false
    if [ "$WORKTREE_DIR" != "$MAIN_REPO" ]; then IS_WORKTREE=true; fi
    
  3. Confirm the current branch is an issue branch (not main)

  4. Save the current branch name for later deletion

  5. If no issue number was provided ($ARGUMENTS), try to auto-detect from the branch name:

    BRANCH=$(git branch --show-current)
    

    If $BRANCH matches the pattern issue-<N>-*, extract <N> as the issue number. Inform the user:

    Auto-detected issue #N from branch name <branch>

    If the branch doesn't match and no $ARGUMENTS was given, ask the user for the issue number.

Step 2: Close the fork issue

  1. Close the issue in the fork repo:
    gh issue close <N> --repo "$FORK_OWNER/$FORK_REPO"
    
  2. Confirm the issue was closed successfully

Step 3: Update local integration branch and clean up

If running in a worktree (IS_WORKTREE=true):

The worktree must be removed before the branch can be deleted. All remaining steps run from the main repo directory.

  1. Change to the main repo directory:
    cd $MAIN_REPO
    
  2. Remove the worktree:
    git worktree remove $WORKTREE_DIR
    
    If removal fails (dirty worktree), ask the user whether to force-remove (git worktree remove --force $WORKTREE_DIR) or abort.
  3. Update the integration branch:
    git checkout main
    git pull upstream main
    
  4. Delete the local issue branch:
    git branch -d <saved-branch-name>
    
  5. Delete the remote issue branch on the fork:
    git push origin --delete <saved-branch-name>
    
  6. Report completion to the user:

    Cleaned up worktree $WORKTREE_DIR, deleted branch <saved-branch-name> locally and on origin, updated main.

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 92 lines · 19 tokens per session scan A 7233580063d7

Subscribe to this mod's changes

pr-post-merge is a command published in the GitHub repository ibm-granite/granite.build (44 stars, last pushed today), licensed Apache-2.0. It adds 19 tokens to every session and 763 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.