| name | description | model | tools | |||
|---|---|---|---|---|---|---|
precommit-setup |
Configure pre-commit hooks for code formatting, linting, and security checks |
claude-sonnet-4 |
|
Configure pre-commit hooks to enforce code quality before commits.
- Setting up new project with code quality enforcement
- Adding pre-commit hooks to existing project
- Updating pre-commit hook versions
- pre-commit-hooks - Basic checks (trailing whitespace, EOF, YAML syntax)
- ruff - Fast linting and formatting
- mypy - Type checking
- bandit - Security scanning (optional)
- rustfmt - Code formatting
- clippy - Linting
- cargo-check - Compilation check
- eslint - Linting
- prettier - Code formatting
- tsc - Type checking
# Render .pre-commit-config.yaml from template
python3 plugins/attune/scripts/attune_init.py \
--lang python \
--name my-project \
--path .This creates .pre-commit-config.yaml:
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
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2
hooks:
- id: ruff
args: [--fix]
- id: ruff-format# Install pre-commit tool
uv sync --extra dev
# Install git hooks
uv run pre-commit install
# Output:
# pre-commit installed at .git/hooks/pre-commit# Run on all files
uv run pre-commit run --all-files
# Test on staged files
git add .
uv run pre-commit run# Update to latest versions
uv run pre-commit autoupdate
# Example output:
# Updating https://github.com/astral-sh/ruff-pre-commit ... updating v0.14.0 -> v0.14.2# Skip specific hook for one commit
SKIP=mypy git commit -m "Work in progress"
# Skip all hooks for one commit
git commit --no-verify -m "Emergency fix"Add project-specific hooks in .pre-commit-config.yaml:
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: uv run pytest --collect-only -q
language: system
pass_filenames: false
always_run: trueEnsure CI runs the same checks:
# .github/workflows/pre-commit.yml
name: Pre-commit
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run pre-commit
run: |
pip install pre-commit
pre-commit run --all-files# Run only on changed files (default)
# vs
# Run on all files (slower)
uv run pre-commit run --all-files# Clear pre-commit cache
uv run pre-commit clean# See detailed output
uv run pre-commit run --verbose --all-filesSkill(attune:project-init)- Full project initializationSkill(attune:workflow-setup)- GitHub Actions setup