baml-expertlisted
Install: claude install-skill air-gapped/skills
# BAML expert
BAML = small DSL for typed LLM calls. Author `.baml` files in `baml_src/`, run `baml-cli generate`, get a typed Python package at `baml_client/`. The generated `b` object exposes each function as a typed method. BAML handles prompt rendering, HTTP, retries, fallbacks, streaming, and **Schema-Aligned Parsing (SAP)** — robust coercion of messy LLM output into typed objects.
Use this skill for any task touching `.baml` files, `baml_client`, or calls into it. Read the full repo layout first if unclear: the convention is `baml_src/*.baml` + generated `baml_client/` (gitignored; regenerated on every change).
## Mental model (critical)
```
baml_src/*.baml ──baml-cli generate──▶ baml_client/ (Pydantic + async/sync client)
```
At call time, for each function:
1. Render the prompt (Minijinja).
2. Build HTTP request for the configured provider.
3. Apply retry / fallback / round-robin / timeout policy.
4. Parse raw output with **SAP** — tolerant of missing quotes, trailing commas, markdown fences, chain-of-thought preamble, fractions as floats, etc.
5. Return typed object OR raise a typed error (`BamlValidationError`, `BamlClientError`, `BamlTimeoutError`, `BamlAbortError`).
**Never edit `baml_client/`.** It regenerates. Edit `.baml` files and rerun `baml-cli generate`.
## Workflow for typical tasks
When the user asks for a change in a BAML project, do this:
1. **Read the BAML sources first.** `ls baml_src/`, then read the relevant `.baml` files. They're plain