# CLAUDE.md — Rust CLI

## Commands
- `cargo build` · `cargo test` · `cargo clippy --all-targets -- -D warnings` · `cargo fmt`

## Conventions
- CLI args with `clap` derive. Binary in `src/main.rs` stays tiny; logic in `src/lib.rs` modules so it's testable.
- Errors: `thiserror` for library error enums, `anyhow` with `.context("...")` in the binary.
- No `unwrap()`/`expect()` outside tests and truly impossible cases (comment why).
- Prefer borrowing (`&str`, `&[T]`) in function params; clone only when ownership is needed.
- Output for humans on stdout, diagnostics on stderr; support `--json` for machine output.
- Integration tests in `tests/` using `assert_cmd`.

## Before finishing
- fmt + clippy clean with zero warnings, tests green.
