api-layer
Installation
SKILL.md
API Layer Patterns
Boundary Zone: external/
All raw Supabase access and Supabase-generated types live only in a feature's
external/ directory (or shared/external/). This is lint-enforced:
getSupabaseClientmay be imported only inside*/external/**. hooks, components, and utils must call a feature'sexternal/fetch*/read*functions — which return domain types — never the raw client.@/shared/external/database.types(generated schema types) may be imported only insideexternal/. UI code deals in domain types, not row/DTO shapes.
external/ is the one place a raw row shape or a boundary cast may exist;
everything outside it is structurally confined to domain types. The client is
typed (createClient<Database>), so .from(...).select(...) results are inferred
from the schema — parse and map at the boundary instead of casting.