pre-commit

A pre-commit checklist for a .NET project. It fetches the remote branch, checks whether rebasing is needed, builds the project, runs tests, checks formatting, and optionally runs CodeRabbit review.

In plain words
What is it for?
Use it before a commit to update the changelog, verify the .NET build and tests, check C# formatting, and review uncommitted changes.
Why use it?
It gathers the main checks needed before proposing a commit and stops when the branch is behind or serious review findings appear.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/nanotaboada/dotnet.samples.aspnetcore.webapi/pre-commit
Clone the repo
git clone --depth 1 https://github.com/nanotaboada/Dotnet.Samples.AspNetCore.WebApi

Made for: Claude Code.

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 342 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00342
Opus 5 $0.00000 $0.00171
Sonnet 5 $0.00000 $0.00068
Haiku 4.5 $0.00000 $0.00034

Measured 2d ago against content hash 95228f0ff853, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pre-commit 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 2d 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/pre-commit.md · 16 lines

What it actually says

Before running the checklist, run git fetch origin. If the current branch is behind origin/master, stop and rebase before proceeding.

Run the pre-commit checklist for this project:

  1. Update CHANGELOG.md [Unreleased] section — add an entry under the appropriate subsection (Added / Changed / Fixed / Removed) describing the changes made, referencing the issue number.
  2. Run dotnet build --configuration Release — must succeed.
  3. Run dotnet test --settings .runsettings — all tests must pass.
  4. If dotnet csharpier is available, run dotnet csharpier --check . — must pass (run dotnet csharpier . to auto-fix). Skip this step with a note if not installed.
  5. If coderabbit CLI is installed, run coderabbit review --type uncommitted --prompt-only:
    • If actionable/serious findings are reported, stop and address them before proposing the commit.
    • If only nitpick-level findings, report them and continue to the commit proposal.
    • If coderabbit is not installed, skip this step with a note.

Run steps 1–4, report the results clearly, then run step 5 (CodeRabbit review) if available, then propose a branch name and commit message for my approval using the format type(scope): description (#issue) (max 80 chars; types: feat fix chore docs test refactor ci perf). Do not create the branch or commit until I explicitly confirm.

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. 2d ago First seen · 16 lines · 0 tokens per session scan A 95228f0ff853

Subscribe to this mod's changes

pre-commit is a command published in the GitHub repository nanotaboada/Dotnet.Samples.AspNetCore.WebApi (10 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 342 tokens. 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-08-31.