pre-commit-validation

A pre-commit rule requiring local code checks before creating a Git commit. CI, or continuous integration, is the automated checking system that runs for the project.

In plain words
What is it for?
Use it to run Ruff checks and formatting, Ty type checks, and the full pytest test suite before committing.
Why use it?
It catches formatting, type, and test failures on the developer’s machine before they reach CI or other contributors.

Cursor rule for Cursor

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 rules/darknessomi/musicbox/pre-commit-validation
Clone the repo
git clone --depth 1 https://github.com/darknessomi/musicbox

Made for: Cursor.

Per session 185 This file is loaded in full into every session.
When invoked 185 The same file — it is already loaded in full.
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.00185 $0.00185
Opus 5 $0.00093 $0.00093
Sonnet 5 $0.00037 $0.00037
Haiku 4.5 $0.00018 $0.00018

Measured yesterday against content hash c8c84fb29ea7, 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-validation 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 yesterday.

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.

.cursor/rules/pre-commit-validation.mdc · 20 lines

What it actually says

提交前本地验证

每次 git commit 前,必须先在本机跑完与 .github/workflows/ci.yml 等价的检查;任一失败则先修复再提交。

uv run ruff check
uv run ruff format --check   # 失败则先 uv run ruff format 再重跑
uv run ty check
uv run pytest -s

格式问题优先用 uv run ruff format 自动修复,不要只改代码却跳过 format。

若已安装 pre-commit hook(uv run pre-commit install),git commit 会自动跑 ruff 与 ty;仍应在提交前手动跑完整 pytest。

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. yesterday First seen · 20 lines · 185 tokens per session scan A c8c84fb29ea7

Subscribe to this mod's changes

pre-commit-validation is a cursor rule published in the GitHub repository darknessomi/musicbox (9,837 stars, last pushed 5d ago), licensed MIT. It adds 185 tokens to every session, about $0.0009 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-08-30.