pre-commit-review

A checklist for reviewing changed files before a Git commit.

In plain words
What is it for?
Use it to check staged files for formatting, unused code, production console logs, documentation, logger fields, and suitable log levels.
Why use it?
It catches lint errors, outdated comments, inconsistent logging, and other quality problems before the changes are recorded.

Cursor rule

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/diegomarino/awesomic-cursor-rules/pre-commit-review
Clone the repo
git clone --depth 1 https://github.com/diegomarino/awesomic-cursor-rules
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 752 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.00752
Opus 5 $0.00000 $0.00376
Sonnet 5 $0.00000 $0.00150
Haiku 4.5 $0.00000 $0.00075

Measured 3d ago against content hash 44d5a4db9151, 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-review 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 3d 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.

rules/pre-commit-review.mdc · 98 lines

How it starts

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

Things to review before a commit

You should check all the files before commiting them in order to verify different aspects.

Linting

  • You should check and fix all the linting errors that the staged files have
  • Pay special attention to:
    • Proper indentation
    • Line length (max 80 characters)
    • No unused imports or variables
    • No console.log statements in production code

Comments

  • You should check (using the format and rules from @comments-javascript.mdc):
    • All the comments are updated to display the exact name of imported modules, used params and exported results
    • There is no comment in any other language than English
    • JSDoc headers are complete for new/modified files
    • Function documentation includes examples and error cases
    • Error handling sections are up to date

Logging

  • Review all logger calls (using the format and rules from @logging.mdc):
    • Each log has a clear and meaningful message
    • Context is always specified and valid (check @logging.mdc for valid contexts)
    • Filename is included in all logs
    • Metadata follows the format: key1=value1 • key2=value2
    • Metadata fits in one line (except for error details)
    • Log levels are used appropriately:
      • ERROR: Only for critical issues requiring immediate attention
      • WARN: For unexpected but handled conditions
      • INFO: For important operational events (use sparingly)
      • DEBUG: For detailed development information
    • No sensitive data in logs (passwords, tokens, etc)
    • Complex objects are properly formatted in metadata
    • Error logs include proper error context and details

Tests

  • You should check:
    • All the files to be commited have enough unit tests (if they are needed). We don't aim to have 100% test coverage, but we do aim to have enough coverage to be comfortable making changes
    • Tests include edge cases and error scenarios
    • Test descriptions are clear and meaningful
    • Mocks are properly implemented (especially for file system operations)
    • All tests pass before committing

Read the full file on GitHub · 98 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. 3d ago First seen · 98 lines · 752 tokens per session scan A 44d5a4db9151

Subscribe to this mod's changes

pre-commit-review is a cursor rule published in the GitHub repository diegomarino/awesomic-cursor-rules (10 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 752 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.