pre-commit-review
Skill9 starsChanged 29 days agoMITView on GitHub
Fast security-focused review of staged changes before every commit, checking only critical compliance rules
5 other projects use a version of this.
Adopted by
Most recently taken up by
- shsha4/claude-skillstheir own version, first seen Aug 19, 2026
- System-Error-Worldwide/the-looptheir own version, first seen Aug 17, 2026
- felipeArnold/filament-ai-skillstheir own version, first seen Jun 13, 2026
- Raashul/claude-skillstheir own version, first seen Apr 30, 2026
- liuhean2021/anan-agent-skillstheir own version, first seen Apr 11, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- felipeArnold/filament-ai-skills★ 9same name
- liuhean2021/anan-agent-skills★ 1same name
- Raashul/claude-skills★ 1same name
- shsha4/claude-skills★ 1same name
- System-Error-Worldwide/the-loop★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- batch-fixSkill
- brainstormingSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- context-engineeringSkill
- fixSkill
- handoffSkill
- implementSkill
- incremental-implementationSkill
- instructionsSkill
- lessonsSkill
- mtk-doctorSkill
- mtk-setupSkill
- mtkSkill
- planning-and-task-breakdownSkill
- prior-work-checkSkill
- promote-lessonSkill
- repo-healthSkill
- research-contextSkill
- security-and-hardeningSkill
- setup-auditSkill
- setup-bootstrapSkill
- setup-refreshSkill
- spec-drift-detectionSkill
- spec-driven-developmentSkill
- subagent-implementationSkill
- tech-stack-dotnetSkill
- tech-stack-pythonSkill
- tech-stack-typescriptSkill
- verification-before-completionSkill
- workflow-artifactsSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Run a fast, security-focused review on staged changes only.
- Distinctive: line 22
If nothing staged, check unstaged: git diff
- Distinctive: line 23
If nothing at all, tell the engineer there's nothing to review
- Very specific: line 38
Only consume cached output.
- Very specific: line 81
Run the AI review pass on the same diff to catch issues the linter can't reach (design, intent, context-sensitive rules).
- Very specific: line 106
Read .claude/review-config.json for the threshold (default 80.
- Very specific: line 110
If findings[] is empty, below_threshold_rationale is mandatory — state what you checked and why you conclude the diff is clean.
- Distinctive: line 112
Keep the table tight. This is a pre-commit gate, not a full review.
- Very specific: line 116
When verdict is PASS and findings[] is empty, skip the table and JSON block entirely.
- Very specific: line 129
When there are findings (PASS with warnings/suggestions, or NEEDS_CHANGES), emit the standard schema output: markdown table + fenced JSON …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pre-Commit Security Review
MTK File Resolution
Resolve MTK skill/reference/script paths per .claude/references/mtk-file-resolution.md unless the router already stated MTK_ROOT=<path> this session; CLAUDE.md, .claude/tech-stack, .claude/rules/, tasks/, docs/, .mtk/ stay project-relative.
Run a fast, security-focused review on staged changes only. This is the lightweight check engineers should run before every commit.
Process
- Get the staged diff:
git diff --cached - If nothing staged, check unstaged:
git diff - If nothing at all, tell the engineer there's nothing to review
- Run the static linter pass first:
bash hooks/pre-commit-linters.sh- Emits deterministic findings with
source: "linter"andconfidence: 100 - Findings include secrets, raw SQL interpolation, connection strings with plaintext passwords, AWS keys, JWTs, and stack-specific patterns
- Merge linter findings into your final JSON output (they always pass the
threshold, so they always surface)
4.5. Merge cached analyzer output (if available). If
.mtk/analyzer-output.jsonexists and was modified within the last 10 minutes, read it and filter findings to only those whosefilefield matches a file ingit diff --cached --name-only(orgit diff --name-onlyif using unstaged). Discard all other findings — surfacing repo-wide warnings on an unrelated commit erodes trust in the gate. Merge the filtered set into your output withsource: "analyzer"andconfidence: 100. Do not run the build yourself — the pre-commit gate must stay fast (seconds, not minutes). Only consume cached output. 4.6. Roslyn MCP tools (if available, .NET only). Ifdotnet-claude-kitis installed and theDetectAntiPatternstool is available, call it on the changed files for on-demand semantic analysis. Treat results assource: "analyzer",confidence: 100. This is fast (analyzes specific files, not full build) and catches EF Core, async, and disposal patterns that the regex linter misses. If the tool is not available, skip this step. 4.7. Collateral-churn check. Runbash hooks/collateral-guard.sh --cached(add--manifest docs/specs/<date>-<slug>.jsonwhen this commit belongs to a spec). It answers a question no other check asks: is this churn yours? It flags whitespace/EOL-only rewrites (a small edit to a CRLF file rewrites the whole file), generated artifacts riding along undeclared (onenpm installdrags a lockfile into a feature commit), and asset directories regenerated wholesale. Findings are warnings, not blocks — but each carries a working revert command, and a commit whose diff is mostly collateral hides the real change from every reviewer downstream. The dependency gate below is the separate, stricter question of what the lockfile churn contains.
- Emits deterministic findings with
4.8. Dependency-introduction gate (if a manifest changed). Detect whether
the staged diff touches any of these manifest files:
package.json, package-lock.json, pnpm-lock.yaml, yarn.lock,
*.csproj, Directory.Packages.props, requirements.txt, pyproject.toml,
Pipfile, poetry.lock, go.mod, Cargo.toml, Cargo.lock,
Gemfile, Gemfile.lock, composer.json. If any matches, list the
newly added dependencies (lines beginning with + introducing a new
package name) and walk each through the six-criteria rubric in
.claude/references/dependency-intake-checklist.md — existence & legitimacy
first, then scope, maintenance, size, security, license. A Poor on
criterion 0 blocks outright; two Poor ratings on criteria 1–5 for a single
dep block the commit; one Poor requires explicit override in the PR description.
Emit each problematic dep as a category: "dependency" finding with
source: "ai" and confidence ≥ 85 for Poor ratings backed by evidence
(CVE id, last-release date, license SPDX). Pure version bumps within the
same major skip the rubric (vulnerability scan only). Skip the gate
entirely when the checklist file is absent (older repos).
4.9. Monorepo ripple check. Run
bash scripts/monorepo-ripple.sh $(git diff --cached --name-only).
On a non-monorepo it exits 0 with no output (no false positives). On a
monorepo, each RIPPLE <pkg>: affects <downstream> line becomes a
category: "ripple", severity: "warning", source: "linter",
confidence: 90 finding. Ripples never block the commit on their own —
they exist to make the author aware that staged changes will affect
downstream packages.
5. Run the AI review pass on the same diff to catch issues the linter can't
reach (design, intent, context-sensitive rules). AI findings use
source: "ai" and their own confidence scores per the rubric.
6. Combine linter + AI findings into a single schema-conformant output.
Check only these (from .claude/rules/security.md §1.x and the generated pre-commit-review-list.md (tech-stack items); if neither exists, use the fallback list below):
- Secrets: Any hardcoded credentials, connection strings with passwords, API keys, tokens?
- SQL Injection: Any string-concatenated SQL? Must be parameterized only (EF Core LINQ is fine;
FromSqlRawwith concatenation is still injection — [.NET example]). - PII in Logs: Any PII (names, emails, account numbers) in log statements or exception messages?
- Auth Missing: Any new endpoints, internal ones included, without
[Authorize]orRequireAuthorization()? [.NET example] - Audit Missing: Any state-changing operations on financial data without audit log writes? [finance-domain example]
- Secrets in Env: Any connection strings or passwords hardcoded in
appsettings.jsonor CDK environment vars? [.NET/AWS example] - IAM Blast Radius: Any new IAM grants with
*resource that should be scoped? [AWS example] - Dependency Intake: New third-party dep added — does it pass the six-criteria gate in
.claude/references/dependency-intake-checklist.md? (APooron criterion 0, or two on criteria 1–5, blocks.)
Output Contract
Emit the schema-conformant output per .claude/references/review-finding-schema.md:
- Markdown table of surfaced findings (rows where
confidence >= threshold). - Fenced JSON block with the full structured result. If you need extra
context fields, stay within the canonical review envelope defined in
.claude/references/review-finding-schema.md.
Read .claude/review-config.json for the threshold (default 80; .claude/review-config.local.json overrides if present). Apply the confidence rubric and the anti-inflation rule.
- Any
criticalfinding at/above threshold →verdict: "NEEDS_CHANGES". - Otherwise →
verdict: "PASS". - If
findings[]is empty,below_threshold_rationaleis mandatory — state what you checked and why you conclude the diff is clean.
Keep the table tight. This is a pre-commit gate, not a full review.
Clean pass — compact output
When verdict is PASS and findings[] is empty, skip the table and JSON block entirely. Instead emit a single compact summary:
✅ Pre-commit review passed — 0 findings across 8 rules ({N} files, {A}+/{D}−)
Checked: secrets · SQL injection · PII in logs · auth · audit trail · env secrets · IAM scope · dependency intakeReplace {N}, {A}, {D} with actual file count, additions, and deletions from the diff.
This is the only output for a clean pass. No table, no JSON block, no rationale dump.
Findings present — full output
When there are findings (PASS with warnings/suggestions, or NEEDS_CHANGES), emit the standard schema output: markdown table + fenced JSON block per .claude/references/review-finding-schema.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

