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

# Cook Web Domain: app

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

## Scope

- This domain owns Next.js App Router entry points, route-group layouts, route
  handlers, and page-level composition for learner, admin, and legal surfaces.

- Representative files in this subtree: `src/cook-web/src/app/layout.tsx`,
  `src/cook-web/src/app/page.tsx`, `src/cook-web/src/app/admin/layout.tsx`,
  `src/cook-web/src/app/c/layout.tsx`

- 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/app/` before
  widening to global type and lint checks.

## Do

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

- Keep route entry concerns in App Router files and move reusable logic into
  components, hooks, stores, or `lib/` when it spreads.

- Preserve route-parameter handling, redirect behavior, and metadata semantics
  across both the modern and legacy route groups.

- Treat app-route changes as integration changes that may affect auth, request
  bootstrapping, and shared providers.

## Avoid

- Do not embed large business helpers directly in `page.tsx` files when they
  belong in shared modules.

- Do not fork learner and admin route logic unless product behavior really
  diverges.

- Do not hardcode route parsing when shared URL or state helpers already exist
  in the frontend codebase.

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

## Commands

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

## Tests

- Add or update focused tests closest to `src/cook-web/src/app/` 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/skills/chat-layout-width-detection/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.
