refactor-ui

A command for reviewing and improving the layout and visual styling of a specified user-interface component. It examines spacing, typography, colours, borders, shadows, and visual hierarchy.

In plain words
What is it for?
Use it on a component file when adjusting spacing, text sizes, colour use, grouping, or the prominence of primary and secondary elements.
Why use it?
It helps find inconsistent spacing or unclear emphasis that can make an interface harder to understand or use.

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/nyldn/claude-dolphin/refactor-ui
Clone the repo
git clone --depth 1 https://github.com/nyldn/claude-dolphin
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,801 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.00009 $0.01801
Opus 5 $0.00005 $0.00901
Sonnet 5 $0.00002 $0.00360
Haiku 4.5 $0.00001 $0.00180

Measured yesterday against content hash c773b0b29441, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor-ui 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 yesterday.

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.

commands/refactor-ui.md · 275 lines

How it starts

The opening of the file, as written. The whole thing — 275 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Refactor UI Command

Apply tactical UI improvements to the specified component using Refactoring UI principles.

Required: Specify a component file path.

Refactoring Process

Step 1: Current State Analysis

Read the target component and document:

Visual Structure:

  • Current spacing values
  • Typography (sizes, weights, colors)
  • Color usage
  • Border and shadow usage
  • Layout approach

Hierarchy:

  • What's the primary element?
  • What's secondary?
  • What's tertiary?
  • Is hierarchy clear?

Step 2: Apply Tactical Improvements

Spacing Improvements

Before checking: What spacing values are currently used?

Principles:

  • Use consistent scale: 4, 8, 12, 16, 24, 32, 48, 64px
  • Start with MORE whitespace than feels necessary
  • Group related items closer together
  • Separate unrelated items further apart

Common fixes:

// Before: Random spacing
<div className="p-5 mb-3 gap-7">

// After: Scale-based spacing
<div className="p-6 mb-4 gap-8">

Padding guidance:

  • Tight (dense UI): 8-12px
  • Standard: 16-24px
  • Spacious: 24-32px
  • Hero/cards: 32-48px
Typography Improvements

Principles:

  • Maximum 2-3 font sizes per component
  • Create hierarchy through WEIGHT first, then size
  • Don't use pure black for text (use #111 or similar)
  • Body text minimum 16px for readability

Font size scale:

text-xs:   12px - Labels, captions
text-sm:   14px - Secondary text
text-base: 16px - Body text
text-lg:   18px - Large body
text-xl:   20px - Subheadings
text-2xl:  24px - Section headings
text-3xl:  30px - Page headings

Weight hierarchy:

// Before: Size-only hierarchy
<h2 className="text-2xl">Title</h2>
<p className="text-base">Body</p>
<span className="text-sm">Meta</span>

// After: Weight + size hierarchy
<h2 className="text-xl font-semibold text-gray-900">Title</h2>
<p className="text-base font-normal text-gray-600">Body</p>
<span className="text-sm font-normal text-gray-500">Meta</span>
Color Improvements

Read the full file on GitHub · 275 lines

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. yesterday First seen · 275 lines · 9 tokens per session scan A c773b0b29441

Subscribe to this mod's changes

refactor-ui is a command published in the GitHub repository nyldn/claude-dolphin (9 stars, last pushed 8d ago), licensed MIT. It adds 9 tokens to every session and 1,801 once invoked, about $0.0000 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-31.