Mode d’emploi
- Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
- Consultez le document original pour les outils, identifiants et environnements requis.
- Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/lebiraja/skills4agents --skill agent-module-frontend-ui-magic-shadcnAvant de commencer
- L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
- Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Document Skill original
Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.
Module: Frontend UI Implementation with Shadcn and Magic UI
1. Module Metadata
- Module ID:
agent.module.frontend-ui-magic-shadcn - Version:
1.0.0 - Maturity:
production - Scope: Guides agents on generating, installing, configuring, and using Shadcn and Magic UI components natively in Next.js + Tailwind web applications.
- Primary outcomes:
- Standardized setup of Tailwind CSS, Shadcn architecture, and Magic UI tokens.
- Reproducible premium component generation using CLI and MCP native tools.
- Consistent and robust aesthetic across UI components.
2. Mission and Applicability
Use this module when generating rich, highly animated, and premium frontend interfaces in Next.js.
Apply when:
- Creating new visual components, dashboards, or landing pages.
- Adding complex micro-animations or modern glassmorphism designs.
- Interacting with UI design tools (e.g., Shadcn CLI, Magic UI MCP Context).
Do not apply when:
- Working on backend node APIs or pure data orchestration.
- The user requests a basic vanilla HTML/CSS implementation without a build step.
3. Architecture Pattern
- Pattern:
Atomic Component Architecture (Next.js + Tailwind + Framer Motion + Shadcn + Magic UI) - Core design rules:
- Component Isolation: All UI primitives should reside within
components/ui/. - Utility Consolidation: Use
cn()helper (clsx + tailwind-merge) for dynamic styling rules (located inlib/utilsorlib/utils.ts). - Theming & Variables: Maintain design tokens (colors, animations, border radii) as native CSS variables within
app/globals.css. Do not hardcode absolute magic colors.
4. Implementation Workflow
Phase A: Environment Setup and Initialization
- Ensure project has Next.js and Tailwind configurations.
- Initialize Shadcn UI: Run
npx shadcn@latest initto setupcomponents.jsonand utility files. - Integrate Magic UI Configuration:
- Expand
tailwind.config.jsto include Magic UI keyframes and animations (e.g.,orbit,marquee,pulse,shine,aurora,shimmer-slide). - Append Magic UI color token variables to
app/globals.css(e.g.,--color-1to--color-5for rainbow accents). - Ensure
framer-motionandlucide-reactare installed. Runnpm install framer-motion clsx tailwind-mergeif required.
Exit criteria:
components.json,tailwind.config.js, andapp/globals.csscleanly unify both libraries without compilation errors./lib/utils.ts(or equivalent) exports a workingcnfunction.
Phase B: Component Sourcing and Installation
- Requesting Shadcn Components:
- Use the terminal/CLI tool to add standard UI primitives.
- Command:
npx shadcn@latest add <component_name>(e.g., button, dialog, card, input).
- Requesting Magic UI Components (Agentic Workflow via MCP):
- DO NOT hallucinate Magic UI source code.
- Step 1: Use
mcp_magic-ui_searchRegistryItemsto search and find the correct component identifier. - Step 2: Use
mcp_magic-ui_getRegistryItemwithincludeSource: trueto reliably retrieve the exact canonical implementation of the requested Magic UI component from your MCP connection. - Step 3: Extract the code from the MCP response and write the retrieved content into
components/ui/<component>.tsx. - Step 4: Add any component-specific dependencies or Tailwind configurations returned by the registry item payload.
Exit criteria:
- The component is physically present in
components/ui/and is exported cleanly. - Peer dependencies mapped by the MCP are resolved.
Phase C: Assembling Views and Animations
- Import primitives into the feature layout/page inside
app/orcomponents/. - Construct advanced premium aesthetic by composing
magic-card,bento-grid,animated-list, etc., wrapped around solid Shadcn form elements. - Validate responsive behavior across Tailwind modifiers (
sm:,md:,lg:). - Utilize
glass-effectclass names,text-gradient, or otherglobals.cssutility layers.
Exit criteria:
- The interface fulfills the user requirements and delivers a wow-factor presentation with smooth micro-animations.
5. Decision Framework
| Decision Area | Preferred Option | Alternative | Selection Rule |
|---|---|---|---|
| Core Primitives (Buttons, Forms, Inputs) | Shadcn UI | Custom Tailwind | Standardize accessible interaction elements using Shadcn primitives. |
| Hero Sections, Animations, Eye-candy | Magic UI | Framer Motion Custom | Use Magic UI elements for premium, vibrant layouts. Build custom with Framer Motion only if unsupported. |
| Magic UI Component Retrieval | MCP Tools (magic-ui) | Web Scraping/Browsing | Native MCP retrieval guarantees up-to-date accurate source code directly from the Magic UI registry. |
6. Validation Strategy
Functional Validation
- Ensure Framer Motion
<motion.div>hooks have no hydration mismatches in Next.js (prepend"use client";directive at the top of client-side animation components). - Ensure Shadcn form controls successfully connect with standard react context or hook forms.
Failure Validation
- Verify that standard dark mode toggling (using
next-themes) correctly flipsoklch()orhsl()variables insideapp/globals.css. Fallback gracefully if conditional rendering disrupts Framer Motion layouts.
Contract/Security/Performance Validation
- Keep excessive animated node counts minimized (e.g.,
particles,confetti) to guarantee ~60fps scrolling on lower-end devices.
7. Benchmarks and SLO Targets
- Design Fidelity:
Components must align exactly with the design language (fonts, shadow softness, glass effects) established in globals.css. - Reusability:
UI components should act purely as visual layers and not contain business logic. - MCP Context Accuracy:
Always query the registry before writing component code to prevent hallucinations.
8. Risks and Controls
- Risk: Hallucinating complex Magic UI component code leading to syntax or un-handled runtime errors.
- Control: Utilize the explicitly configured
magic-uiMCP connection tools (mcp_magic-ui_getRegistryItem) to pull official pristine source files perfectly. - Risk: Clashing Tailwind configurations or missed dependencies.
- Control: Rigorously audit
tailwind.config.jsextension maps (keyframes, colors) against the required metadata returned by the Magic UI registry.
9. Agent Execution Checklist
- [ ] Determine required visual interactive elements for the page.
- [ ] Auto-generate standard Shadcn components using
npx shadcn@latest add ...via terminal. - [ ] For premium animations, search Magic UI registry via MCP:
call:mcp_magic-ui_searchRegistryItems. - [ ] Pull specific Magic UI component source code via MCP:
call:mcp_magic-ui_getRegistryItem{name: "<item>", includeSource: true}. - [ ] Merge returned Tailwind constraints (
extendobjects,keyframes, etc.) intotailwind.config.js. - [ ] Verify imported variables align seamlessly with core themes mapped inside
app/globals.css. - [ ] Incorporate components into the UI layout with fluid, responsive structures.
10. Reuse Notes
Adapt only:
- Base color tokens in
globals.css(e.g. overriding--color-1) when implementing customized branding. - The
animationobject insidetailwind.config.jsto change loop speeds and durations.


