Tailwind CSS Audit
Scans the codebase for Tailwind class anti-patterns and produces a findings report.
Detection Patterns
Launch 3 parallel Explore agents to scan ALL .tsx/.ts files in src/:
Agent 1: Size & Shrink Patterns
h-N w-Norw-N h-Nshould besize-N(square dimensions)- Grep:
h-(\d+) w-(\d+)then verify both numbers match - Grep:
w-(\d+) h-(\d+)then verify both numbers match - Also check fractional:
h-3.5 w-3.5,h-0.5 w-0.5
- Grep:
flex-shrink-0should beshrink-0(modern canonical form)- Grep:
flex-shrink-0
- Grep:
absolute inset-0with redundantw-full h-full- Grep:
inset-0.*w-fullorinset-0.*h-full
- Grep:
Wrong class ordering:
size-N mr-X(margin should come before size)- Grep:
size-\d+ mr-
- Grep:
Agent 2: Duplicate & Redundant Classes
Duplicate classes in same className string
- Grep for common duplicates:
pointer-events-none.*pointer-events-none - Grep:
overflow-y-auto.*overflow-y-auto - General approach: read className strings and check for word-level duplicates
- Grep for common duplicates:
Redundant responsive overrides that match base value
- Grep:
text-xs.*md:text-xsortext-sm.*md:text-sm - Look for
group-data-[...]:{value}where base already sets same value
- Grep:
No-op flex defaults
sm:flex-rowwithout precedingflex-col(row is default)items-stretchon flex containers (stretch is default)
Consolidatable margin shorthand
- Grep:
-mx-(\d+) -my-then verify both numbers match (should be-m-N)
- Grep:
Agent 3: Transition & Legacy Patterns
transition-alloveruse (flag for review)- Grep:
transition-all - Check what properties actually transition — suggest specific alternatives
- Grep:
flex-growshould begrow(modern Tailwind)- Grep:
flex-grow
- Grep:
flex-grow-0should begrow-0- Grep:
flex-grow-0
- Grep:
Duplicate text-size tokens in same className
- Look for
text-sm.*text-smpatterns within single className strings
- Look for
Output Format
For each finding, report:
- File path and line number
- Category (from list above)
- Current class string
- Suggested fix
- Severity:
fix(clearly wrong) orreview(judgment call)
Group findings by category and sort by file path within each category.