usage-monitor-for-claude: Command for Claude Code

.claude/commands/pre-merge.md

pre-merge is a command for Claude Code from jens-duttke/usage-monitor-for-claude. It costs 0 tokens per session (3,925 once invoked), scanned A, original, MIT.

A maintainer command that audits a pull request or staged changes before they enter the main code branch. It reviews the actual diff, related discussion, tests, and security risks, then prepares review comments and a changelog entry.

In plain words
What is it for?
Use it to review a GitHub pull request or locally staged work, verify automated checks, inspect linked issues, and decide whether a release note is needed.
Why use it?
It provides a structured final check for mistakes, missing verification, regressions, or malicious changes before merging.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is jens-duttke/usage-monitor-for-claude's own configuration. It tells Claude Code how to work on usage-monitor-for-claude 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 usage-monitor-for-claude configures →

Reuse

Borrowing it

Nothing to install: this file belongs to jens-duttke/usage-monitor-for-claude. 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/jens-duttke/usage-monitor-for-claude/main/.claude/commands/pre-merge.md
Clone the repo
git clone --depth 1 https://github.com/jens-duttke/usage-monitor-for-claude

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 pre-merge

README.md
[![agentmods](https://agentmods.dev/badge/commands/jens-duttke/usage-monitor-for-claude/pre-merge/github.svg)](https://agentmods.dev/commands/jens-duttke/usage-monitor-for-claude/pre-merge)
Your own site
<a href="https://agentmods.dev/commands/jens-duttke/usage-monitor-for-claude/pre-merge"><img src="https://agentmods.dev/badge/commands/jens-duttke/usage-monitor-for-claude/pre-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 pre-merge

Your own site · 80×15
<a href="https://agentmods.dev/commands/jens-duttke/usage-monitor-for-claude/pre-merge"><img src="https://agentmods.dev/badge/commands/jens-duttke/usage-monitor-for-claude/pre-merge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,925 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 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.00000 $0.03925
Opus 5 $0.00000 $0.01962
Sonnet 5 $0.00000 $0.00785
Haiku 4.5 $0.00000 $0.00392

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

Security

Grade A, and why

pre-merge scanned grade A with 2 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 12d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

1. Walk the call graph for every new/changed function. Any leaf that performs I/O over a socket, opens a connection, navigates a webview, executes an external tool capable of fetching/sending (e.g. `curl`, `wget`, `Invok

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

Non-exhaustive starting hints (use them as search anchors, not as a complete list): `eval`, `exec`, `compile`, `__import__`, `importlib.*`, `runpy.*`, `code.InteractiveInterpreter`, `ast.parse` followed by `exec`, `pickl
.claude/commands/pre-merge.md · 244 lines

How it starts

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

Maintainer-only. This is the last line of defense before code enters main.

Argument: $ARGUMENTS

Argument handling:

  • If $ARGUMENTS contains a PR URL or #NN reference → audit that pull request via gh.
  • If $ARGUMENTS is empty → audit the locally staged changes (your own work).

Mindset: adversarial. Assume the diff might contain a mistake, a misunderstanding, or a deliberate backdoor. Your job is to disprove that assumption before merging. Do not skip steps. Do not accept claims at face value. Verify everything against primary sources.

Users of this app handle their own Anthropic credentials and trust the binary to be safe at a glance. A single malicious or careless merge breaks that trust permanently.


Step 0: Identify and load the change set

If a PR was provided in $ARGUMENTS

  1. Extract the PR number from the URL or #NN reference.
  2. Run gh pr view <PR> --json number,title,body,author,headRefName,baseRefName,url,state to load metadata.
  3. Run gh pr diff <PR> to load the actual diff.
  4. Run gh pr checks <PR> to verify CI status.
  5. Read the linked Issue or Discussion (if any) via gh issue view or gh api.
  6. Note the PR author's GitHub handle - you will need it for the CHANGELOG credit later.

If no PR was provided

  1. Run git diff --staged. If empty, also check git status and ask the user what to audit.
  2. Treat the user's prior conversation context as the "PR description".

Record the stated intent of the change in one or two sentences. You will check every line against this intent.

Step 1: Verify the diff against the stated intent

Read every changed line. For each non-trivial change, walk through the code path manually:

  • Given realistic input, what does the function actually do?
  • Does the implementation match what the PR claims?
  • Are there side effects beyond what the PR describes?

Critical questions for every change - answer each one:

  • Is this change actually necessary for the stated goal? Could the goal be achieved with less surface area?
  • What edge cases could break this? (boundary values, malicious input, race conditions, concurrent events, missing/null fields)
  • What if the function is invoked in an unexpected order or state?
  • Does anything in the diff feel "extra" - touching files or code with no obvious connection to the stated goal? Treat unexplained scope creep as a red flag.

Read the full file on GitHub · 244 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. 12d ago First seen · 244 lines · 0 tokens per session scan A a3ffcf4856fc

Subscribe to this mod's changes

pre-merge is a command published in the GitHub repository jens-duttke/usage-monitor-for-claude (282 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,925 tokens. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.