commit-pattern

A Git commit rule covering Conventional Commits, a standard format for writing commit messages, plus checks run before committing code.

In plain words
What is it for?
Validating commit type, optional scope, imperative subject, length, body, footer, and the results of the local pre-commit command.
Why use it?
It prevents vague or incorrectly formatted commit messages and reminds contributors to pass the project's pre-commit analysis.

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/hbarbosa02/alaz-mcp-nestjs/commit-pattern
Clone the repo
git clone --depth 1 https://github.com/hbarbosa02/alaz-mcp-nestjs

Made for: Cursor.

Per session 699 This file is loaded in full into every session.
When invoked 699 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.00699 $0.00699
Opus 5 $0.00349 $0.00349
Sonnet 5 $0.00140 $0.00140
Haiku 4.5 $0.00070 $0.00070

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

Security

Grade A, and why

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

.cursor/rules/commit-pattern.mdc · 67 lines

How it starts

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

Commit pattern and pre-commit analysis

When to use this

Apply before every git commit (human or agent): validate the message and that pre-commit analysis has passed (or will pass) via npm run precommit.

Commit message — Conventional Commits

Format (required):

<type>(<optional-scope>): <imperative subject>
  • type (pick one): feat | fix | docs | style | refactor | test | chore | ci | perf | build
  • scope (optional): area in lower kebab-case, e.g. mcp, git-context, e2e
  • subject: imperative mood, no trailing period, ≤ 72 characters; describe what and why in a single line

Body (optional, after a blank line): explain motivation, trade-offs, or follow-ups. Wrap at ~72 chars. Reference issues, e.g. Closes #12.

Footer (optional): BREAKING CHANGE: ... or Refs #id.

Examples

fix(mcp): return empty list when project root is missing

feat: add get-recent-changes prompt wrapper for Cursor clients

Anti-patterns

  • WIP / fix stuff / only a ticket id as subject
  • ❌ Vague: update, changes, misc
  • ❌ Ending the subject with .

Pre-commit analysis (automation + checklist)

Automated (required when hook is active): core.hooksPath points to .githooks. On commit, the hook runs npm run precommit (see package.json).

Manual if hook failed or skipped: run the same: npm run precommit

Checklist (must be satisfied before pushing)

  1. Lint: npm run lint — no new ESLint errors in {src,test}/**/*.ts
  2. Format: npm run format:check — Prettier is clean
  3. Tests: npm test — relevant unit tests pass; for risky changes, also npm run test:e2e
  4. Scope: commit contains a single logical change; unrelated edits belong in a separate commit
  5. Secrets / noise: no .env keys, tokens, or large generated artifacts; no accidental node_modules or dist/
  6. Docs: if behavior changed, user-visible docs (e.g. README.md, docs/) updated in the same PR when required

Read the full file on GitHub · 67 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. 2d ago First seen · 67 lines · 699 tokens per session scan A ce411cb44aa1

Subscribe to this mod's changes

commit-pattern is a cursor rule published in the GitHub repository hbarbosa02/alaz-mcp-nestjs (2 stars, last pushed 4mo ago), licensed MIT. It adds 699 tokens to every session, about $0.0035 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-31.