Configures pre-commit hooks for linting, type checking, formatting, and testing. Use when setting up a new project or adding quality gates to an existing one.
Configures pre-commit hooks for linting, type checking, formatting, and testing. Use when setting up a new project or adding quality gates to an existing one.
Start with strict settings from the beginning: they are
easier to maintain over time. Configure type checking with
strict = true in pyproject.toml, set up testing early
(include pytest in pre-commit), and document the reason
whenever you must skip a hook.
For Existing Projects
Use a gradual adoption strategy. Start with global checks
(Layer 1), then add component-specific checks (Layer 2)
once legacy issues are resolved. Use --no-verify only for
true emergencies and document why.
For Monorepos and Plugin Architectures
Standardize per-component Makefiles for lint, typecheck,
and test targets. Centralize common settings in a root
pyproject.toml while allowing per-component overrides.
Automate change detection so commits stay fast, and use
progressive disclosure (summary first, detail on failure).
Related Skills
Skill(attune:project-init): Full project initialization
Skill(pensive:shell-review): Audit shell scripts for
exit-code and safety issues
See Also
Quality Gates: three-layer validation: pre-commit
hooks (formatting, linting), CI checks (tests, coverage),
and PR review gates (code quality, security).
Exit Criteria
.pre-commit-config.yaml exists at the project root with hooks covering at minimum
Layer 1 (whitespace, YAML/TOML/JSON syntax, global linting).
uv run pre-commit run --all-files exits 0 after the configuration is installed,
confirming all hooks pass on the current codebase state.
git commit with a staged change triggers the pre-commit hooks automatically (verified
by uv run pre-commit install exit code 0 and presence of .git/hooks/pre-commit).
Any --no-verify bypass is absent from the project's documented workflows; if one is
found in existing scripts, it is flagged as a violation rather than silently accepted.