consistent-border-radius
Consistent Border Radius
This skill audits a frontend file (CSS, HTML, JSX, TSX, Vue, Svelte, or plain JS) and rewrites all border-radius values so every UI element — buttons, inputs, cards, modals, badges, tooltips, dropdowns — uses the same curvature token.
When to Use
Trigger on any of these signals:
- User mentions mismatched, inconsistent, or ugly rounded corners
- User wants a "design consistency pass" or "visual polish"
- User says elements "don't match", "look off", or "feel inconsistent"
- File has scattered
border-radiusvalues (4pxhere,8pxthere,0.5remsomewhere else) - User is cleaning up a design system or component library
Step 1 — Audit the File
Read through the entire file and collect every border-radius value. Build a mental inventory:
| Selector / Element | Current Value |
|---|---|
.btn |
4px |
.card |
12px |
input |
6px |
.badge |
9999px |
.modal |
8px |
Note which values are:
- Structural radii — small/medium values for rectangles (buttons, inputs, cards, modals)
- Pill/full-round radii — large values like
9999px,50%,100pxused on tags, avatars, toggles
Do not flatten pill radii into the structural radius — they serve a different semantic purpose.
Step 2 — Choose the Canonical Radius
Pick one canonical value for structural elements. Use this priority order:
- User-specified — if they said "use 8px" or "I want
0.5rem", use that. - Design system token — if the file already has a
--border-radiusor--radiusCSS variable, adopt it. - Most common value — pick the value that already appears the most.
- Sensible default — if values are all over the place, default to
8px(or0.5rem) for a modern, balanced look.
Always confirm the chosen value with a brief inline comment in your output, e.g.:
/* Canonical border-radius: 8px — applied consistently across all UI elements */
Step 3 — Normalize
Apply the canonical radius to all structural elements. Rules:
CSS / SCSS / Less
Replace scattered values with the canonical one. If there's already a variable, redirect everything to it. If there isn't one, create one at the :root level:
:root {
--radius: 8px;
}
.btn { border-radius: var(--radius); }
.card { border-radius: var(--radius); }
input { border-radius: var(--radius); }
.modal { border-radius: var(--radius); }
Tailwind CSS (HTML / JSX / TSX)
Replace mixed utility classes (rounded, rounded-md, rounded-xl, rounded-lg) with a single consistent class. Map to the closest Tailwind token:
| Canonical px | Tailwind class |
|---|---|
| 2px | rounded-sm |
| 4px | rounded |
| 6px | rounded-md |
| 8px | rounded-lg |
| 12px | rounded-xl |
| 16px | rounded-2xl |
| 9999px | rounded-full ← keep this for pills/avatars |
Leave rounded-full alone — it's intentional.
Inline styles (JSX / TSX)
Replace style={{ borderRadius: '...' }} values with the canonical one.
CSS-in-JS (styled-components, emotion, etc.)
Replace string/template literal values:
// Before
border-radius: 12px;
border-radius: ${theme.radii.sm};
// After
border-radius: ${theme.radii.base}; /* or var(--radius) */
Step 4 — Preserve Intentional Exceptions
Never change these — they're semantically distinct:
border-radius: 50%→ circles (avatars, icons)border-radius: 9999px/rounded-full→ pill shapes (tags, toggles, chips)border-radius: 0→ deliberately sharp corners (e.g., full-bleed banners, dividers)- Per-corner overrides like
border-top-left-radiusused for design effects (e.g., chat bubbles, tabs)
If you're unsure whether a value is intentional, leave it and add a comment:
/* NOTE: kept at 50% — appears intentional (circle avatar) */
Step 5 — Output
Return the full modified file with:
- A CSS variable or token introduced at the top (if CSS-based)
- All structural radii normalized
- A brief summary comment near the top explaining the canonical value chosen
- Inline
/* unchanged — intentional */comments on any preserved exceptions
Also provide a short change summary in your response (outside the code block):
Applied canonical border-radius of 8px (var(--radius)) to 14 elements.
Preserved: 2× rounded-full (pill badges), 1× 50% (avatar circle).
Edge Cases & Notes
- Mixed units (px vs rem): Normalize to whichever unit dominates. If the project uses
rem, convert8px → 0.5rem. Use1rem = 16pxas the conversion rate. - Shorthand vs longhand:
border-radius: 8px 8px 8px 8px→ collapse toborder-radius: 8px. - Nested components: If a card has an inner image that needs
border-radius: 8px 8px 0 0to flush with the card top — keep that, it's structural. - Multiple files: If the user shares multiple files, apply the same canonical token across all of them and note any cross-file inconsistencies.
- No radii found: If the file has no border-radius values at all, say so clearly and ask if they'd like to add a consistent scheme from scratch.
Example Transformation
Before
.btn { border-radius: 4px; }
.card { border-radius: 12px; }
input { border-radius: 6px; }
.tag { border-radius: 9999px; }
.modal { border-radius: 10px; }
.avatar { border-radius: 50%; }
After
:root {
--radius: 8px; /* Canonical border-radius — applied consistently */
}
.btn { border-radius: var(--radius); }
.card { border-radius: var(--radius); }
input { border-radius: var(--radius); }
.tag { border-radius: 9999px; } /* unchanged — intentional pill */
.modal { border-radius: var(--radius); }
.avatar { border-radius: 50%; } /* unchanged — intentional circle */
Summary: Applied 8px (var(--radius)) to 4 elements. Preserved 2 intentional exceptions.
More from blunotech-dev/agents
anti-purple-ui
Enforce a strict monochrome UI with a single high-contrast accent color, removing generic tech gradients and “AI-style” palettes. Use when the user wants minimal, anti-AI, or non-generic aesthetics, or says the UI looks too techy or generic.
9harmonize-whitespace
Align all spacing (padding, margins, gaps) to a consistent 4pt/8pt grid. Use when spacing feels off, inconsistent, cramped, or unbalanced, or when the user asks for a spacing scale or alignment fix.
9typographic-hierarchy
Improve typography by adjusting font sizes, weights, spacing, and contrast to create clear visual hierarchy and readability. Use when text feels flat, unstructured, or when the user asks to refine headings, type scale, or overall readability.
6component-split
Analyze a component and determine when and how to split it based on size, responsibility, and reuse signals, producing a refactored structure with clear boundaries. Use when users share large, mixed-concern, or hard-to-test components, or ask about splitting, refactoring, or improving component architecture.
3tailwind-class-sorter
Sort Tailwind CSS utility classes into a clear, consistent order (layout, spacing, sizing, typography, visual). Use when classes are messy, hard to read, or when the user asks to clean up or organize Tailwind code.
3context-rerenders-fix
Identify and fix unnecessary React re-renders caused by Context by splitting providers or memoizing values. Use when users report slow React performance, excessive re-renders, or Context-related lag, or ask how to optimize useContext or large Context providers.
3