> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Quality

> Format and validate your code before committing

Run formatting and validation before pushing changes to ensure code quality.

## Format

Format the codebase using [ruff](https://docs.astral.sh/ruff/):

<CodeGroup>
  ```bash Script theme={null}
  ./scripts/format.sh
  ```

  ```bash Direct theme={null}
  ruff format .
  ```
</CodeGroup>

## Validate

Lint and type-check using [ruff](https://docs.astral.sh/ruff/) and [mypy](https://mypy.readthedocs.io/en/stable/):

<CodeGroup>
  ```bash Script theme={null}
  ./scripts/validate.sh
  ```

  ```bash Ruff only theme={null}
  ruff check .
  ```

  ```bash Mypy only theme={null}
  mypy .
  ```
</CodeGroup>

<Note>
  Configuration is in `pyproject.toml`. Run both scripts before every commit.
</Note>

## Pre-commit Workflow

```bash theme={null}
# 1. Format
./scripts/format.sh

# 2. Validate
./scripts/validate.sh

# 3. If both pass, commit
git add .
git commit -m "your message"
```

## Common Issues

| Issue            | Solution                                      |
| ---------------- | --------------------------------------------- |
| `ruff` not found | Run `uv pip install ruff`                     |
| `mypy` not found | Run `uv pip install mypy`                     |
| Type errors      | Fix the types or add `# type: ignore` comment |
| Import sorting   | Run `ruff check --fix .` to auto-fix          |
