# AI Assistant Skill

Bayesline ships a drift-resistant **skill** that teaches an AI coding assistant how to use the
Bayesline Python API (`bayesline.apiclient` + `bayesline.api`) correctly — building risk models,
uploading custom data, running reports, configuring portfolios, and explaining the engine's math.
It works with **Claude Code** and with **Codex** (and other `AGENTS.md`-based assistants).

The skill keeps API schemas and footguns as a single source of truth and points at the tutorial
and recipe notebooks in this documentation for runnable, CI-tested worked examples — so it cannot
silently drift from the real API.

```{note}
The skill bundle is **available on request**. Reach out to your Bayesline contact and we'll
provide it alongside your deployment.
```

## Install

First install the client and point it at your deployment:

```bash
pip install bayesline-apiclient
export BAYESLINE_ENDPOINT=https://your-deployment.example.com
export BAYESLINE_API_KEY=...        # omit for a local no-auth engine
```

**Claude Code** — unzip the bundle so it lives at `.claude/skills/bayesline-api/` in your project
(or under `~/.claude/skills/` to use it everywhere). Claude discovers it automatically via
`SKILL.md` and loads reference files on demand.

**Codex / other `AGENTS.md` assistants** — place the unzipped folder in your project and make sure
its `AGENTS.md` is discoverable (e.g. at the project root, or copy its contents into your existing
`AGENTS.md`). These assistants have no skill auto-discovery, so `AGENTS.md` directs them to read
`reference/02-mental-model.md` first.

## What's inside

| Path | Purpose |
|---|---|
| `SKILL.md` / `AGENTS.md` | Entry point + reference map (Claude / Codex) |
| `reference/*.md` | API schemas, idioms, footguns, and the math reference |
| `notebooks/*.ipy` | Runnable, CI-tested worked examples |
| `notebook_env.py` | Connection shim (reads `BAYESLINE_ENDPOINT` / `BAYESLINE_API_KEY`) |
| `scripts/*.py` | Copy-paste utilities (smoke test, dataset describe, tie-out) |

The notebooks are the same ones rendered in the {doc}`Tutorials <tutorials>` and
{doc}`Recipes <recipes>` sections of these docs; open any of them and run the cells against your
own deployment.
