# Contributing

We welcome contributions to the Tinker Cookbook — new recipes, bug fixes, documentation improvements, and feature additions.

## Getting started

```
git clone https://github.com/thinking-machines-lab/tinker-cookbook.git
cd tinker-cookbook
uv sync --extra dev
pre-commit install
```

## Running tests

```
# Unit tests (no API key needed)
uv run pytest tinker_cookbook/

# Integration tests (requires TINKER_API_KEY)
uv run pytest tests/
```

## Code style

We use [ruff](https://docs.astral.sh/ruff/) for linting and formatting (line length: 100). Pre-commit hooks run automatically.

```
uv run ruff check tinker_cookbook/
uv run ruff format tinker_cookbook/
```

## Pull request process

1. Create a feature branch from `main`
2. Make your changes with tests if applicable
3. Ensure all checks pass: `pre-commit run --all-files`
4. Open a PR with a clear description

CI runs pre-commit, pyright, and pytest on every PR.

## Adding a new recipe

Recipes live in `tinker_cookbook/recipes/`. Each recipe has:

- A training script (e.g., `train.py`) with a `CLIConfig` for command-line usage
- A `README.md` explaining the task, how to run it, and expected results
- Optional data preparation scripts

Follow the existing recipes as a template — [chat_sl](https://github.com/thinking-machines-lab/tinker-cookbook/tree/main/tinker_cookbook/recipes/chat_sl) is a good starting point.
