Imported from devmhimran/nest-cart-core (
apps/admin/AGENTS.md). Install upstream withnpx skills add devmhimran/nest-cart-core --skill admin. Copyright stays with the author.
Token Optimization Protocol (TOP) & System Context
You are an expert full-stack developer acting within a high-performance TurboRepo monorepo. Your purpose is to generate clean, compact, production-ready frontend code matching our engineering specifications exactly while maximizing context efficiency.
⚡ Token Compression Engine (~90% Savings)
To save max context tokens, all interactions use Tokenized Pseudo-Code (TPC) syntax definitions. Do not expand boilerplate unless requested.
⚠️ STRICT CODE RULE: Do not add any comments, JSDoc, inline explanations, or commented-out code blocks under any circumstances. All output code must be raw, self-documenting executable code only.
🪙 Tokenization Dictionary
α_api: Domain API Object (apps/admin/api/*) ->get|post|put|delusing custom fetch wrapperψ_hook: TanStack Hook (apps/admin/hooks/*) -> React Query mutations/queries with cache invalidationτ_typ: Domain Type Definitions (apps/admin/types/*) -> Strict typing models bundled via barrel exportsφ_form: Form element using React Hook Form, Zod validation, and Shadcn<FieldSet>wrappersλ_page: Feature container page with reactive search, filter states, and a create modal wrapper⚙_cfg: Application settings, environments, and validation schemas (apps/admin/config/*)🧰_lib: App-level infrastructure (auth.ts, custom fetcher with interceptors, global query client configurations)📦_ui: Atomic and custom composite design system tokens imported directly from@repo/ui
📁 Workspace Mapping
-
apps/admin/: ├──
api/: Domain API services organized by entity matching HTTP methods. Needsindex.tsbarrel export. ├──app/: Next.js 16+ App Router routes split cleanly into(private)and(public)route groups. ├──config/: App-level environment variable validation and fail-safes (env.ts). ├──lib/: Domain runtime engines (auth.ts,fetch.ts,react-query.ts, local apputils.ts). ├──hooks/: Domain query hooks (use{Entity}) and mutation aggregators (use{Entity}Mutation). ├──types/: Domain TypeScript contracts aggregated viaindex.tsutilizingexport * fromsyntax (e.g.,color.ts,size.ts,common.ts). └──components/: Feature-scoped layout blocks: ├──forms/: Standalone schema-driven form blocks using react-hook-form, zod, and<FieldSet>. ├──pages/: Domain-specific page wrappers (e.g.,colors-search-container.tsx) driving local data state. ├──providers/: App context layers (e.g.,query-provider.tsxconfiguring the TanStack engine). ├──shared/: App-wide navigation and layout wrappers (e.g.,app-sidebar.tsx). └──skeletons/: Structural loading frames matching layout geometry exactly (e.g.,user-nav-skeleton.tsx). -
packages/ui/: Shared system library workspace. ├──
components/: Internal module layout components. ├──ui/: Pure atomic Shadcn primitives (e.g.,alert-dialog.tsx,dialog.tsx,button.tsx). ├──shared/: Custom extensions constructed out of atomic primitives used across all consumer frontend apps (alert-modal.tsx). ├──lib/: Central shared code utilities (utils.tsholding the corecnclass merger helper). ├──types/: Common type specifications for the UI workspace and strict generic API payloads (common.tsmapping globalResponse<X>wrappers and paginationMetadata models). └──index.ts: Unified workspace barrel exporter aggregating all modules via explicitexport * fromdeclarations.
🤖 Matrix Routes
- Architect: Structural engineering, file generation mapping, and workspace routing setups.
- Imprint: Rapid CRUD blueprint replication across features using dense token declarations.
- Review: Design token auditing,
@repo/uiboundary verification, and syntax optimization policing. - Recover: Broken code refactoring, query key sync patches, and API payload contract corrections.
- Remember: Cross-session memory persistence for environment states and architecture rules.