Skip to content

Menu

Pre-commit Config Generator

Generate .pre-commit-config.yaml

Runs entirely in your browserDevOpsFree, no sign-up
Loading tool

01What is Pre-commit Config Generator?

Git hooks are easy to forget and awkward to share, because the .git/hooks folder never gets committed. The pre-commit framework fixes that. You describe your hooks in a .pre-commit-config.yaml file at the repo root, run pre-commit install once, and every commit then checks the staged files first. This generator hands you a starting file so you don't have to look up repo URLs, revs and hook IDs by hand. There are three presets: python, node and fullstack. Each one is a fixed list of repos, and the page writes them out in the format the pre-commit docs describe: a repos list, where every entry has a repo URL, a pinned rev and a hooks list. A hook's id is always written. Extra keys like args, files, types, stages and additional_dependencies only appear when the preset sets them. The python preset starts with pre-commit-hooks v6.0.0 (trailing whitespace, end-of-file fixer, YAML check, large-file check, merge-conflict markers). It adds ruff-check with --fix, ruff-format, and mypy with --ignore-missing-imports. We left Black out on purpose, since Ruff's formatter aims to be Black-compatible and two formatters tend to fight. The node preset swaps in check-json, ESLint from pre-commit/mirrors-eslint with --fix, and Prettier from rbubley/mirrors-prettier. The ESLint hook gets files: \.[jt]sx?$ and types: [file], so it also covers .jsx, .ts and .tsx. The fullstack preset is about safety. It raises the large-file limit to 1000 KB and adds detect-private-key, gitleaks and commitizen. Here's a quick example. Pick fullstack and the YAML panel opens with a comment telling you to also run pre-commit install --hook-type commit-msg. That line only appears when a commitizen repo is in the list, because commitizen checks the commit message, not your files. Now the honest limits. You can't add, remove or edit hooks in the page. You pick a preset and copy it. The revs are hardcoded, so they will age, and pre-commit autoupdate is the fix. The node preset's @eslint/js dependency is written in double quotes, because YAML doesn't allow a plain value to start with @.

Python and JavaScript developers setting up a new repo who want working pre-commit hooks without hunting down repo URLs, revs and hook IDs. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Pre-commit Config Generator

  1. Click python, node or fullstack at the top, or pick Python project, Node.js project or Full-stack from the examples.
  2. Check the repo cards. Each one shows the repo path, its pinned rev and the hook IDs it runs.
  3. Click Copy and save the text as .pre-commit-config.yaml in your repository root.
  4. Run pip install pre-commit, then pre-commit install. Add --hook-type commit-msg if you used fullstack.
  5. Run pre-commit run --all-files once so existing files get fixed in a single commit.
  6. Use the Reset button to go back to the python preset.

03Worked examples

Input: python preset
Result: repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - id: check-merge-conflict - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.17.4 hooks: - id: ruff-check args: ["--fix"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v2.4.1 hooks: - id: mypy args: ["--ignore-missing-imports"]
The two comment lines with pre-commit.com links at the top are trimmed here.
Input: node preset (ESLint entry only)
Result: - repo: https://github.com/pre-commit/mirrors-eslint rev: v10.14.0 hooks: - id: eslint args: ["--fix"] files: \.[jt]sx?$ types: [file] additional_dependencies: - [email protected] - "@eslint/[email protected]" - [email protected] - typescript
Trimmed to the ESLint repo. The @eslint/js line is quoted, since a plain YAML value can't start with @.
Input: fullstack preset
Result: # commitizen checks commit messages: also run `pre-commit install --hook-type commit-msg` repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-json - id: check-added-large-files args: ["--maxkb=1000"] - id: check-merge-conflict - id: detect-private-key - repo: https://github.com/gitleaks/gitleaks rev: v8.30.1 hooks: - id: gitleaks - repo: https://github.com/commitizen-tools/commitizen rev: v4.19.3 hooks: - id: commitizen
The commitizen reminder comment is added only when a commitizen repo is in the list. The two pre-commit.com link comments are trimmed.
Input: node preset (Prettier entry only)
Result: - repo: https://github.com/rbubley/mirrors-prettier rev: v3.9.10 hooks: - id: prettier
Prettier comes from rbubley/mirrors-prettier because pre-commit/mirrors-prettier is archived.

04Common use cases

  • Starting a FastAPI or Django repo with Ruff and mypy checks running on every commit
  • Giving a TypeScript team the same ESLint and Prettier pass locally that CI runs later
  • Stopping AWS keys or SSH private keys from landing in a repo with gitleaks and detect-private-key
  • Enforcing commitizen-style commit messages before switching on automated changelogs
  • Blocking files over 1000 KB from slipping into a repo that keeps getting bloated with build output
  • Showing a new contributor a working baseline config instead of a blank YAML file

05Tips

  • The mirrors-eslint hook runs in its own Node environment and can't see your node_modules. Every plugin your eslint.config imports must go in additional_dependencies.
  • In pre-commit, all tags under types must match at once. Use types_or or a files regex when you want several file kinds.
  • Run pre-commit autoupdate after copying. It bumps each rev to the newest tag and rewrites the file for you.
  • Don't add Black next to ruff-format. Two formatters can rewrite the same lines back and forth on every commit.

06Related concepts

pre-commit, Git hooks, Linting, Secret scanning, Conventional Commits.

Frequently Asked Questions

What is Pre-commit Config Generator?

Pre-commit Config Generator is a free, browser-based developer tool on AIDToolStack. Generate .pre-commit-config.yaml It requires no installation or sign-up and works entirely in your browser.

Is Pre-commit Config Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Pre-commit Config Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe