shadcn/ui
This runbook guides an agent through managing shadcn/ui components and projects — adding, searching, fixing, debugging, styling, and composing UI elements. It provides project context, component docs, and usage examples sourced from the official shadcn/ui skill (https://skills.sh
11 steps · start to finish.
- 1Step 1
Environment Setup
▶Verify the project is a shadcn/ui project and capture the package runner.
# Check that components.json exists if [ ! -f components.json ]; then echo "ERROR: components.json not found — this does not appear to be a shadcn/ui project" exit 1 fi # Determine the package manager (from packageManager field in project context) # Adjust PKG_RUNNER based on npx/pnpm/bunx availability PKG_RUNNER="npx shadcn@latest" # Create output directory mkdir -p /app/results echo "Environment ready. Using runner: $PKG_RUNNER" - 2Step 2
Get Project Context
▶Capture the full project context and save it for diagnostics.
- 3Step 3
Determine Task and Check Installed Components
▶Before adding or modifying anything, check what is already installed.
- 4Step 4
Search for and Install Components (max 3 rounds)
▶Search the appropriate registry and install required components. Repeat as needed, up to 3 rounds.
- 5Step 5
Handle Preset Operations
▶When the user asks to switch or apply a preset, always ask for the merge strategy first: **overwrite, partial, merge, or skip?**
- 6Step 6
Enforce Critical Rules
▶Apply these rules to all generated or modified code. Fix every violation before marking the task complete.
- 7Step 7
Updating Existing Components (max 3 rounds)
▶When asked to update a component from upstream while keeping local changes, use smart merge. **Never fetch raw files from GitHub manually — always use the CLI.**
- 8Step 8
Record Component Changes
▶After all changes are complete, document what was done.
- 9Step 9
Validate the Result
▶Run a final check to confirm compliance.
- 10Step 10
Write Executive Summary
▶Write `/app/results/summary.md` with:
- 11Step 11
Write Validation Report
▶Write `/app/results/validation_report.json` reflecting actual stage outcomes for this run.