Pre-commit Config Builder

Enforce code quality automatically. Select the tools you use, and generate a configuration file for your Git pre-commit hooks.

1. Select Hooks

2. Generated Config (`.pre-commit-config.yaml`)

Frequently Asked Questions

What is a pre-commit hook?

A pre-commit hook is a script that runs automatically every time you try to make a Git commit. It's used to inspect the code being committed, for example, to check for style errors, run tests, or lint the code. If the hook script fails, the commit is aborted, helping to maintain code quality.

What is the difference between `pre-commit` and `lint-staged`?

`pre-commit` is a framework for managing git hooks written in any language. `lint-staged` is a popular tool in the JavaScript ecosystem that works with `husky` to run linters on your staged files. This tool can help you generate configurations for either.

How do I use the generated configuration?

For `pre-commit`, you would save the generated YAML content as `.pre-commit-config.yaml` in your repository root and run `pre-commit install`. For `lint-staged`, you would add the generated JSON object to your `package.json`.

What are some common hooks to include?

Common and highly recommended hooks include formatters like Prettier, linters like ESLint for JavaScript or Ruff for Python, and tools that check for large files or secrets being committed.

Does this tool install the hooks for me?

No, this tool only generates the configuration file content. You will still need to install the hook manager (like `pre-commit` or `husky`) and the linters/formatters themselves as development dependencies in your project.