Transform feature requests and visual requirements into precise, architecture-preserving implementation briefs for AI coding agents (Cursor, Claude Code, Antigravity CLI, GitHub Copilot) and UI generators (v0.dev, Lovable, Bolt.new, Google Stitch).
This skill enforces strict codebase discovery, token reuse, dependency preservation, component-applicable interaction states, and five-tier verification to prevent AI code generation from introducing duplicate libraries, hardcoded hex colors, and broken accessibility patterns.
To prevent duplication and context bloat across agent interactions, adhere strictly to these ownership boundaries:
| Domain Area | Codebase-Aware UI Prompts (This Skill) | UI/UX Pro Max (ui-ux-pro-max) | Design System (design-system) | Cinematic UI/UX (cinematic-ui-ux) |
|---|---|---|---|---|
| Primary Mission | Transforms feature requests into architecture-preserving prompts & implementation briefs. | Reference catalog of 50+ styles, 96 palettes, 57 font pairings, and 99 UX heuristics. | Mechanical rules for token architecture, FOUT prevention, and loading order. | Production GSAP timelines, Lenis smooth scroll, canvas frame scrubbing, route transitions. |
| Existing Codebases | Audits installed packages, forces reuse of @/components/ui/* and existing CSS variables. | Look up optimal aesthetic style for a domain. | Defines 3-tier token hierarchy from scratch. | Animates existing components with physics and gesture mechanics. |
| Prompt Engineering | Platform-specific contracts (Cursor, v0, Lovable, Stitch) with applicable state matrices. | None; reference lookup. | None; CSS guidelines. | Illustrative Playwright E2E motion test fixtures. |
| Interaction States | Calibrated matrix defining which of the 8 states apply to which component types. | General UX guidelines on touch targets and hover states. | Surface elevation tokens (base, raised, overlay). | Decorator pause controller and reduced-motion branches. |
| Dependency Guard | Forbids installing competing packages or hardcoding hex colors. | Recommends libraries based on technology stack. | Forbids arbitrary hex colors in CSS tokens. | Coordinates Lenis with ScrollTrigger ticker authority. |
When prompting an AI agent to build a feature inside an existing codebase, enforce these non-negotiable constraints:
package.json (e.g., do not add framer-motion if motion or tailwindcss-animate is present; do not add lucide-react if @radix-ui/react-icons is present).bg-[#0B0F19]). All visual styles must inherit existing semantic CSS variables or theme classes (bg-background, bg-card, text-card-foreground, border-border, text-primary).button.tsx or dialog.tsx exists in @/components/ui/, the prompt must instruct the agent to import and compose it.isMock: true properties or [MOCK_DATA] labels to prevent placeholder data from masquerading as verified live telemetry.@/components/features/[feature-name]/[component].tsx). Prohibit unauthorized overwrites of root configs (package.json, tailwind.config.*, app/layout.tsx).Before writing an implementation prompt or generating UI code, inspect these seven structural dimensions:
'use client' for hooks), Pages Router, Vite/SPA, or Astro.@base-ui/react), Mantine, or custom primitives.tailwind.config.*) vs Tailwind CSS v4 (@theme in CSS), CSS Modules, or CSS-in-JS.lucide-react, @radix-ui/react-icons, @heroicons/react).react-hook-form + zod vs native form elements.See references/codebase-discovery-protocol.md for detailed detection heuristics and the JSON audit output schema.
Select the exact contract matching the execution environment:
@/components/ui/* imports, exact CSS variable re-use, and unit test criteria.See references/platform-prompt-contracts.md for complete copy-ready prompt templates.
Do not demand that every component implement all interaction states. Apply states based on component archetype:
aria-invalid and aria-describedby).See references/ui-state-matrix.md for visual specifications and WCAG 2.2 accessibility attributes.
Evaluate UI implementations across five independent tiers rather than relying solely on visual appearance:
npx tsc --noEmit exits with code 0; props extend standard HTML attributes; zero untyped any.See references/ui-verification-rubric.md for evaluation rubrics and Playwright test fixtures.
Role: Senior Frontend Engineer
Task: Implement a Real-Time Incident Telemetry Drawer in `@/components/incidents/incident-drawer.tsx`.
1. Codebase Discovery Findings:
- Framework: Next.js 15 (App Router). Add `'use client'` directive.
- Component Foundation: Import existing primitives from `@/components/ui/sheet`, `@/components/ui/button`, and `@/components/ui/badge`.
- Styling: Use existing Tailwind CSS tokens: `bg-card`, `text-card-foreground`, `border-border`, `text-primary`. Do NOT add hex colors.
- Icons: Import `{ AlertTriangle, Clock, RefreshCw, X }` from `lucide-react`.
2. Props & Types:
- Export interface `IncidentDrawerProps`: `isOpen: boolean; onClose: () => void; incidentId?: string;`
- Model telemetry items with `{ id: string; metric: string; value: string; status: 'nominal' | 'degraded'; isMock: true; }`
3. Interaction States:
- Loading: Render 4 shimmer skeleton rows while incident details load (`aria-busy="true"`).
- Error: If fetch fails, show a high-contrast alert banner with a "Retry Connection" button (`role="alert"`).
- Keyboard Focus: Focus must be trapped inside the drawer while open (`aria-modal="true"`); pressing `Escape` must trigger `onClose()`, and focus must return to the trigger upon closing.
User Feature Request: "Add an export option for our analytics reports."
[CONFIRMED PRODUCT REQUIREMENT]
- Product Goal: Provide users with an interface action to export analytics report data from the dashboard.
[WORKING ASSUMPTIONS - REQUIRE USER VALIDATION]
- Assumption A (Presentation Pattern): Deliver the feature as a modal dialog (`@/components/ui/dialog`) triggered from the analytics header, rather than a dedicated export page or dropdown action.
- Assumption B (Technology Foundation): Assume target stack is React 19 + Tailwind CSS v3.4 + Radix UI Dialog, using semantic tokens (`bg-background`, `border-border`, `text-foreground`).
- Assumption C (Export Formats): Provide CSV and JSON export options (PDF / Excel generation deferred until user confirms server capacity).
- Assumption D (Date Range): Default export date range to "Last 30 Days" if no custom filter is active.
- Assumption E (Delivery Mechanism): Exports < 10,000 rows download directly in-browser; exports >= 10,000 rows trigger an asynchronous background job with email delivery to avoid browser timeout.
- Assumption F (Permissions): User possesses standard report export permissions; advanced role-based access control (RBAC) restrictions are not yet specified.
Implementation Directive:
- Structure the prompt to flag unconfirmed technical stack and product assumptions to the product owner before merging.
- Render an informational badge labeled "[WORKING_ASSUMPTION: Async Email Flow]" next to large export options so unverified behavior is immediately recognizable in review.
Build a 3-step Vendor Onboarding Flow (`/onboarding/vendor`):
- Step 1: Legal Entity Details (Company Name, Tax ID, Registration Country).
- Step 2: Bank Disbursal Account (IBAN/Routing, Currency, Account Holder).
- Step 3: Compliance Certification & Document Upload.
State & Accessibility Architecture:
- Step Progress: Render `<ol role="list">` with `aria-current="step"` on the active step indicator.
- Validation: Validate on field blur. When invalid, mark `<input aria-invalid="true" aria-describedby="[field]-error">` and display an inline error message.
- Keyboard Navigation: Preserve natural document Tab flow (do NOT trap keyboard focus inside in-page forms). When the user advances to the next step, programmatically shift focus to the first interactive input or step heading. `Enter` submits the active step's primary action.
- Privacy-Conscious Failure Recovery: If submission times out or fails, retain uncommitted form state in transient component memory during the active session. Never persist sensitive banking credentials (IBAN, routing, tax IDs) to unencrypted browser storage (`sessionStorage` or `localStorage`). Mask displayed account numbers, render a contextual error banner with "Retry Submission", and require session re-authentication if the auth token expires.
- Synthetic Evidence: Label all mock banking verification tokens with `[MOCK_DATA]`.
Codebase-Aware UI Prompts provides an architecture-preserving prompt engineering framework. It transforms product and design requirements into precise implementation briefs that respect an existing project's dependencies, design tokens, component primitives, and accessibility standards without introducing architectural fragmentation.
Use this skill when:
When NOT to use:
cinematic-ui-ux instead.ui-ux-pro-max instead.design-system instead.prompt-engineering-patterns instead.references/ui-verification-rubric.md require a local test runner (@playwright/test, @axe-core/playwright) configured in the target project.tailwind.config.*, CSS globals, or components.json).package.json.[MOCK_DATA] or isMock: true to prevent leakage into production schemas.