# Lint automatically with hooks

Follow the steps to create a pre-commit hook

1. Create the file `pre-commit` inside the path `.git/hooks/` of your local repository with this content:

```bash
#!/bin/bash

ROOT_DIR="$(git rev-parse --show-toplevel)"

echo "Running Flake8"
flake8 ${ROOT_DIR} --statistics
```

1. Assign it execution permission

```shell
$ chmod +x .git/hooks/pre-commit
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://phoenix-7.gitbook.io/nodechain-en/develop/how-to/lint-automatically-with-hooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
