ワンクリックで
pre-commit-review
Fast security-focused review of staged changes before every commit, checking only critical compliance rules
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Fast security-focused review of staged changes before every commit, checking only critical compliance rules
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Corrective batch of multiple small independent fixes (apply review findings, several/multiple fixes across >3 files, no new contract or architecture) — broader than fix, lighter than implement.
One-time repo setup that detects tech stack, audits the codebase, pulls coding guidelines, and generates a project-specific CLAUDE.md
Full feature implementation loop orchestrating planning, batching, verification, and review skills
Use when the task is a new feature, breaking change, multi-file change, or any work where approval should happen before coding begins.
Use to create, update, and read durable workflow state under .mtk/workflows/ so orchestration survives compaction, crash, and session handoff.
Use after a spec is approved and before multi-file implementation begins, to break work into verifiable batches with checkpoints.
| name | pre-commit-review |
| description | Fast security-focused review of staged changes before every commit, checking only critical compliance rules |
| type | skill |
| user-invocable | false |
MTK files (hooks/, .claude/references/, .claude/review-config.json) live either in the project (local install) or the plugin cache (marketplace install). Resolve once:
$CLAUDE_PLUGIN_ROOT is set, prefix hooks/, .claude/references/, and .claude/review-config.json reads with it.hooks/pre-commit-linters.sh exists locally → project-relative paths work as-is.find ~/.claude/plugins -maxdepth 8 -name "pre-commit-linters.sh" -path "*/mtk/*" -type f 2>/dev/null | sort -V | tail -1 | sed 's|/hooks/pre-commit-linters.sh||'. If empty, skip the linter pass and run the AI review only.Run a fast, security-focused review on staged changes only. This is the lightweight check engineers should run before every commit.
git diff --cachedgit diffbash hooks/pre-commit-linters.sh
source: "linter" and confidence: 100.mtk/analyzer-output.json
exists and was modified within the last 10 minutes, read it and filter
findings to only those whose file field matches a file in
git diff --cached --name-only (or git diff --name-only if 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 with source: "analyzer" and confidence: 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). If dotnet-claude-kit is
installed and the DetectAntiPatterns tool is available, call it on the
changed files for on-demand semantic analysis. Treat results as
source: "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. 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 5-criteria rubric in
.claude/references/dependency-intake-checklist.md — scope, maintenance,
size, security, license. Two Poor ratings on a single dep blocks 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.8. 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.source: "ai" and their own confidence scores per the rubric..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):[Authorize] or RequireAuthorization()? [.NET example]appsettings.json or CDK environment vars? [.NET/AWS example]* resource that should be scoped? [AWS example].claude/references/dependency-intake-checklist.md? (Two Poor ratings block.)| Rationalization | Reality |
|---|---|
| "It's just a DTO change, no security implications" | DTOs define what data crosses trust boundaries. A missing [JsonIgnore] on an internal field leaks data. Check it. |
| "EF Core handles parameterization, so SQL injection isn't possible here" | EF Core handles it when you use LINQ. FromSqlRaw with string concatenation is still injection. Check for raw SQL. |
"This is an internal endpoint, it doesn't need [Authorize]" | Internal endpoints get exposed. Network boundaries shift. Auth on every endpoint. No exceptions. |
| "The audit trail isn't needed here — this doesn't touch financial data" | If it mutates state that affects financial calculations, reports, or compliance records, it needs an audit trail. "Financial data" is broader than you think. |
| "This change is too small to have security implications" | The smallest changes cause the biggest incidents. A one-line config change can expose a connection string. A renamed property can break auth middleware. Check every diff. |
| "I already reviewed this mentally, running the checklist is redundant" | Mental reviews miss things. That's the whole point of a checklist. Pilots don't skip pre-flight because they "already know the plane works." |
Emit the schema-conformant output per .claude/references/review-finding-schema.md:
confidence >= threshold)..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.
critical finding at/above threshold → verdict: "NEEDS_CHANGES".verdict: "PASS".findings[] has fewer than 2 entries, below_threshold_rationale is 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.
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 intake
Replace {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.
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.