Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add wiztral/agent-skills --skill "shadcn-setup"
Install specific skill from multi-skill repository
# Description
Initialize Shadcn UI in an EXISTING Next.js or React (Vite) project.
# SKILL.md
name: shadcn-setup
description: Initialize Shadcn UI in an EXISTING Next.js or React (Vite) project.
Shadcn Setup
Use this skill to add Shadcn UI to a project that already exists but doesn't have it configured.
Documentation
Workflow
1. Environment & Prerequisites Detection
Before initializing, ensure the environment is ready:
A. Framework
- Next.js: check for
next.config.jsornext.config.ts. - Vite: check for
vite.config.tsorvite.config.js.
B. Tailwind CSS (CRITICAL)
Shadcn requires Tailwind CSS. Verify it is installed and configured:
- Check for
tailwind.config.js/tailwind.config.ts(v3). - OR check for specific Tailwind v4 CSS imports in
globals.css/index.css. - If missing: Install Tailwind CSS first (follow official Tailwind guides for the specific framework). DO NOT proceed with
shadcn initwithout Tailwind.
C. Path Aliases (tsconfig.json)
Shadcn relies on path aliases (e.g., @/lib/utils).
- Read
tsconfig.json(orjsconfig.json). - Ensure
"paths": { "@/*": ["./src/*"] }(or similar) is configured. - If missing: Add the alias configuration to
compilerOptions.
2. Initialization
Run the init command using pnpm:
pnpm dlx shadcn@latest init
3. Configuration
Follow these defaults unless specified otherwise:
- Style: New York (Default) or Default.
- Base Color: Slate.
- CSS Variables: YES (Critical for dynamic theming).
- Aliasing: Accept defaults (usually
@/components,@/lib/utils) or matchtsconfig.json.
4. Cleanup & Boilerplate Removal
For Next.js (app/)
- Clean
page.tsx: Replace default Next.js hero content with a simple shadcn Button to verify setup. - Clean
globals.css: Remove all default styling (root variables for foreground/background-rgb) EXCEPT:- Tailwind directives (
@tailwind base;...) - Shadcn layer definitions (
@layer base { ... })
- Tailwind directives (
For Vite (src/)
- Clean
App.tsx: Removelogos,countstate, and default boilerplates. Replace with a simple shadcn content. - Clean
index.css: Ensure it contains Tailwind directives and Shadcn base layers. Remove legacy:rootstyles if they conflict.
5. Verification
- Check
components.jsonexists. - Check
lib/utils.ts(or configured alias) exists and exportscn.
References
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.