This skill should be used when the user mentions uneven spacing, alignment issues, inconsistent gaps between elements, mixed margin/gap strategies, navbar or toolbar spacing problems, or asks to "clean up", "normalize", or "audit" spacing in a Tailwind component. This skill also applies when reviewing UI code where flex/grid containers use a mix of gap-*, margin (m*, me-*, ms-*), padding, and fixed widths to space sibling elements — even if the user doesn't explicitly say "spacing." If someone pastes a nav bar, toolbar, header, or action bar and says "something looks off," this skill is almost certainly what they need.
From tailwindnpx claudepluginhub tony/ai-workflow-plugins --plugin tailwindThis skill uses the workspace's default tool permissions.
references/heuristics.mdreferences/patterns.mdProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Integrates PayPal payments with express checkout, subscriptions, refunds, and IPN. Includes JS SDK for frontend buttons and Python REST API for backend capture.
Systematically detect and fix inconsistent spacing in Tailwind CSS v4+ layouts. The root cause of most spacing bugs is fragmented spacing authority — multiple competing mechanisms (gap, margin, padding, fixed widths) controlling the space between the same set of visual peers.
Use $ARGUMENTS as the target scope. If $ARGUMENTS is empty, ask the user which
component or file to audit.
Good spacing has one property: a single source of truth per spacing relationship. Every
pair of adjacent items should have exactly one class/mechanism determining the space between
them. When gap-2 appears on a parent AND me-1 on a child AND ms-2 on a sibling, three
competing authorities produce visual noise.
The goal is never "make all numbers the same" — it's to ensure each spacing decision is intentional, non-redundant, and traceable to one mechanism.
Before auditing, detect the project's templating framework to determine which attribute name and file globs to use throughout the audit.
Scan the project for template files:
*.tsx / *.jsx — React (className=)*.vue — Vue (class=, :class=)*.svelte — Svelte (class=)*.astro — Astro (class=)*.html — plain HTML (class=)*.erb — Rails ERB (class=)*.blade.php — Laravel Blade (class=)Use the detected attribute name(s) and file globs for all subsequent search commands. If multiple frameworks are present, search across all of them.
For React projects, use className= in search patterns. For all other frameworks, use
class=. When both React and non-React templates exist, use (class|className)= to
match both.
Before touching any code, read references/heuristics.md for the full detection checklist.
Scan the component and produce a spacing map — a brief annotation of every spacing
mechanism acting on the group of elements the user is concerned about:
[LinkedIn] --gap-1--> [Wrench] --gap-1--> [Babylon.js] --me-1+flex--> [Theme(me-2)]
^ parent gap ^ margin leak ^ separate container
This makes fragmentation visible. Call out:
w-*) on items whose siblings are content-sizedRead references/patterns.md for the full catalog with before/after examples. The most
common patterns, in order of frequency:
gap-* but children also carry m*-*.px-* values.w-24 while siblings size
to content, creating uneven internal whitespace.<div> with flex alignment classes wrapping a single
child, adding an extra layout level that obscures the true spacing. Uses className
in React (<div className="flex items-center">) or class in other frameworks
(<div class="flex items-center">).Apply these principles in order of priority:
3a. Merge fragmented containers. If items belong to the same visual group, place them
in the same flex container. One parent, one gap-* value. Remove outer margin classes
(me-*, ms-*) that were compensating for the split.
3b. Choose one spacing authority per relationship. Between any two adjacent items, exactly one of these should be active — never more:
gap-* on the parent (preferred for uniform spacing)3c. Standardize interactive element envelopes. Buttons, links, and toggles that are visual peers should share:
h-8 or all h-12)px-2)w-* unless every peer also has the same fixed width)3d. Flatten unnecessary wrappers. If a <div> wraps a single interactive child purely
for alignment, check whether the child can receive the alignment classes directly. Common
in navbars where each button got wrapped in a single-child alignment div during incremental
development.
3e. Preserve intentional spacing breaks. Not every spacing difference is a bug. A visual separator (like a divider between nav groups) is intentional asymmetry. Ask before normalizing something that might be a deliberate design choice.
After refactoring, re-draw the spacing map and confirm:
w-* on items that should be content-sized (unless all peers match)Tailwind v4 changed how spacing works in important ways:
gap-* is the canonical way to space flex/grid children. Prefer it over margins.gap-[12px] syntax if the scale doesn't have what's needed, but
prefer scale values (gap-1 = 4px, gap-2 = 8px, gap-3 = 12px, gap-4 = 16px).space-x-* and space-y-* still exist but are margin-based under the hood. Prefer
gap-* for new code; flag space-* as a migration opportunity when found alongside
gap-*.me-* (margin-inline-end) and ms-* (margin-inline-start)
replace mr-*/ml-* in LTR/RTL-aware code. The anti-pattern is the same regardless
of physical vs logical naming.When presenting findings:
When the fix is straightforward, collapse steps 1-4 into a concise explanation + code. Don't over-formalize simple cases.
For detailed detection logic and worked examples, consult:
references/heuristics.md — Seven detection heuristics (H1-H7) with Tailwind class
patterns and search commands for codebase-wide scanningreferences/patterns.md — Anti-pattern catalog with before/after examples for each
pattern, plus a quick decision tree for diagnosing spacing issues