UI & Pages Scaffolding Specialist
Locate and read all artifacts in docs/legacy-audit/ directory.
Objective
Implement high-fidelity, modern React components using ShadCN and Tailwind, AND wire them together into fully functional Next.js pages (src/app/**/page.tsx) based on the requirements and Route Topology extracted from legacy Pug templates.
Instructions for the Scaffold Subagent
Copy this checklist and track your progress:
Task Progress:
- [ ] Step 1: Initialize ShadCN
- [ ] Step 2: Build Shared Layout Components (src/components/layout/)
- [ ] Step 3: Scaffold Domain Components (src/components/articles/, etc.)
- [ ] Step 4: Extract Route & Page Topology
- [ ] Step 5: Scaffold Pages (src/app/**/page.tsx)
- [ ] Step 6: Verification (Visual smoke-test)
- Initialize Design System: Install the core ShadCN CLI using
npx shadcn@latest initand configure the Tailwind theme (colors, fonts). - Build Shared Layouts: Create the
Navbar,Footer, andMobileMenu.- Logic: Replicate the conditional logic (e.g., Auth-links) from the legacy metadata using Next.js
getServerSession. - Modernize Features: Use premium ShadCN primitives (e.g.,
NavigationMenu,Avatar,Button,Card) instead of raw Bootstrap/CSS classes.
- Logic: Replicate the conditional logic (e.g., Auth-links) from the legacy metadata using Next.js
- Component Scaffolding: Build specific logic-heavy components like
CommentListandArticleCardusing the legacy field mapping. - Route & Page Topology Check: Go to the
docs/legacy-audit/UI_Component_Inventory.mdand explicitly extract the list of intended pages and URLs. - Page Scaffolding: For every single mapped route, create its routing wrapper in
src/app/[path]/page.tsx(e.g./articlesneedssrc/app/articles/page.tsx). Hook up all business logic, server actions, UX intent, and data fetching components required. - Verification (Visual smoke-test): Verify that the UI is visually appealing and functional.
Output Result: Ensure all components are exported from src/components/ and all pages are functionally implemented in src/app/.
Base UI & asChild Best Practices
If the design system uses @base-ui/react primitives (standard in ShadCN v4+), you MUST follow these patterns for asChild support:
- Implicit Slot Pattern: Use the
renderprop on Base UI primitives to implementasChild. - Button Semantics: When a
ButtonorMenuItemacts as aLink(viaasChild), you MUST setnativeButton={false}on the primitive to suppress semantics warnings and avoid invalid nested interactive elements.- Example:
<ButtonPrimitive nativeButton={false} render={(props) => <Link {...props} />}>
- Example:
- Prop Merging: Use
React.cloneElementor direct Prop spreading into therendercallback to ensureref,className, and event handlers are correctly merged onto the child.