Command
/extract
Refactoring pass — extracts repeated Tailwind class combos and markup into components, and lifts magic values into design tokens. Use when the codebase has obvious duplication, hardcoded hex values or pixel sizes, or when the user says "clean this up" / "extract components" /
One command from ui-craft.
shell
$ npx -y skills add educlopez/ui-craft --agent claude-codeShips with ui-craft. Installing the plugin gets this command.
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/extract
Context preview
What this command does when you run it.
Refactoring pass — extracts repeated Tailwind class combos and markup into components, and lifts magic values into design tokens. Use when the codebase has obvious duplication, hardcoded hex values or pixel sizes, or when the user says "clean this up" / "extract components" /
Stats
Stars209
Forks9
LanguageGo
LicenseMIT
Ships with ui-craft
Command definition
extract.md
--- description: Refactoring pass — extracts repeated Tailwind class combos and markup into components, and lifts magic values into design tokens. Use when the codebase has obvious duplication, hardcoded hex values or pixel sizes, or when the user says "clean this up" / "extract components" / "tokenize styles". argument-hint: "[file or component path]" --- Extract reusable pieces from `$ARGUMENTS`. Load the `ui-craft` skill. **Step 1 — Scan the target for extraction candidates:** - **Repeated Tailwind class combos** — any class string that appears ≥3 times becomes a component (or a `cva`/`tv` variant if the project uses one — check first). - **Magic values** — hex colors, pixel sizes, shadow definitions, font sizes, z-index values appearing in literal form. Lift into CSS variables or `theme.extend`. - **Repeated markup** — blocks that differ only by text/props collapse into a single component with props. **Step 2 — Match the project's conventions, don't impose new ones:** - **Naming** — look at neighboring components. PascalCase file? kebab-case file? Named export vs default export? Match exactly. - **Location** — check `components/ui/`, `ui/`, `primitives/`, `src/components/` before creating a new directory. Reuse. - **Tokens** — respect existing CSS variable naming (`--color-*`, `--space-*`, `--font-*`, `--radius-*`). Don't introduce a parallel system. **Step 3 — Anti-Slop Test on every new component** (from SKILL.md): - Component name must be domain-specific, not generic. `MetricCard` / `PricingTier` / `InviteRow` beats `Card` / `Box` / `Item`.
