Imported from nothingser0/solo-project-lifecycle (
templates/04-dev-execution/nuxt/AGENTS.md). Install upstream withnpx skills add nothingser0/solo-project-lifecycle --skill nuxt. Copyright stays with the author.
AI Agent Guidelines - Nuxt Project
0. Execution Protocol — One Task Per Turn (NON-NEGOTIABLE)
TODO.mdis the queue. Work its task list one task at a time.- Per task: implement ONLY that task → run that task's
Verifycommand → paste the raw output → report task ID + files touched + result → 🛑 END TURN. - Do NOT start the next task, open a new sprint, or batch task IDs — unless the human names the specific task IDs to run in one instruction.
[x]is the human's mark, never yours. Only after the human confirms may you recordApproved: <date> by <name>in that task'sEvidence.- If a spec, schema, or requirement is missing, STOP and ask — never invent it to keep the queue moving.
- Never run
git commit,git push, orgit tag— hand the change to the human for review and commit.
CRITICAL: Read Official Documentation First
BEFORE implementing any feature, check official docs for current syntax:
- Nuxt: https://nuxt.com/docs
- Vue 3: https://vuejs.org/guide/introduction.html
- Nitro (server engine): https://nitro.build/guide
- Pinia: https://pinia.vuejs.org/
Why: Nuxt 3/4 changed auto-imports, useFetch/useAsyncData semantics, Nitro presets, and module APIs. Verify against the installed version, not memory.
1. Absolute Agent Safety Directives (NON-NEGOTIABLE)
- NO Destructive Git Operations:
git push --forceand branch rewrites are STRICTLY PROHIBITED. - NO Destructive Database Operations: never run
DROP TABLE,TRUNCATE, or destructive Prisma/ORM migration resets against staging/production. - Spec Document Integrity: documents marked
[FROZEN]/[APPROVED](PRD.md,FSD.md,DESIGN_SPEC.md,DESIGN.md,SCOPE_STATEMENT.md) are the immutable source of truth. Never edit them to make code fit — raise a Change Request. - Human Commits Only: AI agents must never run
git commitorgit push. - Mandatory Specs Pre-Read: read
AGENTS.md,CONTEXT.md,DESIGN.md,TODO.md, and the FSD/PROJECT_LITE.mdbefore writing code.
2. Nuxt & TypeScript Standards
- Type Safety: TypeScript strict mode. Typed props with
defineProps<Props>(), typed emits withdefineEmits<…>(). Noany, no@ts-ignore, noas unknown as. - Composition API Only:
<script setup lang="ts">. Options API is not used in new code. - Auto-imports Are Not a Guess: rely on Nuxt auto-imports only for documented composables/components. Import everything else explicitly — never invent a composable name.
- Data Fetching:
useFetchfor URL-based fetches,useAsyncDatawhen the key or handler is custom. Always handlepending,error, and empty results — a baredata.value.map()hides all three. - Server Routes: privileged logic lives in
server/api/**orserver/utils/**. Never import server-only modules into client components; guard withimport.meta.serverchecks for shared code. - State: Pinia stores for cross-page state;
useStatefor lightweight SSR-safe shared state. Never keep auth/session in a plain module-level variable. - No Layout Drift: one
layouts/default.vue; never duplicate head/meta blocks per page — useuseHead/useSeoMeta. - Hydration-Free Rendering: the same component runs on server and client — its markup must not depend on where it runs. Never read
localStorage/window/matchMediain the component body or acomputed(useonMounted, or a server-readable cookie). Never renderDate.now(),new Date(),Math.random(), or baretoLocaleString()/toLocaleDateString(); format with an explicit locale andtimeZone(Intl.DateTimeFormat('id-ID', { timeZone: 'Asia/Jakarta' })) or pass the server value down as a prop.useAsyncData/useFetchneed a stablekeyso both sides cache the same payload. Use<ClientOnly>for a genuinely client-only block — not to hide a mismatch. Full ladder:references/technical/HYDRATION_FREE_RENDERING.md.
3. Styling & Design Tokens
- Tokens from
DESIGN.md: colors, spacing, radii, and typography come from the frozen design tokens (viatailwind.config.*or CSS variables). Never introduce an off-palette hex or arbitrary spacing value. - No Inline-Style Bypass: follow the configured styling layer; do not patch around it with
:style="{ … }". - Accessibility (WCAG 2.2 AA): semantic landmarks, visible focus rings, labels on every input,
alton every image, contrast ≥4.5:1 for body text. Keyboard-operable — no click-only handlers. - Asset Weight:
@nuxt/imagewith explicit dimensions; SVG logo fromassets/logo/. No 2MB stock heroes.
4. Security & Data Handling
- No Secrets in the Repo: server secrets in
.env(git-ignored); commit only.env.example.runtimeConfig— onlypublic.*keys reach the client. Never put a secret underruntimeConfig.public. - Server-Only Code: use
server/utils+import.meta.serverguards. Never expose an ORM client or service-role key to the browser. - Input Validation: validate every server route payload with Zod (or the project's schema layer) at the boundary. Reject before touching storage.
- No
v-htmlon user content: it bypasses escaping. Prefer{{ }}interpolation; sanitize before any raw HTML. - CSRF on Mutations: non-GET endpoints validate origin/CSRF tokens.
- UU PDP 27/2022: personal data (NIK, phone, address) goes only to approved storage, with retention rules from the FSD.
5. Specification Alignment
- Screen IDs: every page traces to a
SCR-xxinDESIGN_SPEC.md. No unmapped pages, no orphan components. - 5 UI States: every data-driven view handles Default, Loading, Empty, Error, Success.
- Scope Discipline: build only what the approved scope lists. New ideas go to the backlog — not into this sprint.
- Traceability: each change maps to a
TODO.mdtask ID; reference it in the task's evidence.
6. Anti-Slop Directives (BANNED PATTERNS)
- No decorative comments: never restate the code, never leave
// TODOstubs, never commit commented-out code. - No silent failures: empty
catch {}blocks are banned. Surface a specific error to the user or rethrow with context. - No placeholder content: no lorem ipsum, no "Coming soon" pages, no dead buttons, no fake success toasts on failed requests.
- No hallucinated APIs/composables: verify every Nuxt composable, module, and Nitro preset exists in the installed version before using it.
- No duplicated logic: extract shared behaviour; a copy-pasted component with a different name is a defect.
7. Verification Before Handover
nuxi typecheck— zero type errors.nuxi build— exit 0.- The task's own
Verifycommand — paste raw output as evidence. - Report: task ID · files touched · raw output · blockers. Then 🛑 END TURN.
Escalate, never guess silently: if the spec is ambiguous, a business rule would break, or you cannot justify a file/route, stop and ask.
