pre-commit-check

A pre-commit command that checks recent code changes for architecture, security, TypeScript, and documentation issues using four parallel review agents.

In plain words
What is it for?
It helps review changed files for dependency direction, secrets, injection risks, TypeScript practices, documentation updates, and consistency with project guides.
Why use it?
It catches common problems before code is committed, including unsafe input handling, misplaced files, type issues, and outdated documentation.

Command for Claude Code

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 commands/yuji0809/cc-recommender/pre-commit-check
Clone the repo
git clone --depth 1 https://github.com/yuji0809/cc-recommender

Made for: Claude Code.

Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,060 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.00031 $0.01060
Opus 5 $0.00015 $0.00530
Sonnet 5 $0.00006 $0.00212
Haiku 4.5 $0.00003 $0.00106

Measured 2d ago against content hash b85ccaa6f18a, 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-check 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.

.claude/commands/pre-commit-check.md · 107 lines

What it actually says

コミット前チェック

このコマンドは、コミット前に以下の4つのチェックを並列で実行します:

チェック内容

  1. アーキテクチャチェック - 設計思想とディレクトリ構造の確認
  2. セキュリティチェック - セキュリティベストプラクティスの確認
  3. TypeScriptチェック - 型安全性とベストプラクティスの確認
  4. ドキュメントチェック - MDファイルの最新性とコードとの整合性の確認

実行方法

4つのエージェントを並列で同時に呼び出して、最近の変更をチェックしてください。

並列実行

以下の4つのエージェントを同時に起動します:

Architecture Agent:

最近変更されたファイルをチェックして、アーキテクチャガイドラインに沿っているか確認してください。特に以下を確認:
- ファイルの配置は適切か
- ファイル命名規則に従っているか
- 直接インポートを使用しているか
- レイヤー間の依存方向は正しいか
- 循環依存はないか

Security Agent:

最近変更されたファイルをチェックして、セキュリティベストプラクティスに従っているか確認してください。特に以下を確認:
- 機密情報が含まれていないか
- 入力バリデーションは適切か
- コマンドインジェクションの脆弱性はないか
- ファイル操作は安全か
- エラーハンドリングは適切か

TypeScript Agent:

最近変更されたファイルをチェックして、TypeScriptのベストプラクティスに従っているか確認してください。特に以下を確認:
- any を使用していないか
- 型推論を適切に活用しているか
- interface ではなく type を使用しているか
- 関数の型定義は適切か
- エラーハンドリングは型安全か

Documentation Agent:

最近変更されたファイルに関連するドキュメントをチェックして、最新の状態になっているか確認してください。特に以下を確認:
- 新機能が追加された場合、README.md に記載されているか
- 新しいファイル・ディレクトリが追加された場合、CLAUDE.md に記載されているか
- アーキテクチャ変更がある場合、docs/ARCHITECTURE.md に反映されているか
- README.md と README.ja.md が同期されているか
- CHANGELOG.md に今回の変更が記録されているか
- コードサンプルが最新の実装と一致しているか

💡 並列実行のメリット: 4つのチェックが同時に実行されるため、順次実行よりも大幅に高速です。

チェック完了後

すべてのチェックが完了したら、以下を確認してください:

  • アーキテクチャチェックで問題が指摘されていないか
  • セキュリティチェックで問題が指摘されていないか
  • TypeScriptチェックで問題が指摘されていないか
  • ドキュメントチェックで問題が指摘されていないか
  • 指摘された問題をすべて修正したか
  • ドキュメントが最新の状態に更新されているか

すべてクリアした場合のみコミットを実行してください。

自動チェックコマンド

手動チェックの前に、以下の自動チェックも実行することを推奨します:

# 型チェック
pnpm run typecheck

# Lint
pnpm run lint

# セキュリティ監査
pnpm run audit

# ライセンスチェック
pnpm run license:check

# 全チェック
pnpm run check

注意事項

  • このコマンドは コミット前 に実行してください
  • 問題が見つかった場合は、必ず修正してからコミットしてください
  • CI/CDでも同様のチェックが実行されるため、ローカルで事前に確認することで時間を節約できます
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 · 107 lines · 31 tokens per session scan A b85ccaa6f18a

Subscribe to this mod's changes

pre-commit-check is a command published in the GitHub repository yuji0809/cc-recommender (10 stars, last pushed 3mo ago), licensed MIT. It adds 31 tokens to every session and 1,060 once invoked, about $0.0002 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.