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

# Cook Web Domain: types

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

## Scope

- This domain owns shared TypeScript declarations, ambient module definitions,
  and cross-domain frontend interfaces.

- Representative files in this subtree: `src/cook-web/src/types/global.ts`,
  `src/cook-web/src/types/shifu.ts`,
  `src/cook-web/src/types/markdown-flow-ui.d.ts`,
  `src/cook-web/src/types/i18n-keys.d.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/types/` before
  widening to global type and lint checks.

## Do

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

- Treat shared type exports as compatibility surfaces consumed across routes,
  stores, hooks, and components.

- Keep ambient declarations and module augmentation narrow so upstream package
  exports are not accidentally shadowed.

- Prefer updating source types together with their consumers instead of
  papering over mismatches with broad `any` casts.

## Avoid

- Do not replace an upstream module declaration wholesale when a small
  augmentation would be safer.

- Do not leave stale declaration files after refactors that move or rename
  shared types.

- Do not solve runtime-shape drift only in type files without fixing the
  owning implementation.

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

## Commands

- `rg -n "types" 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/types/` for focused Jest coverage
  when this subtree already has or gains tests.

## Tests

- Add or update focused tests closest to `src/cook-web/src/types/` 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/skills/module-augmentation-guardrails/SKILL.md

- `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.
