skills/nextjs-app-router/SKILL.md
Next.js 14 App Router conventions for vibe-kit projects. Covers file-based routing, layouts, Server Components, Client Components, API route handlers, and middleware. Reference for fullstack-dev agent during code generation.
npx skillsauth add Hikkywannafly/vibe-kit nextjs-app-routerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
app/
├── layout.tsx # Root layout (HTML shell, providers)
├── page.tsx # Home page → /
├── globals.css # Global styles
├── (marketing)/ # Route group — no URL segment
│ ├── layout.tsx # Shared marketing layout
│ └── about/page.tsx # → /about
├── shop/
│ ├── page.tsx # → /shop
│ └── [id]/page.tsx # → /shop/123 (dynamic)
├── dashboard/
│ ├── layout.tsx # Dashboard shell with sidebar
│ └── page.tsx # → /dashboard
└── api/
└── webhook/route.ts # POST /api/webhook
Server Component (default — no "use client"):
// app/products/page.tsx
import { createClient } from "@/lib/supabase/server"
export default async function ProductsPage() {
const supabase = createClient()
const { data: products } = await supabase.from("products").select("*")
return <ul>{products?.map(p => <li key={p.id}>{p.name}</li>)}</ul>
}
Client Component (interactivity):
"use client"
import { useState } from "react"
export function AddToCart({ productId }: { productId: string }) {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(c => c + 1)}>Them vao gio ({count})</button>
}
// app/api/orders/route.ts
import { NextRequest, NextResponse } from "next/server"
export async function POST(req: NextRequest) {
const body = await req.json()
// process order...
return NextResponse.json({ success: true }, { status: 201 })
}
// app/layout.tsx
import type { Metadata } from "next"
export const metadata: Metadata = {
title: "Ten cua hang | Mua sam truc tuyen",
description: "Mo ta ngan gon cho Google",
openGraph: { title: "...", images: ["/og.jpg"] },
}
app/shop/
├── page.tsx
├── loading.tsx # Shown while page.tsx suspends
└── error.tsx # "use client" — catches runtime errors
lib/supabase/
├── client.ts # createBrowserClient() — for Client Components
└── server.ts # createServerClient() — for Server Components & route handlers
"use client" components directly into Server Components without a wrapper.fetch() in Server Components is auto-cached; add { cache: "no-store" } for dynamic data.params: { id: string } prop, not useParams() in Server Components.middleware.ts in project root (not inside app/).data-ai
Generate Vietnamese marketing copy, UI strings, CTAs, error messages, and email templates for vibe-kit projects. Tone: friendly, conversational, Southern Vietnamese style. Activated for any user-visible text generation.
development
One-shot orchestrator. Turns the prose after /vibe into a shipped product by clarifying intent, rendering a plan, gating on approval, then spawning planner+researcher+fullstack-dev+tester+reviewer agents in sequence. User-visible strings match the user's input language (Vietnamese by default for VN users). Two modes: SAFE (default — clarify + show plan + wait for approval, max 1 round-trip) and YOLO (skip clarify+approval, run full auto with smart defaults — for demos and power users). YOLO triggers: prose contains `yolo`, `nhanh nha`, `lam luon`, `khoi hoi`, `auto`, or args start with `yolo`. Trigger phrases (EN + VN): "build me a site", "make me a landing page", "create a shop", "I need an app", "vibe lam website", "tao cho toi mot", "xay dung shop online", "lam landing page", "can mot app".
tools
On-demand security audit for vibe-kit projects. Stack-aware checks for Next.js App Router + Supabase + Polar: secrets leak, RLS gaps, service-role key in client bundle, missing webhook signature verification, unprotected API routes, weak headers, dependency vulns. Outputs a Vietnamese P0/P1/P2 report with file:line + fix hints. User-visible strings match the user's input language (Vietnamese by default for VN users). Trigger phrases (EN + VN): "check security", "audit it", "security scan", "is this safe to launch", "kiem tra bao mat", "quet bao mat", "audit du an", "co an toan khong", "scan bao mat truoc khi deploy".
tools
Wire Supabase JS client into a React Native (Expo) vibe-kit project: session persistence via AsyncStorage, magic-link OAuth callback via expo-linking deep links, Realtime subscriptions on RN, and shared TypeScript types with the Next.js webapp twin (vibe-kit's typical web<->mobile pair pattern). This is the mobile counterpart of `auth-magic-link` (web). User-visible strings match the user's input language (Vietnamese by default for VN users). Trigger phrases (EN + VN): "supabase react native", "supabase mobile", "auth mobile expo", "magic link mobile", "tich hop supabase vao app", "supabase deep link".