一键导入
design-system
Scaffold and maintain a shadcn-backed design-system reference page and agent guardrails.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold and maintain a shadcn-backed design-system reference page and agent guardrails.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | design-system |
| description | Scaffold and maintain a shadcn-backed design-system reference page and agent guardrails. |
You are guiding a builder through setting up a shadcn-backed design system in a React + Tailwind v4 codebase. shadcn is the source of truth for components/ui, theme tokens, aliases, component APIs, icons, and presets. This skill owns the app-specific reference page, route wiring, migration scan, and managed agent instructions.
The output is:
components.json, theme CSS, aliases, and installed shadcn components)./admin/design-system by default.AGENTS.md and/or CLAUDE.md telling future agents to use shadcn first.components/ui primitives when shadcn already has a component. Use npx shadcn@latest add, info, docs, view, add --diff, and preset commands.npx shadcn@latest preset decode <code> --json and apply it through shadcn. Do not invent or persist a custom preset field outside shadcn-managed files.pnpm dlx skills add shadcn/ui when it is not already available.bg-background, text-foreground, text-muted-foreground, border-border, bg-card, etc.).shadcn add --diff, skip conflicting files, or ask before overwriting.Inspect the codebase before asking questions.
Use the first matching framework:
vite.config.ts / vite.config.js / vite.config.mts exists.next.config.* exists and app/ exists.next.config.* exists and pages/ exists, with no app/.Gemfile contains inertia-rails or inertia_rails and app/frontend/ or app/javascript/pages/ exists.Gemfile contains react_on_rails.Look for one of:
@import "tailwindcss" in CSS under src/, app/, app/javascript/, or app/frontend/.@tailwindcss/vite, @tailwindcss/postcss, or tailwindcss@^4 in package.json.If none is found, or if Tailwind v3 markers are found (tailwind.config.js, @tailwind base;), stop:
This skill requires Tailwind CSS v4 or later. Please upgrade first - see https://tailwindcss.com/docs/upgrade-guide - and re-run.
Check:
components.jsonnpx shadcn@latest info --jsonnpx shadcn@latest preset resolve --jsoncomponents/ui/*design-system:start markers in AGENTS.md or CLAUDE.mdIf components.json exists, treat shadcn as already initialized and use its aliases. If it is missing, initialize shadcn in Phase 2.
State a brief detection summary before continuing. Example:
Detected: Vite + React + Tailwind v4. shadcn is not initialized. I'll initialize shadcn with defaults unless you provide a preset code, then add the design-system reference page.
Default route: /admin/design-system.
Use AskUserQuestion:
Use /admin/design-system (recommended), Use /design-system, Use /styleguideIf the user picks Other and provides a custom path, accept it if it starts with /.
Save the value as routePath.
Tell the user:
This design-system skill relies on shadcn as the source of truth. If the shadcn skill is not installed in this environment, install it with
pnpm dlx skills add shadcn/uiso future agents can inspectcomponents.jsonand use shadcn correctly.
Do not stop only because the shadcn skill is absent; continue using the shadcn CLI.
Ask whether to use a preset only when shadcn is missing or the user explicitly asked to change theme:
Use shadcn defaults (recommended) - initialize/apply the current shadcn default.Use a preset code - ask for the code, then validate and apply it.Keep current shadcn setup - only available when components.json exists.If the user provides a preset code:
npx shadcn@latest preset decode <code> --json.npx shadcn@latest init --base radix --preset <code> -y.npx shadcn@latest apply <code> --yes.If no preset is provided:
npx shadcn@latest init --base radix --preset nova -y. nova is the current default shadcn preset name in the CLI's project-creation flow.For Rails or unknown layouts where init cannot infer paths cleanly, create or update components.json only with explicit user confirmation. Prefer printing the recommended shadcn setup command and manual alias guidance instead of guessing.
Install the baseline components that the reference page documents:
npx shadcn@latest add button button-group badge card input textarea label field checkbox radio-group select native-select dialog dropdown-menu table separator tabs toggle toggle-group switch sheet tooltip -y
If a file already exists, do not use --overwrite by default. Use:
npx shadcn@latest add <component> --diff
Ask before overwriting any existing user-modified components/ui/* file.
Resolve target paths using the detected framework and shadcn aliases from components.json.
Canonical targets:
| Logical path | Vite target |
|---|---|
| route page | src/admin/design-system/page.tsx |
| reference component | src/components/design-system/DesignSystem.tsx |
Framework overrides:
app/admin/design-system/page.tsx; component at components/design-system/DesignSystem.tsx unless src/ is used.pages/admin/design-system.tsx.app/frontend/pages/admin/design-system.tsx or app/javascript/pages/admin/design-system.tsx, matching project convention.src/components/design-system/ if src/ exists, otherwise components/design-system/, and print a manual route snippet.Copy references/page/DesignSystem.tsx into the component target. Substitute:
| Token | Replacement |
|---|---|
__ROUTE_PATH__ | chosen route path |
@/components/ui/ | the configured shadcn UI alias from components.json |
@/lib/utils | the configured utils alias from components.json, if needed |
Create the route entry file for the framework. It should import and render DesignSystem.
For app-router/client environments, make sure a "use client" directive is present because the reference page uses interactive shadcn components.
Use the corresponding snippet under references/routing/.
<Routes> block when detection is clean.Open AGENTS.md if it exists, else CLAUDE.md if it exists, else create AGENTS.md. If both exist, update both.
Before appending the managed block, reconcile existing UI/styling directives outside design-system markers:
Append or replace the block from references/agent-instructions.md, substituting __ROUTE_PATH__.
After the reference page is in place, scan user-facing UI outside components/ui/ and components/design-system/.
Look for:
<button>, <input>, <select>, <textarea>, dialogs, dropdowns, tabs, tables, switches, and cards that should use shadcn components.Group findings by broad bucket:
If findings exist, ask:
Yes, migrate everything nowYes, but just one bucketNot nowDo not auto-migrate without explicit opt-in.
When migrating, preserve behavior and copy. Replace visual implementation with shadcn components and semantic tokens only.
Print a short summary:
pnpm dlx skills add shadcn/ui.The page must:
shadcn CLI commands for adding/diffing components.components/ui exports, custom token names, and custom variant systems.Use the current CLI command surface:
npx shadcn@latest init --base radix --preset nova -y
npx shadcn@latest init --base radix --preset <code> -y
npx shadcn@latest apply <code> --yes
npx shadcn@latest add <component> -y
npx shadcn@latest add <component> --diff
npx shadcn@latest docs <component>
npx shadcn@latest info --json
npx shadcn@latest preset decode <code> --json
npx shadcn@latest preset resolve --json