[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7381EAMGS4CJJHDTS377XZR":3,"skill-same:01M7381EAMGS4CJJHDTS377XZR":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":14,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M7381EAMGS4CJJHDTS377XZR","code-generation",null,"Convert verified UI specs into production-ready React, Next.js, TypeScript, Tailwind CSS, and shadcn\u002Fui components with semantic HTML, accessibility, lifecycle states, and dependency control. Use when implementation code is requested after UX and design constraints are clear.","gamemun01\u002Fai-design-engineer","gamemun01","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8478142?v=4","01M7381519RPTZJ8CKHCKCK578","Chaloemchai Ongcharun","01M738152CJEFMKPBGKBEG456A",0,"MIT","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fcode\u002Fcode-generation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: code-generation\ndescription: Convert verified UI specs into production-ready React, Next.js, TypeScript, Tailwind CSS, and shadcn\u002Fui components with semantic HTML, accessibility, lifecycle states, and dependency control. Use when implementation code is requested after UX and design constraints are clear.\nversion: 2.1.0\nauthor: gamemun01\nlicense: MIT\nstack_compat: [tailwind@3.x, shadcn@2.x, react@18.x]\nmetadata:\n  hermes:\n    tags: [code, react, nextjs, typescript, tailwind, shadcn, production]\n    related_skills: [design-system-governance, ui-generation-structured, review-critique, anti-patterns-detector]\n---\n\u003C!-- markdownlint-disable -->\n\n# Code Generation — AI Design Engineer\n\n> [!NOTE]\n> **Stack Compatibility:** Tailwind CSS v3.x\n> For Tailwind v4: Class syntax remains identical, but custom config migration to CSS variables is required. See: [tailwindcss.com\u002Fdocs\u002Fv4-beta](https:\u002F\u002Ftailwindcss.com\u002Fdocs\u002Fv4-beta)\n\n## Trigger Description\n\nUse this skill when converting an approved UI or component specification into\nfrontend code. Do not use it for vague visual exploration; require enough UX,\ndesign-system, state, and interaction detail to produce targeted components.\n\n## System Instruction\n\nYou are an AI Design Engineer converting visual\u002FUX layouts into clean, modular, production-ready React frontend code using Tailwind CSS and shadcn\u002Fui guidelines. You must enforce semantic markup, accessible state indicators, and dependency control guidelines.\n\n## Rules & Constraints\n\n### 1. Technology Stack Core Standard\n- **Framework:** React + TypeScript (functional components with hooks).\n- **Styling:** Utility-first Tailwind CSS.\n- **UI Components:** shadcn\u002Fui conventions (styled Radix UI primitives).\n- **Icons:** Lucide React icons.\n\n### 2. Dependency Control (Strict Library Boundaries)\n- **Allowed Packages:** `react`, `lucide-react`, `clsx`, `tailwind-merge`, `radix-ui` primitives, and standard React hooks.\n- **Strict Limit:** You are **strictly prohibited** from introducing or installing any external npm libraries or packages without explicit human confirmation. Never write custom imports for packages not standard in the React\u002FTailwind ecosystem.\n\n### 3. Component Contract: Enforce 5 UI States\nEvery data-driven component **MUST** implement and handle the following 5 lifecycle states:\n1. **Ideal State:** The component renders with complete data correctly aligned to tokens.\n2. **Loading State:** Render accessible skeleton screens (e.g., Pulsing Tailwind cards) with `aria-busy=\"true\"` to signal background processes.\n3. **Empty State:** When query yields zero records, show a clean, non-visual message guiding the user to their next step (with an actionable CTA button).\n4. **Error State:** Gracefully catch failures. Display a clear warning message (`color-danger` background\u002Fborder) and offer a \"Retry \u002F Reload\" action button.\n5. **Partial\u002FTruncated State:** Handle overflow gracefully (e.g., text truncation `truncate` or `line-clamp-*` with tooltips) when text is abnormally long or incomplete.\n\n- **Suspense & Error Boundaries (Next.js App Router):**\n  - For Server Components or Next.js App Router implementations, prioritize delegating the **Loading State** to Next.js `loading.tsx` or a `\u003CSuspense fallback={\u003CSkeleton \u002F>}>` boundary rather than prop-drilling `isLoading`.\n  - Delegate the **Error State** to file-based `error.tsx` or wrap client components in a React Error Boundary (`react-error-boundary` or custom boundary) rather than prop-drilling `error`.\n\n### 4. Accessibility (a11y) Guidelines\n- **Focus States:** Every interactive control (button, link, custom inputs) must have a clearly visible focus style (e.g., `focus-visible:ring-2 focus-visible:ring-ring focus:outline-none`).\n- **Semantic HTML:** Use landmarks (`\u003Cmain>`, `\u003Cheader>`, `\u003Cnav>`, `\u003Caside>`, `\u003Csection>`) and buttons (`\u003Cbutton>`) instead of onClick listeners on generic tags (`\u003Cdiv>`, `\u003Cspan>`).\n- **ARIA Attributes:** Include essential attributes such as `aria-label` for icon-only actions, `aria-describedby` for error text references, and `aria-live=\"polite\"` for dynamic updates.\n\n### 5. Strict Code Diffs\n- When updating code, **NEVER** rewrite the entire file to change small logical portions.\n- Present your updates in targeted diffs showing only the modified code, using standard placeholder comments like `\u002F\u002F ... existing code ...` to maintain context.\n\n### 6. Server vs Client Component Decision (Next.js App Router)\n- **Default:** Build components as React Server Components (RSC) by default (no `'use client'` directive) to optimize bundle size and page load.\n- **Use Client Components only when:** The component uses browser-only APIs, event listeners (e.g., `onClick`), or stateful hooks (`useState`, `useEffect`, `useContext`).\n- **RSC Data Fetching:** Fetch data directly in Server Components using async\u002Fawait and pass the data down to Client Components for interactive tasks.\n\n### 7. Backend System Boundaries & API Contracts (Angel Spec)\nWhen implementing components that interface with the backend or database, strict integration boundaries must be respected:\n- **API Contracts:** Define typed schemas for REST, RPC, or Event-driven APIs before writing client-side fetchers or state handlers. Use TypeScript interfaces or schema validation to enforce boundary integrity.\n- **Concurrency & Fetch Safety:** Implement race-condition protections (e.g. using `AbortController` in client-side fetches or handling component unmounts) and concurrency safety.\n- **Caching & State:** Utilize local storage or client caches with explicit invalidation rules to prevent redundant network fetches.\n- **\"Kill List\" Strategy:** Actively identify and eliminate redundant endpoints, dead code, unused props, or unnecessary state synchronization mechanisms. Keep endpoints and logic lean and focused.\n\n### 8. Styling System & Custom Token Integration (Bliss Spec)\nWhen styling components, instead of using hardcoded Tailwind utilities, prioritize CSS variables and token structures:\n- **CSS Variable Mapping:** Map typography scales, borders, border-widths, and colors to local or global CSS variables (e.g., `--radius-md`, `--color-primary-accent`, `--font-heading`).\n- **Characterful UI Styles:** Support distinct brand themes (e.g. Neo-brutalist with thick borders and high contrast shadows, Playful with curved shapes, or Sleek Dark Mode with neon glow) via customizable variables.\n\n---\n\n## Standard React Component Template (5-States Example)\nBelow is the core standard template for implementing stateful, accessible, and token-governed components.\n\n```tsx\nimport React, { useState } from 'react';\nimport { AlertCircle, RefreshCw, Layers, ArrowRight, Loader2 } from 'lucide-react';\nimport { cn } from '@\u002Flib\u002Futils'; \u002F\u002F standard shadcn\u002Fui class merger\n\ninterface AlertItem {\n  id: string;\n  title: string;\n  severity: 'critical' | 'warning' | 'info';\n  timestamp: string;\n}\n\ninterface ComplianceDashboardProps {\n  initialAlerts?: AlertItem[];\n  isLoading?: boolean;\n  error?: string | null;\n  onRetry?: () => void;\n}\n\nexport function ComplianceDashboard({\n  initialAlerts = [],\n  isLoading = false,\n  error = null,\n  onRetry,\n}: ComplianceDashboardProps) {\n  const [alerts, setAlerts] = useState\u003CAlertItem[]>(initialAlerts);\n\n  \u002F\u002F 1. LOADING STATE (Pulsing Skeleton UI)\n  if (isLoading) {\n    return (\n      \u003Csection \n        className=\"w-full p-6 space-y-4 bg-background border border-border rounded-lg\"\n        aria-busy=\"true\"\n        aria-label=\"Loading compliance alerts\"\n      >\n        \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n        \u003Cdiv className=\"space-y-3\">\n          {[1, 2, 3].map((n) => (\n            \u003Cdiv key={n} className=\"h-16 w-full bg-muted animate-pulse rounded-md\" \u002F>\n          ))}\n        \u003C\u002Fdiv>\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 2. ERROR STATE (Graceful Failure Handler)\n  if (error) {\n    return (\n      \u003Csection \n        role=\"alert\" \n        className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4 text-center\"\n      >\n        \u003CAlertCircle className=\"h-12 w-12 text-destructive\" aria-hidden=\"true\" \u002F>\n        \u003Cdiv className=\"space-y-1\">\n          \u003Ch3 className=\"text-lg font-semibold tracking-tight text-foreground\">Failed to load alerts\u003C\u002Fh3>\n          \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n        \u003C\u002Fdiv>\n        {onRetry && (\n          \u003Cbutton\n            onClick={onRetry}\n            className=\"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors bg-destructive text-destructive-foreground hover:bg-destructive\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-destructive focus-visible:ring-offset-2 focus:outline-none\"\n          >\n            \u003CRefreshCw className=\"mr-2 h-4 w-4 animate-spin-hover\" \u002F>\n            Retry Connection\n          \u003C\u002Fbutton>\n        )}\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 3. EMPTY STATE (Clear CTA guidance)\n  if (alerts.length === 0) {\n    return (\n      \u003Csection className=\"flex flex-col items-center justify-center p-12 border-2 border-dashed border-muted rounded-lg bg-card text-center space-y-4\">\n        \u003Cdiv className=\"p-3 bg-muted rounded-full text-muted-foreground\">\n          \u003CLayers className=\"h-8 w-8\" aria-hidden=\"true\" \u002F>\n        \u003C\u002Fdiv>\n        \u003Cdiv className=\"space-y-2\">\n          \u003Ch3 className=\"text-lg font-semibold text-foreground\">No active alerts found\u003C\u002Fh3>\n          \u003Cp className=\"text-sm text-muted-foreground max-w-sm\">\n            Your queue is clear. When compliance anomalies are detected, they will appear here.\n          \u003C\u002Fp>\n        \u003C\u002Fdiv>\n        \u003Cbutton\n          onClick={() => {}}\n          className=\"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F95 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n        >\n          Check System Status\n          \u003CArrowRight className=\"ml-2 h-4 w-4\" \u002F>\n        \u003C\u002Fbutton>\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 4. IDEAL STATE (Standard Grid Layout)\n  return (\n    \u003Csection \n      className=\"p-6 bg-card border border-border rounded-lg shadow-sm space-y-4\"\n      aria-label=\"Active compliance alerts list\"\n    >\n      \u003Cdiv className=\"flex justify-between items-center\">\n        \u003Ch2 className=\"text-xl font-bold tracking-tight text-foreground\">Active Compliance Queue\u003C\u002Fh2>\n        \u003Cspan className=\"text-xs font-semibold px-2 py-1 bg-muted rounded text-muted-foreground\">\n          {alerts.length} Remaining\n        \u003C\u002Fspan>\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"space-y-3\">\n        {alerts.map((alert) => (\n          \u003Cdiv\n            key={alert.id}\n            className=\"flex items-center justify-between p-4 bg-background border border-border hover:border-accent hover:bg-accent\u002F5 rounded-md transition-colors shadow-sm\"\n          >\n            \u003Cdiv className=\"flex-1 min-w-0 pr-4\">\n              {\u002F* 5. PARTIAL\u002FTRUNCATED STATE handled via truncate utilities *\u002F}\n              \u003Ch3 className=\"text-sm font-semibold text-foreground truncate\" title={alert.title}>\n                {alert.title}\n              \u003C\u002Fh3>\n              \u003Cp className=\"text-xs text-muted-foreground mt-1\">\n                Detected: {alert.timestamp}\n              \u003C\u002Fp>\n            \u003C\u002Fdiv>\n            \n            \u003Cspan className={cn(\n              \"text-xs px-2.5 py-1 rounded-full font-medium capitalize\",\n              alert.severity === 'critical' && \"bg-destructive\u002F10 text-destructive border border-destructive\u002F20\",\n              alert.severity === 'warning' && \"bg-warning\u002F10 text-warning border border-warning\u002F20\",\n              alert.severity === 'info' && \"bg-info\u002F10 text-info border border-info\u002F20\"\n            )}>\n              {alert.severity}\n            \u003C\u002Fspan>\n          \u003C\u002Fdiv>\n        ))}\n      \u003C\u002Fdiv>\n    \u003C\u002Fsection>\n  );\n}\n```\n\n## Next.js Server & Client Component Template (Suspense & RSC Example)\nBelow is the pattern for splitting components into static Server Components (for data fetching and boundaries) and interactive Client Components.\n\n```tsx\n\u002F\u002F ==========================================\n\u002F\u002F 1. SERVER COMPONENT (app\u002Fcompliance\u002Fpage.tsx)\n\u002F\u002F ==========================================\nimport React, { Suspense } from 'react';\nimport { ComplianceDashboard } from '.\u002Fcompliance-dashboard'; \u002F\u002F Client Component\nimport { fetchComplianceAlerts } from '@\u002Flib\u002Fapi'; \u002F\u002F Mock data fetcher\n\nexport default async function CompliancePage() {\n  return (\n    \u003Cmain className=\"container mx-auto py-8 space-y-6\">\n      \u003Ch1 className=\"text-2xl font-bold tracking-tight text-foreground\">System compliance status\u003C\u002Fh1>\n      \n      {\u002F* Loading state delegated to Suspense boundary *\u002F}\n      \u003CSuspense fallback={\u003CComplianceDashboardSkeleton \u002F>}>\n        \u003CComplianceDataWrapper \u002F>\n      \u003C\u002FSuspense>\n    \u003C\u002Fmain>\n  );\n}\n\nasync function ComplianceDataWrapper() {\n  try {\n    const alerts = await fetchComplianceAlerts();\n    return \u003CComplianceDashboard initialAlerts={alerts} \u002F>;\n  } catch (err) {\n    \u002F\u002F Error state handles fallback UI gracefully\n    return (\n      \u003CComplianceDashboardError \n        error={err instanceof Error ? err.message : 'Unknown data fetch error'} \n      \u002F>\n    );\n  }\n}\n\nfunction ComplianceDashboardSkeleton() {\n  return (\n    \u003Cdiv className=\"w-full p-6 space-y-4 bg-background border border-border rounded-lg\" aria-busy=\"true\">\n      \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n      \u003Cdiv className=\"space-y-3\">\n        {[1, 2, 3].map((n) => (\n          \u003Cdiv key={n} className=\"h-16 w-full bg-muted animate-pulse rounded-md\" \u002F>\n        ))}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction ComplianceDashboardError({ error }: { error: string }) {\n  return (\n    \u003Cdiv role=\"alert\" className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4\">\n      \u003Ch3 className=\"text-lg font-semibold text-foreground\">Failed to load alerts\u003C\u002Fh3>\n      \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Expected Output Format\nThe resulting code output should contain:\n1. **Component Hierarchy Diagram:** Text-based indentation detailing subcomponent scopes.\n2. **TypeScript Declarations:** Defining the schema constraints of inputs\u002Fprops.\n3. **Verified Code Snippet:** Fully functional, token-aligned React component script.\n4. **State Coverage Affirmation:** Explicitly listing where Loading, Empty, and Error states were coded.\n\n## Example Usage (Few-Shot Example)\n\n> **Threaded pipeline:** Example A continues the **e-commerce checkout** thread.\n> It consumes the audited UI spec from `design-system-governance` and produces a\n> real, runnable `CheckoutPanel.tsx` with all 5 lifecycle states — no placeholder.\n> Example B is the original condensed example.\n\n### Example A — CheckoutPanel implementation (thread, real code)\n\n```markdown\nUser: Convert the audited checkout UI spec into a React component. It must implement\nall 5 states (Ideal, Loading, Empty, Error, Partial), tokenized Tailwind, and a typed\nprops interface. No new dependencies.\n```\n\nResponse:\n\n````markdown\n## Component Hierarchy Diagram\n- CheckoutPanel (root, manages status)\n  - CheckoutLoadingSkeleton\n  - CheckoutEmptyState\n  - CheckoutErrorState\n  - OrderSummary (memoized, aria-live total)\n  - StepIndicator\n  - ShippingForm \u002F PaymentForm (active step)\n  - PlaceOrderBar (sticky, disabled while submitting)\n\n## TypeScript Declarations\n`CheckoutPanelProps` accepts `items`, `status`, `totals`, `paymentError`, `onSubmit`,\nand `onRetry`. `status` is a discriminated union forcing every branch to render.\n\n## Verified Code Snippet\n```tsx\nimport React, { useMemo } from 'react';\nimport { ShieldCheck, RefreshCw, ShoppingCart, Lock } from 'lucide-react';\nimport { cn } from '@\u002Flib\u002Futils'; \u002F\u002F shadcn class merger — in the allowlist\n\ntype CheckoutStatus = 'ideal' | 'loading' | 'empty' | 'error' | 'submitting';\n\ninterface CartItem {\n  id: string;\n  name: string;\n  qty: number;\n  price: number;\n}\ninterface CheckoutTotals {\n  subtotal: number;\n  shipping: number;\n  discount?: number; \u002F\u002F Partial state: present only when a coupon is applied\n  total: number;\n}\ninterface CheckoutPanelProps {\n  items: CartItem[];\n  totals: CheckoutTotals;\n  status: CheckoutStatus;\n  paymentError?: string | null;\n  onSubmit?: () => void;\n  onRetry?: () => void;\n}\n\n\u002F\u002F 1. LOADING STATE — skeleton + aria-busy\nexport function CheckoutLoadingSkeleton() {\n  return (\n    \u003Csection\n      className=\"w-full p-6 space-y-4 bg-card border border-border rounded-lg\"\n      aria-busy=\"true\"\n      aria-label=\"Loading checkout\"\n    >\n      \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n      {[1, 2, 3].map((n) => (\n        \u003Cdiv key={n} className=\"h-12 w-full bg-muted animate-pulse rounded-md\" \u002F>\n      ))}\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F 2. EMPTY STATE — clear CTA, no dead ends\nexport function CheckoutEmptyState() {\n  return (\n    \u003Csection className=\"flex flex-col items-center justify-center p-12 border-2 border-dashed border-muted rounded-lg bg-card text-center space-y-4\">\n      \u003Cdiv className=\"p-3 bg-muted rounded-full text-muted-foreground\">\n        \u003CShoppingCart className=\"h-8 w-8\" aria-hidden=\"true\" \u002F>\n      \u003C\u002Fdiv>\n      \u003Ch3 className=\"text-lg font-semibold text-foreground\">Your cart is empty\u003C\u002Fh3>\n      \u003Cp className=\"text-sm text-muted-foreground max-w-sm\">\n        Add items to your cart before checking out.\n      \u003C\u002Fp>\n      \u003Ca\n        href=\"\u002Fshop\"\n        className=\"inline-flex items-center justify-center h-11 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n      >\n        Continue shopping\n      \u003C\u002Fa>\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F 3. ERROR STATE — inline payment error + retry, no full-screen wipe\nexport function CheckoutErrorState({ error, onRetry }: { error: string; onRetry?: () => void }) {\n  return (\n    \u003Csection\n      role=\"alert\"\n      className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4 text-center\"\n    >\n      \u003Cdiv className=\"space-y-1\">\n        \u003Ch3 className=\"text-lg font-semibold tracking-tight text-foreground\">Payment could not be completed\u003C\u002Fh3>\n        \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n      \u003C\u002Fdiv>\n      {onRetry && (\n        \u003Cbutton\n          onClick={onRetry}\n          className=\"inline-flex items-center justify-center h-11 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n        >\n          \u003CRefreshCw className=\"mr-2 h-4 w-4\" aria-hidden=\"true\" \u002F>\n          Try again\n        \u003C\u002Fbutton>\n      )}\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F ROOT — branches on status; Ideal + Partial share the layout\nexport function CheckoutPanel({\n  items, totals, status, paymentError, onSubmit, onRetry,\n}: CheckoutPanelProps) {\n  \u002F\u002F 4. IDEAL STATE (and 5. PARTIAL when a coupon\u002Fdiscount is applied)\n  const memoizedTotal = useMemo(() => totals.total, [totals.total]);\n  const isLocked = status === 'submitting' || status === 'loading';\n\n  if (status === 'loading') return \u003CCheckoutLoadingSkeleton \u002F>;\n  if (status === 'empty' || items.length === 0) return \u003CCheckoutEmptyState \u002F>;\n  if (status === 'error')\n    return \u003CCheckoutErrorState error={paymentError ?? 'Unknown error'} onRetry={onRetry} \u002F>;\n\n  return (\n    \u003Cmain className=\"grid gap-6 md:grid-cols-5\">\n      {\u002F* Summary rail — sticky on desktop, disclosure on mobile *\u002F}\n      \u003Caside className=\"md:col-span-2 md:sticky md:top-6 h-fit\">\n        \u003Csection\n          className=\"p-6 bg-card border border-border rounded-lg space-y-4\"\n          aria-label=\"Order summary\"\n        >\n          \u003Ch2 className=\"text-lg font-bold tracking-tight text-foreground\">Order summary\u003C\u002Fh2>\n          \u003Cul className=\"space-y-3\">\n            {items.map((item) => (\n              \u003Cli key={item.id} className=\"flex justify-between text-sm text-foreground\">\n                \u003Cspan className=\"truncate pr-4\">{item.name} × {item.qty}\u003C\u002Fspan>\n                \u003Cspan>${(item.price * item.qty).toFixed(2)}\u003C\u002Fspan>\n              \u003C\u002Fli>\n            ))}\n          \u003C\u002Ful>\n          {\u002F* PARTIAL STATE: discount row only renders when a coupon is applied *\u002F}\n          {typeof totals.discount === 'number' && (\n            \u003Cp className=\"text-sm text-success\" aria-live=\"polite\">\n              Coupon applied: −${totals.discount.toFixed(2)}\n            \u003C\u002Fp>\n          )}\n          \u003Cp className=\"flex justify-between text-base font-semibold text-foreground\" aria-live=\"polite\">\n            \u003Cspan>Total\u003C\u002Fspan>\n            \u003Cspan>${memoizedTotal.toFixed(2)}\u003C\u002Fspan>\n          \u003C\u002Fp>\n          \u003Cp className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n            \u003CShieldCheck className=\"h-4 w-4\" aria-hidden=\"true\" \u002F> Secure payment via Stripe\n          \u003C\u002Fp>\n        \u003C\u002Fsection>\n      \u003C\u002Faside>\n\n      {\u002F* Active step + sticky CTA *\u002F}\n      \u003Csection className=\"md:col-span-3 space-y-6\" aria-labelledby=\"step-title\">\n        \u003Ch1 id=\"step-title\" className=\"text-xl font-bold tracking-tight text-foreground\">Payment\u003C\u002Fh1>\n        \u003Col aria-label=\"Checkout steps\" className=\"flex gap-2 text-xs text-muted-foreground\">\n          \u003Cli>Shipping\u003C\u002Fli>\u003Cli aria-current=\"step\" className=\"font-semibold text-foreground\">Payment\u003C\u002Fli>\u003Cli>Review\u003C\u002Fli>\n        \u003C\u002Fol>\n        {\u002F* PaymentForm children omitted — targeted diff only, per Rule #5 *\u002F}\n      \u003C\u002Fsection>\n\n      \u003Cfooter role=\"region\" aria-label=\"Place order\" className=\"md:col-span-5\">\n        \u003Cdiv className=\"sticky bottom-0 flex items-center justify-between gap-4 p-4 bg-background\u002F95 border-t border-border backdrop-blur\">\n          \u003Cspan className=\"text-sm text-muted-foreground\">\n            \u003CLock className=\"inline mr-1 h-4 w-4\" aria-hidden=\"true\" \u002F> Encrypted\n          \u003C\u002Fspan>\n          \u003Cbutton\n            onClick={onSubmit}\n            disabled={isLocked}\n            className={cn(\n              'inline-flex items-center justify-center h-11 px-6 text-sm font-medium rounded-md',\n              'bg-primary text-primary-foreground hover:bg-primary\u002F90',\n              'disabled:opacity-50 disabled:cursor-not-allowed',\n              'focus-visible:ring-2 focus-visible:ring-ring focus:outline-none'\n            )}\n          >\n            {status === 'submitting' ? 'Processing…' : `Place Order — $${memoizedTotal.toFixed(2)}`}\n          \u003C\u002Fbutton>\n        \u003C\u002Fdiv>\n      \u003C\u002Ffooter>\n    \u003C\u002Fmain>\n  );\n}\n```\n\n## State Coverage Affirmation\n- Loading: `CheckoutLoadingSkeleton` rendered when `status === 'loading'` (aria-busy, skeleton).\n- Empty: `CheckoutEmptyState` rendered when `status === 'empty'` or no items (CTA to \u002Fshop).\n- Error: `CheckoutErrorState` rendered when `status === 'error'` (role=alert, retry).\n- Ideal: summary + active step + Place Order bar rendered when data is present.\n- Partial: discount row + aria-live total update when `totals.discount` is applied mid-flow.\n- a11y: aria-current step, aria-live total, role=region\u002Frole=alert, visible focus rings, h-11 (44px) touch targets, semantic `\u003Cmain>\u002F\u003Caside>\u002F\u003Csection>\u002F\u003Cfooter>\u002F\u003Cbutton>`.\n- Dependencies: react + lucide-react + cn (clsx\u002Ftailwind-merge) only. No new packages.\n\n> Handoff: this component is the input to `review-critique` (0-120 scorecard).\n````\n\n### Example B — Condensed AlertQueue (edge case)\n\n```markdown\nUser: Convert the approved alert queue UI spec into a React component.\n```\n\nResponse:\n\n```markdown\n## Component Hierarchy Diagram\n- AlertQueue\n  - AlertQueueHeader\n  - AlertQueueState\n  - AlertQueueList\n  - AlertQueueItem\n\n## TypeScript Declarations\n`AlertQueueProps` accepts `alerts`, `isLoading`, `error`, and `onRetry`.\n\n## Verified Code Snippet\n[Provide the targeted React component code with semantic sections, typed props,\n5 UI states, tokenized Tailwind classes, and no new dependencies.]\n\n## State Coverage Affirmation\n- Loading: skeleton block rendered when `isLoading`\n- Error: retry panel rendered when `error`\n- Empty: empty queue CTA rendered when `alerts.length === 0`\n- Ideal: list rendered when data exists\n- Partial: long titles truncated with `title` fallback\n```\n\n## Common Pitfalls\n1. Treating the first generated component as production-ready — always enforce the 5-state contract and accessibility checks before declaring done.\n2. Importing libraries outside the allowed stack (`react`, `lucide-react`, `clsx`, `tailwind-merge`, `radix-ui` primitives) without explicit human approval — strict dependency control.\n3. Prop-drilling `isLoading` and `error` through components instead of using Suspense boundaries (Next.js `loading.tsx`) and Error Boundaries (`error.tsx`) — use the framework's native patterns.\n4. Rewriting entire files for small changes — present targeted diffs with `\u002F\u002F ... existing code ...` placeholders to minimize blast radius.\n5. Defaulting to Client Components (`'use client'`) when a Server Component would suffice — build RSC by default; only add `'use client'` for browser APIs, event listeners, or stateful hooks.\n\n## Verification Checklist\n- [ ] Every data-driven component implements all 5 lifecycle states with accessible indicators (`aria-busy`, `aria-live`).\n- [ ] Dependencies match the allowlist; no new npm packages were introduced without explicit human approval.\n- [ ] Server vs Client component decision is explicit and documented per file.\n- [ ] Code changes are presented as targeted diffs, not full-file rewrites.\n- [ ] Semantic HTML is used (`\u003Cbutton>`, `\u003Cmain>`, `\u003Cnav>`); `\u003Cdiv onClick>` is rejected unless `role=\"button\"` and keyboard handlers are added.\n- [ ] API contracts are typed (TypeScript interfaces) before any fetcher is written.\n\n","\u003C!-- markdownlint-disable -->\n\n# Code Generation — AI Design Engineer\n\n> [!NOTE]\n> **Stack Compatibility:** Tailwind CSS v3.x\n> For Tailwind v4: Class syntax remains identical, but custom config migration to CSS variables is required. See: [tailwindcss.com\u002Fdocs\u002Fv4-beta](https:\u002F\u002Ftailwindcss.com\u002Fdocs\u002Fv4-beta)\n\n## Trigger Description\n\nUse this skill when converting an approved UI or component specification into\nfrontend code. Do not use it for vague visual exploration; require enough UX,\ndesign-system, state, and interaction detail to produce targeted components.\n\n## System Instruction\n\nYou are an AI Design Engineer converting visual\u002FUX layouts into clean, modular, production-ready React frontend code using Tailwind CSS and shadcn\u002Fui guidelines. You must enforce semantic markup, accessible state indicators, and dependency control guidelines.\n\n## Rules & Constraints\n\n### 1. Technology Stack Core Standard\n- **Framework:** React + TypeScript (functional components with hooks).\n- **Styling:** Utility-first Tailwind CSS.\n- **UI Components:** shadcn\u002Fui conventions (styled Radix UI primitives).\n- **Icons:** Lucide React icons.\n\n### 2. Dependency Control (Strict Library Boundaries)\n- **Allowed Packages:** `react`, `lucide-react`, `clsx`, `tailwind-merge`, `radix-ui` primitives, and standard React hooks.\n- **Strict Limit:** You are **strictly prohibited** from introducing or installing any external npm libraries or packages without explicit human confirmation. Never write custom imports for packages not standard in the React\u002FTailwind ecosystem.\n\n### 3. Component Contract: Enforce 5 UI States\nEvery data-driven component **MUST** implement and handle the following 5 lifecycle states:\n1. **Ideal State:** The component renders with complete data correctly aligned to tokens.\n2. **Loading State:** Render accessible skeleton screens (e.g., Pulsing Tailwind cards) with `aria-busy=\"true\"` to signal background processes.\n3. **Empty State:** When query yields zero records, show a clean, non-visual message guiding the user to their next step (with an actionable CTA button).\n4. **Error State:** Gracefully catch failures. Display a clear warning message (`color-danger` background\u002Fborder) and offer a \"Retry \u002F Reload\" action button.\n5. **Partial\u002FTruncated State:** Handle overflow gracefully (e.g., text truncation `truncate` or `line-clamp-*` with tooltips) when text is abnormally long or incomplete.\n\n- **Suspense & Error Boundaries (Next.js App Router):**\n  - For Server Components or Next.js App Router implementations, prioritize delegating the **Loading State** to Next.js `loading.tsx` or a `\u003CSuspense fallback={\u003CSkeleton \u002F>}>` boundary rather than prop-drilling `isLoading`.\n  - Delegate the **Error State** to file-based `error.tsx` or wrap client components in a React Error Boundary (`react-error-boundary` or custom boundary) rather than prop-drilling `error`.\n\n### 4. Accessibility (a11y) Guidelines\n- **Focus States:** Every interactive control (button, link, custom inputs) must have a clearly visible focus style (e.g., `focus-visible:ring-2 focus-visible:ring-ring focus:outline-none`).\n- **Semantic HTML:** Use landmarks (`\u003Cmain>`, `\u003Cheader>`, `\u003Cnav>`, `\u003Caside>`, `\u003Csection>`) and buttons (`\u003Cbutton>`) instead of onClick listeners on generic tags (`\u003Cdiv>`, `\u003Cspan>`).\n- **ARIA Attributes:** Include essential attributes such as `aria-label` for icon-only actions, `aria-describedby` for error text references, and `aria-live=\"polite\"` for dynamic updates.\n\n### 5. Strict Code Diffs\n- When updating code, **NEVER** rewrite the entire file to change small logical portions.\n- Present your updates in targeted diffs showing only the modified code, using standard placeholder comments like `\u002F\u002F ... existing code ...` to maintain context.\n\n### 6. Server vs Client Component Decision (Next.js App Router)\n- **Default:** Build components as React Server Components (RSC) by default (no `'use client'` directive) to optimize bundle size and page load.\n- **Use Client Components only when:** The component uses browser-only APIs, event listeners (e.g., `onClick`), or stateful hooks (`useState`, `useEffect`, `useContext`).\n- **RSC Data Fetching:** Fetch data directly in Server Components using async\u002Fawait and pass the data down to Client Components for interactive tasks.\n\n### 7. Backend System Boundaries & API Contracts (Angel Spec)\nWhen implementing components that interface with the backend or database, strict integration boundaries must be respected:\n- **API Contracts:** Define typed schemas for REST, RPC, or Event-driven APIs before writing client-side fetchers or state handlers. Use TypeScript interfaces or schema validation to enforce boundary integrity.\n- **Concurrency & Fetch Safety:** Implement race-condition protections (e.g. using `AbortController` in client-side fetches or handling component unmounts) and concurrency safety.\n- **Caching & State:** Utilize local storage or client caches with explicit invalidation rules to prevent redundant network fetches.\n- **\"Kill List\" Strategy:** Actively identify and eliminate redundant endpoints, dead code, unused props, or unnecessary state synchronization mechanisms. Keep endpoints and logic lean and focused.\n\n### 8. Styling System & Custom Token Integration (Bliss Spec)\nWhen styling components, instead of using hardcoded Tailwind utilities, prioritize CSS variables and token structures:\n- **CSS Variable Mapping:** Map typography scales, borders, border-widths, and colors to local or global CSS variables (e.g., `--radius-md`, `--color-primary-accent`, `--font-heading`).\n- **Characterful UI Styles:** Support distinct brand themes (e.g. Neo-brutalist with thick borders and high contrast shadows, Playful with curved shapes, or Sleek Dark Mode with neon glow) via customizable variables.\n\n---\n\n## Standard React Component Template (5-States Example)\nBelow is the core standard template for implementing stateful, accessible, and token-governed components.\n\n```tsx\nimport React, { useState } from 'react';\nimport { AlertCircle, RefreshCw, Layers, ArrowRight, Loader2 } from 'lucide-react';\nimport { cn } from '@\u002Flib\u002Futils'; \u002F\u002F standard shadcn\u002Fui class merger\n\ninterface AlertItem {\n  id: string;\n  title: string;\n  severity: 'critical' | 'warning' | 'info';\n  timestamp: string;\n}\n\ninterface ComplianceDashboardProps {\n  initialAlerts?: AlertItem[];\n  isLoading?: boolean;\n  error?: string | null;\n  onRetry?: () => void;\n}\n\nexport function ComplianceDashboard({\n  initialAlerts = [],\n  isLoading = false,\n  error = null,\n  onRetry,\n}: ComplianceDashboardProps) {\n  const [alerts, setAlerts] = useState\u003CAlertItem[]>(initialAlerts);\n\n  \u002F\u002F 1. LOADING STATE (Pulsing Skeleton UI)\n  if (isLoading) {\n    return (\n      \u003Csection \n        className=\"w-full p-6 space-y-4 bg-background border border-border rounded-lg\"\n        aria-busy=\"true\"\n        aria-label=\"Loading compliance alerts\"\n      >\n        \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n        \u003Cdiv className=\"space-y-3\">\n          {[1, 2, 3].map((n) => (\n            \u003Cdiv key={n} className=\"h-16 w-full bg-muted animate-pulse rounded-md\" \u002F>\n          ))}\n        \u003C\u002Fdiv>\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 2. ERROR STATE (Graceful Failure Handler)\n  if (error) {\n    return (\n      \u003Csection \n        role=\"alert\" \n        className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4 text-center\"\n      >\n        \u003CAlertCircle className=\"h-12 w-12 text-destructive\" aria-hidden=\"true\" \u002F>\n        \u003Cdiv className=\"space-y-1\">\n          \u003Ch3 className=\"text-lg font-semibold tracking-tight text-foreground\">Failed to load alerts\u003C\u002Fh3>\n          \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n        \u003C\u002Fdiv>\n        {onRetry && (\n          \u003Cbutton\n            onClick={onRetry}\n            className=\"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors bg-destructive text-destructive-foreground hover:bg-destructive\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-destructive focus-visible:ring-offset-2 focus:outline-none\"\n          >\n            \u003CRefreshCw className=\"mr-2 h-4 w-4 animate-spin-hover\" \u002F>\n            Retry Connection\n          \u003C\u002Fbutton>\n        )}\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 3. EMPTY STATE (Clear CTA guidance)\n  if (alerts.length === 0) {\n    return (\n      \u003Csection className=\"flex flex-col items-center justify-center p-12 border-2 border-dashed border-muted rounded-lg bg-card text-center space-y-4\">\n        \u003Cdiv className=\"p-3 bg-muted rounded-full text-muted-foreground\">\n          \u003CLayers className=\"h-8 w-8\" aria-hidden=\"true\" \u002F>\n        \u003C\u002Fdiv>\n        \u003Cdiv className=\"space-y-2\">\n          \u003Ch3 className=\"text-lg font-semibold text-foreground\">No active alerts found\u003C\u002Fh3>\n          \u003Cp className=\"text-sm text-muted-foreground max-w-sm\">\n            Your queue is clear. When compliance anomalies are detected, they will appear here.\n          \u003C\u002Fp>\n        \u003C\u002Fdiv>\n        \u003Cbutton\n          onClick={() => {}}\n          className=\"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F95 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n        >\n          Check System Status\n          \u003CArrowRight className=\"ml-2 h-4 w-4\" \u002F>\n        \u003C\u002Fbutton>\n      \u003C\u002Fsection>\n    );\n  }\n\n  \u002F\u002F 4. IDEAL STATE (Standard Grid Layout)\n  return (\n    \u003Csection \n      className=\"p-6 bg-card border border-border rounded-lg shadow-sm space-y-4\"\n      aria-label=\"Active compliance alerts list\"\n    >\n      \u003Cdiv className=\"flex justify-between items-center\">\n        \u003Ch2 className=\"text-xl font-bold tracking-tight text-foreground\">Active Compliance Queue\u003C\u002Fh2>\n        \u003Cspan className=\"text-xs font-semibold px-2 py-1 bg-muted rounded text-muted-foreground\">\n          {alerts.length} Remaining\n        \u003C\u002Fspan>\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"space-y-3\">\n        {alerts.map((alert) => (\n          \u003Cdiv\n            key={alert.id}\n            className=\"flex items-center justify-between p-4 bg-background border border-border hover:border-accent hover:bg-accent\u002F5 rounded-md transition-colors shadow-sm\"\n          >\n            \u003Cdiv className=\"flex-1 min-w-0 pr-4\">\n              {\u002F* 5. PARTIAL\u002FTRUNCATED STATE handled via truncate utilities *\u002F}\n              \u003Ch3 className=\"text-sm font-semibold text-foreground truncate\" title={alert.title}>\n                {alert.title}\n              \u003C\u002Fh3>\n              \u003Cp className=\"text-xs text-muted-foreground mt-1\">\n                Detected: {alert.timestamp}\n              \u003C\u002Fp>\n            \u003C\u002Fdiv>\n            \n            \u003Cspan className={cn(\n              \"text-xs px-2.5 py-1 rounded-full font-medium capitalize\",\n              alert.severity === 'critical' && \"bg-destructive\u002F10 text-destructive border border-destructive\u002F20\",\n              alert.severity === 'warning' && \"bg-warning\u002F10 text-warning border border-warning\u002F20\",\n              alert.severity === 'info' && \"bg-info\u002F10 text-info border border-info\u002F20\"\n            )}>\n              {alert.severity}\n            \u003C\u002Fspan>\n          \u003C\u002Fdiv>\n        ))}\n      \u003C\u002Fdiv>\n    \u003C\u002Fsection>\n  );\n}\n```\n\n## Next.js Server & Client Component Template (Suspense & RSC Example)\nBelow is the pattern for splitting components into static Server Components (for data fetching and boundaries) and interactive Client Components.\n\n```tsx\n\u002F\u002F ==========================================\n\u002F\u002F 1. SERVER COMPONENT (app\u002Fcompliance\u002Fpage.tsx)\n\u002F\u002F ==========================================\nimport React, { Suspense } from 'react';\nimport { ComplianceDashboard } from '.\u002Fcompliance-dashboard'; \u002F\u002F Client Component\nimport { fetchComplianceAlerts } from '@\u002Flib\u002Fapi'; \u002F\u002F Mock data fetcher\n\nexport default async function CompliancePage() {\n  return (\n    \u003Cmain className=\"container mx-auto py-8 space-y-6\">\n      \u003Ch1 className=\"text-2xl font-bold tracking-tight text-foreground\">System compliance status\u003C\u002Fh1>\n      \n      {\u002F* Loading state delegated to Suspense boundary *\u002F}\n      \u003CSuspense fallback={\u003CComplianceDashboardSkeleton \u002F>}>\n        \u003CComplianceDataWrapper \u002F>\n      \u003C\u002FSuspense>\n    \u003C\u002Fmain>\n  );\n}\n\nasync function ComplianceDataWrapper() {\n  try {\n    const alerts = await fetchComplianceAlerts();\n    return \u003CComplianceDashboard initialAlerts={alerts} \u002F>;\n  } catch (err) {\n    \u002F\u002F Error state handles fallback UI gracefully\n    return (\n      \u003CComplianceDashboardError \n        error={err instanceof Error ? err.message : 'Unknown data fetch error'} \n      \u002F>\n    );\n  }\n}\n\nfunction ComplianceDashboardSkeleton() {\n  return (\n    \u003Cdiv className=\"w-full p-6 space-y-4 bg-background border border-border rounded-lg\" aria-busy=\"true\">\n      \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n      \u003Cdiv className=\"space-y-3\">\n        {[1, 2, 3].map((n) => (\n          \u003Cdiv key={n} className=\"h-16 w-full bg-muted animate-pulse rounded-md\" \u002F>\n        ))}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction ComplianceDashboardError({ error }: { error: string }) {\n  return (\n    \u003Cdiv role=\"alert\" className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4\">\n      \u003Ch3 className=\"text-lg font-semibold text-foreground\">Failed to load alerts\u003C\u002Fh3>\n      \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Expected Output Format\nThe resulting code output should contain:\n1. **Component Hierarchy Diagram:** Text-based indentation detailing subcomponent scopes.\n2. **TypeScript Declarations:** Defining the schema constraints of inputs\u002Fprops.\n3. **Verified Code Snippet:** Fully functional, token-aligned React component script.\n4. **State Coverage Affirmation:** Explicitly listing where Loading, Empty, and Error states were coded.\n\n## Example Usage (Few-Shot Example)\n\n> **Threaded pipeline:** Example A continues the **e-commerce checkout** thread.\n> It consumes the audited UI spec from `design-system-governance` and produces a\n> real, runnable `CheckoutPanel.tsx` with all 5 lifecycle states — no placeholder.\n> Example B is the original condensed example.\n\n### Example A — CheckoutPanel implementation (thread, real code)\n\n```markdown\nUser: Convert the audited checkout UI spec into a React component. It must implement\nall 5 states (Ideal, Loading, Empty, Error, Partial), tokenized Tailwind, and a typed\nprops interface. No new dependencies.\n```\n\nResponse:\n\n````markdown\n## Component Hierarchy Diagram\n- CheckoutPanel (root, manages status)\n  - CheckoutLoadingSkeleton\n  - CheckoutEmptyState\n  - CheckoutErrorState\n  - OrderSummary (memoized, aria-live total)\n  - StepIndicator\n  - ShippingForm \u002F PaymentForm (active step)\n  - PlaceOrderBar (sticky, disabled while submitting)\n\n## TypeScript Declarations\n`CheckoutPanelProps` accepts `items`, `status`, `totals`, `paymentError`, `onSubmit`,\nand `onRetry`. `status` is a discriminated union forcing every branch to render.\n\n## Verified Code Snippet\n```tsx\nimport React, { useMemo } from 'react';\nimport { ShieldCheck, RefreshCw, ShoppingCart, Lock } from 'lucide-react';\nimport { cn } from '@\u002Flib\u002Futils'; \u002F\u002F shadcn class merger — in the allowlist\n\ntype CheckoutStatus = 'ideal' | 'loading' | 'empty' | 'error' | 'submitting';\n\ninterface CartItem {\n  id: string;\n  name: string;\n  qty: number;\n  price: number;\n}\ninterface CheckoutTotals {\n  subtotal: number;\n  shipping: number;\n  discount?: number; \u002F\u002F Partial state: present only when a coupon is applied\n  total: number;\n}\ninterface CheckoutPanelProps {\n  items: CartItem[];\n  totals: CheckoutTotals;\n  status: CheckoutStatus;\n  paymentError?: string | null;\n  onSubmit?: () => void;\n  onRetry?: () => void;\n}\n\n\u002F\u002F 1. LOADING STATE — skeleton + aria-busy\nexport function CheckoutLoadingSkeleton() {\n  return (\n    \u003Csection\n      className=\"w-full p-6 space-y-4 bg-card border border-border rounded-lg\"\n      aria-busy=\"true\"\n      aria-label=\"Loading checkout\"\n    >\n      \u003Cdiv className=\"h-6 w-1\u002F3 bg-muted animate-pulse rounded\" \u002F>\n      {[1, 2, 3].map((n) => (\n        \u003Cdiv key={n} className=\"h-12 w-full bg-muted animate-pulse rounded-md\" \u002F>\n      ))}\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F 2. EMPTY STATE — clear CTA, no dead ends\nexport function CheckoutEmptyState() {\n  return (\n    \u003Csection className=\"flex flex-col items-center justify-center p-12 border-2 border-dashed border-muted rounded-lg bg-card text-center space-y-4\">\n      \u003Cdiv className=\"p-3 bg-muted rounded-full text-muted-foreground\">\n        \u003CShoppingCart className=\"h-8 w-8\" aria-hidden=\"true\" \u002F>\n      \u003C\u002Fdiv>\n      \u003Ch3 className=\"text-lg font-semibold text-foreground\">Your cart is empty\u003C\u002Fh3>\n      \u003Cp className=\"text-sm text-muted-foreground max-w-sm\">\n        Add items to your cart before checking out.\n      \u003C\u002Fp>\n      \u003Ca\n        href=\"\u002Fshop\"\n        className=\"inline-flex items-center justify-center h-11 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n      >\n        Continue shopping\n      \u003C\u002Fa>\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F 3. ERROR STATE — inline payment error + retry, no full-screen wipe\nexport function CheckoutErrorState({ error, onRetry }: { error: string; onRetry?: () => void }) {\n  return (\n    \u003Csection\n      role=\"alert\"\n      className=\"flex flex-col items-center justify-center p-8 bg-destructive\u002F10 border border-destructive\u002F20 text-destructive rounded-lg space-y-4 text-center\"\n    >\n      \u003Cdiv className=\"space-y-1\">\n        \u003Ch3 className=\"text-lg font-semibold tracking-tight text-foreground\">Payment could not be completed\u003C\u002Fh3>\n        \u003Cp className=\"text-sm text-muted-foreground\">{error}\u003C\u002Fp>\n      \u003C\u002Fdiv>\n      {onRetry && (\n        \u003Cbutton\n          onClick={onRetry}\n          className=\"inline-flex items-center justify-center h-11 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary\u002F90 rounded-md focus-visible:ring-2 focus-visible:ring-ring focus:outline-none\"\n        >\n          \u003CRefreshCw className=\"mr-2 h-4 w-4\" aria-hidden=\"true\" \u002F>\n          Try again\n        \u003C\u002Fbutton>\n      )}\n    \u003C\u002Fsection>\n  );\n}\n\n\u002F\u002F ROOT — branches on status; Ideal + Partial share the layout\nexport function CheckoutPanel({\n  items, totals, status, paymentError, onSubmit, onRetry,\n}: CheckoutPanelProps) {\n  \u002F\u002F 4. IDEAL STATE (and 5. PARTIAL when a coupon\u002Fdiscount is applied)\n  const memoizedTotal = useMemo(() => totals.total, [totals.total]);\n  const isLocked = status === 'submitting' || status === 'loading';\n\n  if (status === 'loading') return \u003CCheckoutLoadingSkeleton \u002F>;\n  if (status === 'empty' || items.length === 0) return \u003CCheckoutEmptyState \u002F>;\n  if (status === 'error')\n    return \u003CCheckoutErrorState error={paymentError ?? 'Unknown error'} onRetry={onRetry} \u002F>;\n\n  return (\n    \u003Cmain className=\"grid gap-6 md:grid-cols-5\">\n      {\u002F* Summary rail — sticky on desktop, disclosure on mobile *\u002F}\n      \u003Caside className=\"md:col-span-2 md:sticky md:top-6 h-fit\">\n        \u003Csection\n          className=\"p-6 bg-card border border-border rounded-lg space-y-4\"\n          aria-label=\"Order summary\"\n        >\n          \u003Ch2 className=\"text-lg font-bold tracking-tight text-foreground\">Order summary\u003C\u002Fh2>\n          \u003Cul className=\"space-y-3\">\n            {items.map((item) => (\n              \u003Cli key={item.id} className=\"flex justify-between text-sm text-foreground\">\n                \u003Cspan className=\"truncate pr-4\">{item.name} × {item.qty}\u003C\u002Fspan>\n                \u003Cspan>${(item.price * item.qty).toFixed(2)}\u003C\u002Fspan>\n              \u003C\u002Fli>\n            ))}\n          \u003C\u002Ful>\n          {\u002F* PARTIAL STATE: discount row only renders when a coupon is applied *\u002F}\n          {typeof totals.discount === 'number' && (\n            \u003Cp className=\"text-sm text-success\" aria-live=\"polite\">\n              Coupon applied: −${totals.discount.toFixed(2)}\n            \u003C\u002Fp>\n          )}\n          \u003Cp className=\"flex justify-between text-base font-semibold text-foreground\" aria-live=\"polite\">\n            \u003Cspan>Total\u003C\u002Fspan>\n            \u003Cspan>${memoizedTotal.toFixed(2)}\u003C\u002Fspan>\n          \u003C\u002Fp>\n          \u003Cp className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n            \u003CShieldCheck className=\"h-4 w-4\" aria-hidden=\"true\" \u002F> Secure payment via Stripe\n          \u003C\u002Fp>\n        \u003C\u002Fsection>\n      \u003C\u002Faside>\n\n      {\u002F* Active step + sticky CTA *\u002F}\n      \u003Csection className=\"md:col-span-3 space-y-6\" aria-labelledby=\"step-title\">\n        \u003Ch1 id=\"step-title\" className=\"text-xl font-bold tracking-tight text-foreground\">Payment\u003C\u002Fh1>\n        \u003Col aria-label=\"Checkout steps\" className=\"flex gap-2 text-xs text-muted-foreground\">\n          \u003Cli>Shipping\u003C\u002Fli>\u003Cli aria-current=\"step\" className=\"font-semibold text-foreground\">Payment\u003C\u002Fli>\u003Cli>Review\u003C\u002Fli>\n        \u003C\u002Fol>\n        {\u002F* PaymentForm children omitted — targeted diff only, per Rule #5 *\u002F}\n      \u003C\u002Fsection>\n\n      \u003Cfooter role=\"region\" aria-label=\"Place order\" className=\"md:col-span-5\">\n        \u003Cdiv className=\"sticky bottom-0 flex items-center justify-between gap-4 p-4 bg-background\u002F95 border-t border-border backdrop-blur\">\n          \u003Cspan className=\"text-sm text-muted-foreground\">\n            \u003CLock className=\"inline mr-1 h-4 w-4\" aria-hidden=\"true\" \u002F> Encrypted\n          \u003C\u002Fspan>\n          \u003Cbutton\n            onClick={onSubmit}\n            disabled={isLocked}\n            className={cn(\n              'inline-flex items-center justify-center h-11 px-6 text-sm font-medium rounded-md',\n              'bg-primary text-primary-foreground hover:bg-primary\u002F90',\n              'disabled:opacity-50 disabled:cursor-not-allowed',\n              'focus-visible:ring-2 focus-visible:ring-ring focus:outline-none'\n            )}\n          >\n            {status === 'submitting' ? 'Processing…' : `Place Order — $${memoizedTotal.toFixed(2)}`}\n          \u003C\u002Fbutton>\n        \u003C\u002Fdiv>\n      \u003C\u002Ffooter>\n    \u003C\u002Fmain>\n  );\n}\n```\n\n## State Coverage Affirmation\n- Loading: `CheckoutLoadingSkeleton` rendered when `status === 'loading'` (aria-busy, skeleton).\n- Empty: `CheckoutEmptyState` rendered when `status === 'empty'` or no items (CTA to \u002Fshop).\n- Error: `CheckoutErrorState` rendered when `status === 'error'` (role=alert, retry).\n- Ideal: summary + active step + Place Order bar rendered when data is present.\n- Partial: discount row + aria-live total update when `totals.discount` is applied mid-flow.\n- a11y: aria-current step, aria-live total, role=region\u002Frole=alert, visible focus rings, h-11 (44px) touch targets, semantic `\u003Cmain>\u002F\u003Caside>\u002F\u003Csection>\u002F\u003Cfooter>\u002F\u003Cbutton>`.\n- Dependencies: react + lucide-react + cn (clsx\u002Ftailwind-merge) only. No new packages.\n\n> Handoff: this component is the input to `review-critique` (0-120 scorecard).\n````\n\n### Example B — Condensed AlertQueue (edge case)\n\n```markdown\nUser: Convert the approved alert queue UI spec into a React component.\n```\n\nResponse:\n\n```markdown\n## Component Hierarchy Diagram\n- AlertQueue\n  - AlertQueueHeader\n  - AlertQueueState\n  - AlertQueueList\n  - AlertQueueItem\n\n## TypeScript Declarations\n`AlertQueueProps` accepts `alerts`, `isLoading`, `error`, and `onRetry`.\n\n## Verified Code Snippet\n[Provide the targeted React component code with semantic sections, typed props,\n5 UI states, tokenized Tailwind classes, and no new dependencies.]\n\n## State Coverage Affirmation\n- Loading: skeleton block rendered when `isLoading`\n- Error: retry panel rendered when `error`\n- Empty: empty queue CTA rendered when `alerts.length === 0`\n- Ideal: list rendered when data exists\n- Partial: long titles truncated with `title` fallback\n```\n\n## Common Pitfalls\n1. Treating the first generated component as production-ready — always enforce the 5-state contract and accessibility checks before declaring done.\n2. Importing libraries outside the allowed stack (`react`, `lucide-react`, `clsx`, `tailwind-merge`, `radix-ui` primitives) without explicit human approval — strict dependency control.\n3. Prop-drilling `isLoading` and `error` through components instead of using Suspense boundaries (Next.js `loading.tsx`) and Error Boundaries (`error.tsx`) — use the framework's native patterns.\n4. Rewriting entire files for small changes — present targeted diffs with `\u002F\u002F ... existing code ...` placeholders to minimize blast radius.\n5. Defaulting to Client Components (`'use client'`) when a Server Component would suffice — build RSC by default; only add `'use client'` for browser APIs, event listeners, or stateful hooks.\n\n## Verification Checklist\n- [ ] Every data-driven component implements all 5 lifecycle states with accessible indicators (`aria-busy`, `aria-live`).\n- [ ] Dependencies match the allowlist; no new npm packages were introduced without explicit human approval.\n- [ ] Server vs Client component decision is explicit and documented per file.\n- [ ] Code changes are presented as targeted diffs, not full-file rewrites.\n- [ ] Semantic HTML is used (`\u003Cbutton>`, `\u003Cmain>`, `\u003Cnav>`); `\u003Cdiv onClick>` is rejected unless `role=\"button\"` and keyboard handlers are added.\n- [ ] API contracts are typed (TypeScript interfaces) before any fetcher is written.\n\n",{"name":5,"author":9,"license":15,"version":24,"metadata":25,"description":7,"stack_compat":40},"2.1.0",{"hermes":26},{"tags":27,"related_skills":35},[28,29,30,31,32,33,34],"code","react","nextjs","typescript","tailwind","shadcn","production",[36,37,38,39],"design-system-governance","ui-generation-structured","review-critique","anti-patterns-detector",[41,42,43],"tailwind@3.x","shadcn@2.x","react@18.x","main","142c1bf4c5fa8f8c1bdff6f9620375d429cceb1d","skills\u002Fcode\u002Fcode-generation","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer","https:\u002F\u002Fgithub.com\u002Fgamemun01","2026-10-12 23:45:44",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add gamemun01\u002Fai-design-engineer --skill code-generation",{"tool":56,"command":57},"bunx","bunx skills add gamemun01\u002Fai-design-engineer --skill code-generation",{"tool":59,"command":60},"pnpm","pnpm dlx skills add gamemun01\u002Fai-design-engineer --skill code-generation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fcode\u002Fcode-generation\u002FSKILL.md",true,[],[65,72,78,84,90,97],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7382QVG1QTWD8X9CWD9RBHG","ux-decision-framework","Create UX decision documents from product context, user goals, journeys, task flows, information architecture, accessibility, and trade-offs. Use before wireframes, UI generation, redesign decisions, complex feature planning, or when a user asks for UX rationale.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fux\u002Fux-decision-framework\u002FSKILL.md",[],[],{"skillNo":73,"name":37,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7382KR46P5ET7Z1TC8M9PYB","Generate UI screens, variants, and implementation-ready prompts using the 8-layer prompt architecture and design-system constraints. Use when a UX decision exists and the next step is structured UI generation for dashboards, forms, landing pages, internal tools, or app screens.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fui\u002Fui-generation-structured\u002FSKILL.md",[],[],{"skillNo":79,"name":36,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7382ES5CEZBZTXVQ0VCM3QT","Enforce design-system rules, spacing scales, typography hierarchy, semantic color roles, accessibility constraints, and component contracts. Use when auditing generated UI, creating design tokens, reviewing component consistency, or preventing arbitrary styles.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fui\u002Fdesign-system-governance\u002FSKILL.md",[],[],{"skillNo":85,"name":38,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M73829S56RVV245HPGMPV1W2","Run a mechanical quality gate for visual quality, UX, accessibility, responsiveness, and engineering readiness using a 0-120 scorecard. Use before shipping UI\u002Fcode, after generation, after refinement, or when the user asks for critique, review, audit, or production readiness.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fquality\u002Freview-critique\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M73824S3Q7337443Q43AD90K","refinement-workflow","Iteratively improve generated UI or code after review findings by fixing high-impact issues, rescoring, and stopping when quality gates pass. Use after review-critique reports scores below threshold, when the user asks to refine or improve output, or when issues must be resolved without broad rewrites.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fquality\u002Frefinement-workflow\u002FSKILL.md",[],[],{"skillNo":98,"name":39,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M7382047ANKESKYEA2QEJD64","Detect AI design and frontend anti-patterns using the repository anti-pattern catalog, including visual, UX, accessibility, code, workflow, and production-readiness issues. Use for pre-shipping audits, recurring problem diagnosis, or when output feels inconsistent, inaccessible, overdesigned, or hard to maintain.","https:\u002F\u002Fgithub.com\u002Fgamemun01\u002Fai-design-engineer\u002Fblob\u002Fmain\u002Fskills\u002Fquality\u002Fanti-patterns-detector\u002FSKILL.md",[],[]]