<!-- Generated by scripts/generate_ai_collab_docs.py. Edit metadata in that script. -->

# Cook Web Domain: api

This file adds local guidance for `src/cook-web/src/api`. Read the repository
root and `src/cook-web/AGENTS.md` first, then use this file for
domain-specific frontend ownership.

## Scope

- This domain owns thin endpoint definition wrappers that expose Cook Web API
  calls on top of the shared request and generated-client helpers.

- Representative files in this subtree: `src/cook-web/src/api/api.ts`,
  `src/cook-web/src/api/index.ts`

- Keep durable frontend rules here only when they are more specific than the
  Cook Web-wide guidance in the parent directory.

- Use focused frontend verification around `src/cook-web/src/api/` before
  widening to global type and lint checks.

## Do

- Start from the local entry files and preserve how `api` currently separates
  route code, shared logic, state, and utilities.

- Keep this layer declarative and thin so endpoint wiring stays easy to audit
  against backend contracts.

- Prefer the shared `lib/request.ts` and `lib/api.ts` stack instead of
  creating per-endpoint fetch wrappers here.

- Treat exported API functions as compatibility surfaces consumed by pages,
  hooks, and stores across the app.

## Avoid

- Do not add ad-hoc response-shape parsing here when centralized business-code
  handling already exists lower in the stack.

- Do not duplicate route constants or auth-header behavior that belongs in
  shared request utilities.

- Do not mix legacy `c-api` compatibility helpers into this modern API layer
  without an explicit adapter.

- Avoid pushing domain-local rules up to shared docs unless another frontend
  subtree truly depends on the same constraint.

## Commands

- `rg -n "api" src/cook-web/src` to locate call sites before editing this
  subtree.

- `cd src/cook-web && npm run type-check` after TypeScript, store, hook,
  request, or route-contract changes.

- `cd src/cook-web && npm run lint` before closing the task when shared
  frontend code or route files changed.

- `cd src/cook-web && npm run test -- src/api/` for focused Jest coverage when
  this subtree already has or gains tests.

## Tests

- Add or update focused tests closest to `src/cook-web/src/api/` for the happy
  path and the most important regression or business-code error path.

- Rerun type-checking and linting when exported props, store fields, hook
  contracts, or route behavior move.

- When a domain depends on shared request or normalization helpers, update
  those tests or add new ones in the same task.

- Document skipped UI, browser, or provider-dependent verification in the task
  summary when local automation cannot cover it.

## Related Skills

- `src/cook-web/SKILL.md`

- `SKILL.md`

- Create a focused skill under `src/cook-web/skills/<topic>/SKILL.md` when the
  same debugging or migration workflow repeats.
