# commitlint vs Commitizen: コミットの規約

> commitlint vs Commitizen: コミットメッセージを検証するlinter vs conventional commitsを書くのを助けるプロンプト。役割とCIへの適合性を比較。

Source: https://latchkey.dev/ja/learn/tool-comparisons/commitlint-vs-commitizen  
Updated: 2026-06-26

commitlintはコミットメッセージをルールに照らして検証します。Commitizenはconventional commitsを書くよう対話的に導きます。両者は互いを補完します。

commitlintはコミットメッセージが規約(一般的にはConventional Commits)に従っているかをチェックし、従っていない場合はコミットまたはCIを失敗させます。Commitizenは、準拠したコミットメッセージを組み立ててくれる対話的なプロンプトを提供し、そもそもの間違いの可能性を下げます。両者は同じ目標の異なる側面を解決します。Commitizenは作者が正しいメッセージを書くのを助け、commitlintはそれを強制します - 多くのチームは両方を使います。

## Comparison

|  | commitlint | Commitizen |
| --- | --- | --- |
| 役割 | メッセージを検証 | メッセージ作成を導く |
| 実行タイミング | commit-msg hook / CI | コミット時(プロンプト) |
| 強制 | あり(悪いコミットを失敗させる) | なし(補助する) |
| セットアップ | 設定 + ルール | アダプタ(例: cz) |
| 最適な用途 | 規約の強制 | 規約に沿った作成 |

## CIでの利用

commitlintは強制の層です。commit-msg hookで実行し、さらにPRのコミストに対してCIでも実行して、規約に沿わないメッセージがビルドを失敗させるようにします。Commitizenはローカルで役立ちますが、それ自体では何も強制できません。堅牢な構成は、作成にCommitizen(またはガイド付きテンプレート)を、ゲートとしてCIにcommitlintを組み合わせる形です。

## 高速化する

コミットメッセージのlintは軽量です。依存関係をキャッシュしてジョブが素早く始まるようにします。チェックはCIランナー上で実行され、より高速なマネージドランナーは検証ステップをほぼ瞬時に保ちます。

## Benchmark on your repository before choosing

Build-tool benchmarks published by vendors use repositories chosen to show a difference. Yours is the only one that matters, and both a cold and a warm measurement are needed because CI mostly runs cold.

```Terminal
# cold: no cache, the CI condition
rm -rf node_modules/.cache dist && time <tool> build

# warm: the local development condition
time <tool> build

# and the one people forget: incremental after a one-line change
echo "// touch" >> src/index.ts && time <tool> build
```

> Cold and warm can rank the two tools in opposite orders. Decide which one you are optimising for first: CI time is cold, developer feedback is warm and incremental.

## 結論

悪いメッセージが失敗するようコミット規約を強制する: commitlint、理想的にはCIで。作者が準拠したメッセージを対話的に書くのを助ける: Commitizen。両者は競合ではなく補完的です - 書くのにCommitizen、強制にcommitlintを使いましょう。

## FAQ

### commitlint vs Commitizen: Commit Conventions?

commitlint checks that commit messages follow a convention (commonly Conventional Commits), failing the commit or CI when they do not. Commitizen provides an interactive prompt that builds a compliant commit message for you, lowering the chance of mistakes in the first place.

### In CI?

commitlint is the enforcement layer: run it in a commit-msg hook and again in CI on PR commits so non-conforming messages fail the build. Commitizen helps locally but cannot enforce anything by itself. The robust setup is Commitizen (or a guided template) for authoring plus commitlint in CI as the gate.

### Speed it up?

Commit-message linting is lightweight; cache dependencies so the job starts quickly. The check runs on CI runners; faster managed runners keep the validation step near-instant.

### Which should I choose?

Enforcing a commit convention so bad messages fail: commitlint, ideally in CI. Helping authors write conforming messages interactively: Commitizen. They are complementary, not competitors - use Commitizen to author and commitlint to enforce.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
