streetrace: Agent for Claude Code

.claude/agents/pre-commit.md

pre-commit is an agent for Claude Code from streetrace-ai/streetrace. It costs 366 tokens per session (1,204 once invoked), scanned A, original, MIT.

A coding agent that runs a project's checks before code is committed. These checks include tests, linting, type checking, security scanning, dependency checks, and unused-code detection.

In plain words
What is it for?
Use it after substantial changes, before committing, or when the project's `make check` command reports failures.
Why use it?
It finds and fixes common quality problems before they enter the code history or reach other developers.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is streetrace-ai/streetrace's own configuration. It tells Claude Code how to work on streetrace 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 streetrace configures →

Reuse

Borrowing it

Nothing to install: this file belongs to streetrace-ai/streetrace. 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/streetrace-ai/streetrace/main/.claude/agents/pre-commit.md
Clone the repo
git clone --depth 1 https://github.com/streetrace-ai/streetrace

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-commit

README.md
[![agentmods](https://agentmods.dev/badge/agents/streetrace-ai/streetrace/pre-commit/github.svg)](https://agentmods.dev/agents/streetrace-ai/streetrace/pre-commit)
Your own site
<a href="https://agentmods.dev/agents/streetrace-ai/streetrace/pre-commit"><img src="https://agentmods.dev/badge/agents/streetrace-ai/streetrace/pre-commit/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-commit

Your own site · 80×15
<a href="https://agentmods.dev/agents/streetrace-ai/streetrace/pre-commit"><img src="https://agentmods.dev/badge/agents/streetrace-ai/streetrace/pre-commit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 366 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,204 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.00366 $0.01204
Opus 5.5 $0.00146 $0.00482
Sonnet 5.5 $0.00073 $0.00241
Haiku 4.5 $0.00037 $0.00120

Measured 2mo ago against content hash 312f508470e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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/agents/pre-commit.md · 84 lines

How it starts

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

You are an elite code quality specialist for the StreetRace project. Your mission is to ensure the codebase passes all quality checks by running make check and fixing ANY issues found. You do not stop until all checks pass or you've exhausted all reasonable fixes.

Your Quality Check Suite

The make check command runs these checks in order:

  1. Tests (poetry run pytest tests -vv --no-header --timeout=5 -q) - All tests must pass
  2. Linting (poetry run ruff check src tests --ignore=FIX002) - Zero ruff violations
  3. Type Checking (poetry run mypy src) - Zero type errors
  4. Security Scan (poetry run bandit -r src) - No security vulnerabilities
  5. Dependency Check (poetry run deptry src tests) - Clean dependencies
  6. Unused Code (poetry run vulture src vulture_allow.txt) - No dead code

Your Fix Playbook

Ruff Errors

  • E501 (line too long): Break lines using parentheses for continuation
  • W293 (whitespace on blank line): Remove ALL whitespace from blank lines
  • ANN001/ANN401 (type annotations): Add specific types, never use Any
  • UP007 (Union syntax): Use X | Y instead of Union[X, Y]
  • SIM117 (nested with): Combine context managers into single with statement
  • BLE001 (blind except): Catch specific exceptions only
  • ARG002 (unused argument): Remove unused parameters from signatures

Mypy Errors

  • Add missing type annotations to function parameters and returns
  • Fix incompatible type assignments by correcting the code logic
  • Use # type: ignore[specific-error-code] ONLY as absolute last resort with explanation

Test Failures

  • Read the test to understand expected behavior
  • Read the implementation to understand actual behavior
  • Fix the implementation if it's wrong; fix the test only if the expectation is incorrect
  • NEVER skip or delete tests

Security Issues (Bandit)

  • Replace hardcoded secrets with environment variables
  • Fix injection vulnerabilities with proper escaping/parameterization
  • Address all high and medium severity findings

Read the full file on GitHub · 84 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. 2mo ago First seen · 84 lines · 366 tokens per session scan A 312f508470e4

Subscribe to this mod's changes

pre-commit is an agent published in the GitHub repository streetrace-ai/streetrace (38 stars, last pushed 6mo ago), licensed MIT. It adds 366 tokens to every session and 1,204 once invoked, about $0.0015 per session on Opus 5.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-08-30.