bookie-tddlisted
Install: claude install-skill a-canary/arc-agents
# bookie-tdd — TDD Template for Bookie Tasks
Use when adding or changing bookie validation rules, ledger write contracts, or bookie subagent logic. Applies to any task touching `src/ledger/bookie-validator.ts`, `src/ledger/kinds.ts`, `src/ledger/merge-guard.ts`, or any other pure-validator module in `src/ledger/`.
## Guiding principle
**Pure functions, no DB.** Bookie validators are total functions over inputs. They take typed arguments and return typed errors or void. They never touch `~/vault/ledger.db`. This makes them trivially testable: one `describe`/`test` block, one `expect()` per assertion, no setup/teardown.
When the logic is pure, TDD is cheap. Write the failing test first.
## Red-green-refactor loop for bookie tasks
### Phase 1 — Red: write the failing acceptance test
The test encodes a **behavior** (not an implementation). It lives in `src/ledger/<module>.test.ts` alongside the module under test.
For a new validator:
```typescript
import { test, expect } from "bun:test";
import { validateBookieWrite, type BookieWriteInput } from "./bookie-validator";
// ── new behavior ────────────────────────────────────────────────────────────
test("validateBookieWrite: rejects kind='sprint' without source_module", () => {
const errs = validateBookieWrite(
{ kind: "sprint", class: "ops", urgency: "nominal", class_rationale: "test" },
new Set(["arc-chat"]),
);
expect(errs.some((e) => e.field === "source_module")).toBe(true);
});
```
For a new enum value: