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

# Cook Web Domain: c-api

This file adds local guidance for `src/cook-web/src/c-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 legacy compatibility API wrappers used by the `c`
  experience and older frontend business flows.

- Representative files in this subtree: `src/cook-web/src/c-api/c.ts`,
  `src/cook-web/src/c-api/course.ts`, `src/cook-web/src/c-api/lesson.ts`,
  `src/cook-web/src/c-api/studyV2.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/c-api/` before
  widening to global type and lint checks.

## Do

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

- Preserve legacy request shapes and naming as long as the `c` routes still
  depend on them.

- Treat this directory as a compatibility layer and move genuinely new shared
  APIs to the modern request stack first.

- Keep contracts aligned with the legacy stores and service helpers that still
  consume these wrappers.

## Avoid

- Do not silently break `c` route payload expectations while adding a
  modern-only feature elsewhere.

- Do not duplicate identical endpoint wrappers in both `c-api` and the modern
  `api` domain without an intentional adapter boundary.

- Do not bypass shared auth or request primitives when updating this legacy
  compatibility layer.

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

## Commands

- `rg -n "c-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/c-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/c-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/skills/deep-link-lessonid-routing/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.
