# AGENTS.md — TypeScript

Drop this in your repository root and symlink CLAUDE.md to it:

    ln -s AGENTS.md CLAUDE.md

Then delete every line that is not true of YOUR repository, and add the
corrections you have had to make to an agent twice. Under 100 lines is the
target — every line competes for attention with every other line.

From TypeScript at https://learn-typescript.org/ai/ — free to use, MIT.

---

TypeScript 5.x strict, pnpm, Node LTS.

## Commands
- Check:  `pnpm check`  (tsc --noEmit && eslint . && vitest run)
- Types:  `pnpm tsc --noEmit`
- Test:   `pnpm vitest run`

## tsconfig is not negotiable
strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes,
noFallthroughCasesInSwitch, verbatimModuleSyntax.

## Conventions
- External data is PARSED with a schema (zod), never cast. `as` on a network
  or database response is a bug.
- Model state as a discriminated union, not optional fields. Make illegal
  states unrepresentable.
- Branded types for ids and money: UserId is not OrgId is not string.
- Exhaustive switches end with assertNever(x).
- No `any`. `unknown` plus a narrowing check instead.
- No non-null assertions (`!`) — narrow properly.
- await every promise. Floating promises are errors, not warnings.

## Review
Grep the diff for: ` as `, `: any`, `@ts-ignore`, `!.`. Each one needs
a justification or a rewrite.
