# commitlint vs Commitizen: Convenções de Commit

> commitlint vs Commitizen: um linter que valida mensagens de commit vs um prompt que ajuda você a escrever conventional commits. Papéis e adequação a CI comparados.

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

O commitlint valida mensagens de commit contra regras; o Commitizen guia você interativamente a escrever conventional commits. Eles se complementam.

O commitlint verifica se as mensagens de commit seguem uma convenção (comumente Conventional Commits), reprovando o commit ou o CI quando não seguem. O Commitizen fornece um prompt interativo que monta uma mensagem de commit em conformidade para você, reduzindo a chance de erros logo de início. Eles resolvem pontas diferentes do mesmo objetivo: o Commitizen ajuda os autores a escrever mensagens corretas, o commitlint as impõe - muitos times usam os dois.

## Comparison

|  | commitlint | Commitizen |
| --- | --- | --- |
| Papel | Valida mensagens | Guia a escrita de mensagens |
| Quando roda | hook commit-msg / CI | No momento do commit (prompt) |
| Imposição | Sim (reprova commits ruins) | Não (auxilia) |
| Configuração | Config + regras | Adapter (ex.: cz) |
| Melhor para | Impor convenção | Escrever convenção |

## No CI

O commitlint é a camada de imposição: rode-o em um hook commit-msg e novamente no CI nos commits de PR para que mensagens fora do padrão reprovem o build. O Commitizen ajuda localmente, mas não impõe nada sozinho. A configuração robusta é Commitizen (ou um template guiado) para escrever, mais commitlint no CI como portão.

## Acelere

O lint de mensagens de commit é leve; faça cache das dependências para que o job comece rápido. A verificação roda em runners de CI; runners gerenciados mais rápidos mantêm a etapa de validação quase instantânea.

## 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.

## O veredito

Impor uma convenção de commit para que mensagens ruins falhem: commitlint, idealmente no CI. Ajudar os autores a escrever mensagens em conformidade de forma interativa: Commitizen. Eles são complementares, não concorrentes - use o Commitizen para escrever e o commitlint para impor.

## 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
