Skip to content
Skills Library
Programming · Review & audit

shadcn-optimizer

/shadcn-optimizer

Audit and optimize shadcn/ui projects (copy-in components, CLI 4.x, Tailwind 4, Radix/Base UI/React Aria primitives, Next/RSC, Vite, React Router, Astro, Laravel) for registry drift and upgrade hygiene, cn/CVA composition, forwardRef removal, Tailwind theme tokens and dark mode, use client boundaries and bundle size, dialog/form accessibility, and CLI migrations, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions shadcn, components.json, shadcn CLI, registry or blocks, cn/tailwind-m

Licence
MIT
Last repository change
04.11.2026

Assessment and security

85/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
11
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 04.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/audit.py

What it does and when to use it

Audit and optimize shadcn/ui projects (copy-in components, CLI 4.x, Tailwind 4, Radix/Base UI/React Aria primitives, Next/RSC, Vite, React Router, Astro, Laravel) for registry drift and upgrade hygiene, cn/CVA composition, forwardRef removal, Tailwind theme tokens and dark mode, use client boundaries and bundle size, dialog/form accessibility, and CLI migrations, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions shadcn, components.json, shadcn CLI, registry or blocks, cn/tailwind-m

Original author description

Audit and optimize shadcn/ui projects (copy-in components, CLI 4.x, Tailwind 4, Radix/Base UI/React Aria primitives, Next/RSC, Vite, React Router, Astro, Laravel) for registry drift and upgrade hygiene, cn/CVA composition, forwardRef removal, Tailwind theme tokens and dark mode, use client boundaries and bundle size, dialog/form accessibility, and CLI migrations, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions shadcn, components.json, shadcn CLI, registry or blocks, cn/tailwind-m

How it works

  1. Workflow
  2. Principles
Original SKILL.md headings · 64 lines, 751 words
SKILL.md preview
---
name: shadcn-optimizer
description: Audit and optimize shadcn/ui projects (copy-in components, CLI 4.x, Tailwind 4, Radix/Base UI/React Aria primitives, Next/RSC, Vite, React Router, Astro, Laravel) for registry drift and upgrade hygiene, cn/CVA composition, forwardRef removal, Tailwind theme tokens and dark mode, use client boundaries and bundle size, dialog/form accessibility, and CLI migrations, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions shadcn, components.json, shadcn CLI, registry or blocks, cn/tailwind-merge, CVA variants, Radix/Base UI migration, Tailwind 4 theme tokens, "use client" components, copy-in component upgrades, or "optimize my shadcn app" -- even if they never say "audit" or "optimize".
---

# shadcn/ui Optimizer

Audit a shadcn/ui project, report what is fragile, inconsistent or slow and why, agree a plan, then fix it. Order: evidence, approval, edits. shadcn components are **your source code**, so there is no package bump: upgrades are diffs, and changing primitives/tokens/APIs can alter behavior and appearance. Nothing is edited before approval.

## Workflow

### 1. Scope (quick)

- Detect the project: `components.json`, `components/ui`, `lib/utils` (`cn`), Tailwind version, framework (Next/RSC, Vite/React Router, Astro, Laravel), and primitive base (Radix, Base UI, React Aria). Note the CLI version (`shadcn` devDependency) and whether this is a monorepo/shared UI package.
- Run `python <skill-dir>/scripts/audit.py <project-root>` -- static scan of `package.json`, `components.json`, Tailwind CSS, `components/ui`, hooks and app files for registry/config drift, legacy `forwardRef`/toast, primitive mixing, missing `use client`, missing `cn`/aliases, Tailwind 4 config leftovers, dialog/a11y gaps and bundle risks, with file:line evidence. Use `--json` to post-process.
- Classify the pain: upgrade/registry drift, styling/theme inconsistency, RSC/bundle cost, accessibility/forms, or app performance. Ask which hurts if unclear.
- Read `references/tooling.md` once: what can be measured here (`shadcn info`, bundle analyzer, axe, Storybook).

### 2. Audit

The script finds cheap leads; you find the rest by reading. Read `components.json`, the global CSS file, `lib/utils`, the 3-5 most-used `components/ui` files and their call sites. Load only what applies:

| Area                                                          | Reference                           |
| ------------------------------------------------------------- | ----------------------------------- |
| components.json, CLI, aliases, registries, RSC/tsx, monorepo   | `references/setup-config.md`        |
| cn/CVA, asChild/Slot, data-slot, forwardRef, composition       | `references/components-composition.md` |
| Tailwind 4 tokens, OKLCH, dark mode, shadcn/tailwind.css       | `references/theming-tailwind.md`    |
| Copy-in upgrades, diff, custom registries, CLI migrations      | `references/registry-updates.md`    |
| RSC/client boundaries, bundle, tables/forms, a11y              | `references/performance-a11y.md`    |
| Measurement and honest reporting                              | `references/tooling.md`             |

**Measure, never guess.** Build for production, inspect route JS/CSS and SSR HTML, and run axe/Playwright on dialogs, menus and forms. Registry drift is code evidence; "looks inconsistent" is not.

Mark each finding **Confirmed** (code/config/build evidence) or **Suspected** (needs measuring).

### 3. Report

