extract

A refactoring command that finds repeated interface code and hardcoded styling values, then prepares them for reuse as components or design tokens.

In plain words
What is it for?
Use it to clean up Tailwind-based interfaces, extract repeated markup, and centralize colors, sizes, shadows, fonts, and other style values.
Why use it?
It reduces duplication and makes shared styles and markup easier to change consistently.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/educlopez/ui-craft/extract
Clone the repo
git clone --depth 1 https://github.com/educlopez/ui-craft
Per session 61 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 569 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00061 $0.00569
Opus 5 $0.00030 $0.00284
Sonnet 5 $0.00012 $0.00114
Haiku 4.5 $0.00006 $0.00057

Measured 2d ago against content hash 4de4cc8acc96, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

extract scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cli/assets/claude/commands/extract.md · 41 lines

What it actually says

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.
  • If the component is generic ("a card with a title and description"), ask yourself whether it should instead be an inline composition — premature abstraction is worse than repetition.

Step 4 — Update every call-site. No half-migrations.

Knob-agnostic — DRY is not tunable.

References to read: references/layout.md (composition patterns), references/typography.md and references/color.md (token naming), plus the project's existing component library (scan before writing).

Output:

  1. The new component file(s) + any token additions.
  2. A table showing every call-site update:
File Before After
  1. A one-line delta: "Extracted N components, M tokens. Call-sites updated: X."

Next step: /tokens — lift the values you just centralized into the token spine (rung 2).

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 41 lines · 61 tokens per session scan A 4de4cc8acc96

Subscribe to this mod's changes

extract is a command published in the GitHub repository educlopez/ui-craft (298 stars, last pushed 13d ago), licensed MIT. It adds 61 tokens to every session and 569 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.