Imported from CASA-School/casa-website (
AGENTS.md). Install upstream withnpx skills add CASA-School/casa-website. Copyright stays with the author.
Casa Agent Rules
Project-specific operating rules for coding agents in this repository.
1) Change Strategy
- Keep diffs minimal and targeted.
- Prefer one file at a time for edits unless a multi-file change is required for correctness.
- Verify local context before broad edits; do not assume patterns.
- Do not introduce new abstractions when existing patterns already solve the use case.
- If a fact is not verifiable in repo, mark it as
TODOorASSUMPTION.
2) Pattern Adherence
- Follow existing App Router structure and domain grouping (
src/app,src/components/<domain>,src/lib/<domain>). - Reuse guard and API helpers instead of custom access patterns:
requirePageRolesrequireApiRoles/requirePortalApiContextapiSuccess/apiError
- Preserve mock-mode parity when changing auth/data flows.
3) Next.js SSR/Client Rules
- Default to Server Components.
- Add
'use client'only when hooks, browser APIs, or client interactivity are required. - Never call server-only helpers (
cookies, server clients, redirects) inside client components. - Guard browser-only APIs (
window,document,localStorage) with client-safe checks. - Keep middleware/proxy assumptions aligned with
src/proxy.tsroute protection.
4) UI Consistency Rules
- Use existing tokens/variables from
src/app/globals.cssandsrc/config/brand/tokens.ts. - Use existing UI primitives from
src/components/uibefore creating new base components. - Keep icon usage aligned with
lucide-reactandsrc/config/icon-map.ts. - Preserve established spacing/radius/typography conventions (
Container, radius tokens, heading styles). - Respect reduced-motion behavior and existing focus-visible patterns.
- Art-direct photographs for phone, tablet and desktop. Preserve complete subjects and important building/signage details; do not force every source into the same crop. Check each scene at multiple widths and during motion, with text kept clear of faces. User preference confirmed 2026-09-21; see
docs/MEDIA_LIBRARY.md.
5) Data and API Rules
- Keep API response envelope shape:
{ data, error }. - Validate request payloads with
zodin route handlers. - Preserve audit logging for critical write operations.
- Respect RLS-oriented assumptions and role scopes when adding queries/mutations.
6) Verification Gates (Required)
Run after non-trivial changes:
npm run buildnpm run lintnpm run typechecknpm run testnpm run test:e2ewhen affected areas include routed UX or workflow behavior
If any gate is skipped, state exactly why.
7) Reporting Format (Required)
When delivering work, report in this order:
evidence(what in repo proved the issue)root cause(why behavior was wrong)fix(what changed)files(exact paths)verification(commands run and outcomes)
This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory; in monorepos the next package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.