# pre-commit

Check changed agent-instruction files as part of your normal commit workflow. Start with advisory findings, or add a severity threshold to block commits that need attention.

## Setup

With pre-commit available, add this entry to `.pre-commit-config.yaml`, preserving your existing hooks:

```yaml
repos:
  - repo: https://github.com/hermes-labs-ai/lintlang
    rev: v0.8.0
    hooks:
      - id: lintlang
```

Install the repository's hooks:

```bash
pre-commit install
```

The default hook selects changed `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and `SKILL.md` files at any depth; `agent.yaml`, `agent.yml`, and `agent.json`; `.github/copilot-instructions.md`; and `*.instructions.md` under `.github/instructions/`. No fixed input path is required.

## Verify

```bash
pre-commit run lintlang
pre-commit run lintlang --all-files
```

The first command checks matching staged files; the second checks all matching files tracked by Git. An unrelated commit can skip this hook. Findings are advisory by default, including a `FAIL` verdict; missing, unreadable, or unparseable inputs still fail.

## Choose a blocking threshold

Add this under the hook to block HIGH and CRITICAL findings:

```yaml
      - id: lintlang
        args: [--fail-on, fail]
```

Use `review` instead of `fail` to include MEDIUM findings. pre-commit appends changed filenames to `args`, so adding a path there does not replace the default selection.

For one fixed path on every commit, use all three settings:

```yaml
      - id: lintlang
        args: [AGENTS.md, --fail-on, fail]
        pass_filenames: false
        always_run: true
```

## Next steps

[Review an existing backlog with baselines](/docs/baselines) · [Understand verdicts](/docs/outputs) · [All integrations](/integrations)

To remove the integration, remove only its entry from your pre-commit configuration. The [released setup guide](https://github.com/hermes-labs-ai/lintlang/blob/c0cab00048220286858f227aaf4b13cc043f718b/docs/integrations.md#pre-commit) contains the full selection and argument contract.

