tailwind-spacing-audit
/tailwind-spacing-audit
Use when Tailwind spacing looks uneven or too wide: gap, space-x, margin, or padding mixed on navbars, toolbars, and flex rows.
Assessment and security
- Files in this package
- 5
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 2
No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: references/detect.py
What it does and when to use it
Use when Tailwind spacing looks uneven or too wide: gap, space-x, margin, or padding mixed on navbars, toolbars, and flex rows.
Original author description
Use when Tailwind spacing looks uneven or too wide: gap, space-x, margin, or padding mixed on navbars, toolbars, and flex rows.
How it works
- Workflow
- Output
- Portability notes
SKILL.md preview
---
name: tailwind-spacing-audit
description: >-
Use when Tailwind spacing looks uneven or too wide: gap, space-x, margin,
or padding mixed on navbars, toolbars, and flex rows.
metadata:
argument-hint: "<file-or-directory-to-audit>"
source: "plugins/tailwind/skills/spacing-audit/SKILL.md"
---
# Tailwind spacing audit
Detect and fix inconsistent spacing in Tailwind CSS layouts. Most spacing
bugs come from fragmented spacing authority: gap, margin, padding, and
fixed widths all control the space between the same visual peers. Each
pair of adjacent items gets exactly one mechanism.
Use `$ARGUMENTS` as the target scope. If it is empty and the user pasted
markup, audit the paste. Otherwise ask which component or file to audit;
when asking is not allowed, stop with the halted result below.
Ask only through a question tool, and never when the user said not to
ask. Without a question tool, or after that instruction, asking is not
allowed: decide per the steps below and end with no question.
Run scripts from the project root so targets stay relative to the
project. Resolve `references/detect.py` against this skill's directory,
print the absolute path once, and write it literally in each command,
since shell variables do not persist between Bash calls.
## Workflow
### Step 0: Detect framework and Tailwind version
Find the template files in scope and the class attribute each uses:
- `*.tsx`, `*.jsx`: `className=`
- `*.vue`: `class=`, `:class=`
- `*.svelte`, `*.astro`, `*.html`, `*.erb`, `*.php`, `*.twig`, `*.njk`,
`*.hbs`, `*.heex`, `*.mdx`, `*.liquid`: `class=`
The detect commands in `references/patterns.md` run
`references/detect.py` and name an `rg` fallback. If neither runs,
read the files in scope.
Read the installed Tailwind version with the `version` command described
in `references/patterns.md`, run on the project root. If it prints
`version: unknown`, say so in the result and keep `space-x` and
`space-y` advice version-neutral.
### Step 1: Structural audit
Scan the component and draw a spacing map in the list form shown under
Output: every spacing mechanism acting on the group the user cares
about. Then read the Detect command limits and Decision tree sections
of `references/patterns.md`, and only the pattern sections the findings
match.
Call out how many mechanisms act between visual peers, which items sit
in different containers yet read as one group, and any fixed `w-*` on
an item whose siblings size to content.
### Step 2: Classify
Match each finding to a pattern in `references/patterns.md`. Run that
pattern's detect command for codebase-wide scope. Each match needs a
read in context before it counts. A command that returns nothing for a
file the user named is not a clean bill: read the file.
### Step 3: Refactor
Propose the changes as a diff or before/after; edit files only when the
user asked to fix or apply them. For a pasted snippet, reply with the
code. Preserve existing breakpoints, and change only spacing and sizing
classes. Work in this order:
1. Merge fragmented containers. Put one visual group in one flex
container with one `gap-*`. Remove the outer `me-*` and `ms-*` that
compensated for the split.
2. Pick one authority per relationship. `gap-*` on the parent for
uniform spacing; margin on a child only for a deliberate exception;
padding only for space inside an item.
3. Standardize peer envelopes. Peer buttons, links, and toggles
share one height class and one horizontal padding, and no `w-*`
unless every peer has the same one.
4. Flatten single-child wrappers. Move the alignment classes onto
the child.
5. Keep intentional breaks. A divider between nav groups is
deliberate, and so is the margin around it (`mx-*` on a `w-px` or
`<hr>` element): keep both, never remove or shrink it, and list it as
a kept difference with the distance it produces. Ask before
normalizing a difference that may be design; when asking is not
allowed, keep the break and report it as a kept difference after the
findings, never as a finding, with no guessed rationale. Offer a
divider, a separate group, or any way to keep a wide gap only when
the user said the wide gap is meant to stay. When you keep separate
containers, name the evidence that they are separate groups (a
divider, different roles, a `justify-between`), or merge them.
6. Report every difference you leave unchanged, such as a peer with
different padding: list it as a kept difference or fix it as a
finding; never mention it only to guess why it is fine.
### Step 4: Validate
After editing files, re-run the detect command for each pattern fixed
on the edited files and read the changed lines back; report any hit that
remains. Then redraw the spacing map and confirm:
- [ ] Every adjacent pair has exactly one spacing authority
- [ ] Each visual group shares one parent container
- [ ] Peer interactive elements share envelope classes
- [ ] No `w-*` on content-sized items, unless all peers match
- [ ] Hit targets are consistent across peers
Leave a box `[ ]` and give the reason for any unmet item; never tick a
box and then argue against it.
## Output
Write it per `references/prose-rules.md`. Present these sections
in order, with these headings:
1. Spacing map
2. Anti-patterns found: one plain sentence per finding, naming the
mechanism ("margin stacked on gap") and the elements involved, never
a pattern number, with no bold lead-ins. For a file or directory
audit, name each finding's `path:line`. Put each kept difference in
one plain sentence after the last finding, not among them
3. Proposed refactor: a focused diff or before/after, with every
distance the refactor changes given as old to new ("12px to 8px")
4. Validation checklist: Step 4 filled in
Reply in this shape, as plain text outside any code fence, with plain
bullets, no bold (never `- **Label:** ...`), and no local paths:
````text
## Spacing map
nav (p-4, no gap)
- Docs, gap-2, Pricing
- ms-3 on the second group
- Sign in (px-2 h-8), nothing, Sign up (h-8)
## Anti-patterns found
- The `ms-3` on the second group (`src/Nav.tsx:11`) sets the space between groups, a margin stacked on the parent's gap.
- "Sign in" has `px-2` and "Sign up" has none, so the buttons differ in width.
## Proposed refactor
```tsx
<nav className="flex items-center gap-3 p-4">
...
</nav>
```
## Validation checklist
- [x] Every adjacent pair has one spacing authority.
- [x] Peer buttons share `h-8 px-2`.
````
Use the full shape when auditing a file or directory. For a pasted
snippet with one finding, collapse it to a short explanation and the
code, with no bold anywhere and no counted lead-in ("for three
reasons:"). State each visible change once. Do not restate that distances stay
the same.
State the Tailwind version only when it changes the advice. Distances
assume the default spacing scale (`gap-3` is 12px in v3 and in v4, where
`--spacing` is `0.25rem`: [v3.4.0 `stubs/config.full.js`](https://github.com/tailwindlabs/tailwindcss/blob/v3.4.0/stubs/config.full.js),
[v4.0.0 `theme.css`](https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/theme.css));
say so once if the project sets a custom `theme.spacing` or `--spacing`.
When `detect.py` reports that it stopped at its hit cap, say which files
it counted and that later files were not scanned.
End a full audit with a next-step panel through the question tool, one
option per fix found plus one to extend the audit to another path. Where
asking is not allowed, print the options as a plain list, one per line,
and stop.
Halted or empty runs give one result sentence, then what the user does:
- No target given: "Nothing audited: no file or directory was given."
Pass a file or directory.
- No Tailwind class attributes in scope: "No Tailwind classes found in
`<scope>`." Check the path, or point at the template files.
- Issues found but all kept as deliberate: "No spacing changes made in
`<scope>`." Stop after one sentence naming the kept break and the one change
that would alter it. Do not reprint unchanged code or recap.
- No issues found: "No spacing issues found in `<scope>`." Name the files
you read, since the detect commands can miss dynamic classes.
## Portability notes
- `$ARGUMENTS` — the text the user passed when invoking this skill. If your host does not substitute it, read it as the user's request in the current turn, and ask when there is none.
- Bundled files — every relative path in this skill points at a file shipped inside this skill directory. Read them from here, not from the host's plugin tree.
Files in this package (5)
- SKILL.md 8 KB
- agents/openai.yaml 1 KB
- references/detect.py 10 KB
- references/patterns.md 15 KB
- references/prose-rules.md 5 KB
Versions
The database has no other skills named tailwind-spacing-audit.
Database snapshot: 13.11.2026 · package version d5222d256454 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 100spacing-audit
Use when Tailwind spacing looks uneven or too wide: gap, space-x, margin, or padding mixed on navbars, toolbars, and flex rows. - 100tailwindcss-spacing
Use when setting margin or padding on any side, centering with m-auto, applying negative margins, or spacing children with space-x-*/space-y-*. - 1008pt-grid
8-point grid system for UI. Use when creating, adjusting or reviewing layout, spacing, padding, margin, gap, component or icon size, or line-height in any interface (web, app, dashboard), or when the user mentions 8pt grid, 8 point grid, consistent spacing, vertical rhythm,… - 90tailwindcss-development
Styles applications using Tailwind CSS v4 utilities. Activates when adding styles, restyling components, working with gradients, spacing, layout, flex, grid, responsive design, dark mode, colors, typography, or borders; or when the user mentions CSS, styling, classes, Tailwind,… - 100tailwind-audit
Regency tailwind-audit. Audit, clean up and build the frontend of a project that uses Tailwind CSS against a written design-system norm. Runs a deterministic scan for token, spacing, accessibility and setup violations, works through the manual rules in separate passes, renders… - 90ui-layout-spacing
Fixes layout, spacing and visual rhythm in an existing UI: a spacing scale, varied section padding, grid monotony, crowded sidebars, alignment, depth and heading hierarchy. Use when spacing feels off, everything has the same padding, cards look identical, a column feels crowded,…