Fill `assets/report-template.md`, save it as `SHADCN_OPTIMIZATION_REPORT.md` in the project root, and show the user. Five-line summary, findings table by impact/effort, then per-finding detail (evidence, why it hurts, fix, risk, visual/behavior impact). Group related findings.

### 4. Plan -- then stop for approval

Use plan mode: `EnterPlanMode` (load with ToolSearch if deferred), write the plan, present with `ExitPlanMode`; if unavailable show it in chat and wait for an explicit "go". Structure:

1. **Quick wins** -- fix `use client` boundaries, add missing `DialogTitle`/labels, replace index keys, remove `forwardRef`, align `cn` usage, fix aliases/theme CSS import, trim per-row overlays. Low risk.
2. **Structural** -- migrate `cn`/icons/base color/Radix unified/rtl, consolidate variants/tokens, split heavy dialogs/charts, virtualize tables, adopt `data-slot`/consistent composition, reconcile registry drift. Name each visual/behavior change.
3. **Heavy** -- primitive base change (Radix ↔ Base UI ↔ React Aria), Tailwind 3 → 4, RSC migration, design-system extraction to a shared package/registry. Separately approved.
   Each step: files touched, expected effect, how to verify, how to roll back.

### 5. Fix

Only approved items, in small groups. After each: typecheck, lint, tests, production build, and a visual/axe check on affected components. A break must trace to one change. Do not mix a primitive-base migration with optimization edits. If a change alters a public component API, tokens or RSC boundaries, stop and ask.

### 6. Verify and wrap up

Re-measure the same components/routes: route JS/CSS, SSR HTML/theme, axe violations, dialog/form keyboard flow, table interaction. State plainly what could not be measured. End with deferred items and one suggested next step.

## Principles

- **You own the components.** There is no shadcn version bump; treat upgrades as reviewed diffs and keep local changes intentional.
- **One primitive base.** Radix, Base UI and React Aria have different composition/ARIA models; mixing them in one component invites bugs.
- **`cn` + CVA is the styling contract.** Use `cn` for class merging and CVA for variants; don't hand-concatenate conflicting classes.
- **Tailwind 4 uses CSS tokens.** No `tailwind.config` for v4; `@theme inline`, `:root`/`.dark` variables, OKLCH, `tw-animate-css`/`shadcn/tailwind.css`.
- **`use client` at the leaves.** Only interactive components need it; a client wrapper at the root pulls the kit into the client bundle.
- **Accessibility comes from the primitives.** Render `DialogTitle`, labels, descriptions and all menu/select parts; don't rebuild behavior with divs.
- **Registries are code supply chains.** Treat registry URLs/auth tokens as trusted infrastructure; review diffs before applying.
- **Migrations are their own plan item.** `migrate cn/icons/base-color/radix/rtl` and Tailwind 4 upgrades deserve separate verification.
- **Docs move.** The CLI (4.x) and components change; run `shadcn info`/`docs` and read the installed code, not memory.
Files in this package (11)
  • LICENSE 1 KB
  • README.md 1 KB
  • SKILL.md 6 KB
  • assets/report-template.md 1 KB
  • references/components-composition.md 3 KB
  • references/performance-a11y.md 3 KB
  • references/registry-updates.md 3 KB
  • references/setup-config.md 3 KB
  • references/theming-tailwind.md 3 KB
  • references/tooling.md 2 KB
  • scripts/audit.py 14 KB

Versions

The database has no other skills named shadcn-optimizer.

Database snapshot: 13.11.2026 · package version 9b31876b70fb (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 85radix-ui-optimizer
    Audit and optimize Radix UI (headless React primitives, radix-ui 1.x / @radix-ui/react-*) usage in a codebase for Radix UI, radix-ui, @radix-ui/react-dialog, asChild, data-state primitives, shadcn base, bundle/import cost, runtime and re-render cost, theming/SSR,…
  • 90shadcn-code-review
    Reviews shadcn/ui components for CVA patterns, composition with asChild, accessibility states, and data-slot usage. Use when reviewing React components using shadcn/ui, Radix primitives, or Tailwind styling.
  • 85tailgrids-optimizer
    Audit and optimize TailGrids (copy-in Tailwind components/templates, copied Tailwind components) usage in a codebase for TailGrids, TailGrids components/templates, copied Tailwind landing pages, TailGrids React/Vue/HTML, bundle/import cost, runtime and re-render cost,…
  • 100shadcn-ui
    shadcn/ui component patterns with Radix primitives and Tailwind styling. Use when building UI components, using CVA variants, implementing compound components, or styling with data-slot attributes. Triggers on shadcn, cva, cn(), data-slot, Radix, Button, Card, Dialog, VariantProps.
  • 100shadcn-ui
    shadcn/ui is a collection of accessible React components (built on Radix UI or Base UI and Tailwind CSS) that you add to your project as source code with a CLI instead of installing as a dependency. Use when the user asks to "add shadcn", "set up shadcn/ui", "add a shadcn…
  • 100shadcn
    shadcn/ui component library best practices and patterns (formerly shadcn-ui). This skill should be used when writing, reviewing, or refactoring shadcn/ui components to ensure proper architecture, accessibility, and performance. Triggers on tasks involving Radix primitives,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.