Skip to content
Back to skills

Tailwind Cleanup

ASecurity

Removes unused Tailwind classes, extracts repeated class patterns into components

  • 10 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added May 27, 2026
data-aibash

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill tailwind-cleanup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tailwind Cleanup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tailwind Cleanup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-tailwind-cleanup/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-tailwind-cleanup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tailwind-cleanup
description: Removes unused Tailwind classes, extracts repeated class patterns into components
argument-hint: [directory]
user-invocable: true
allowed-tools: Bash Read Grep Glob Edit
effort: medium
---

## Tailwind CSS Cleanup

Target: **$1** (or `src/` if not specified)

### 1. Find Unused Classes
```bash
npx tailwindcss --content "./src/**/*.{ts,tsx}" --input ./src/styles/globals.css --dry-run 2>/dev/null | grep "Removing"
```

### 2. Find Repeated Class Combinations
```bash
grep -rn 'className="' ${1:-src/} --include="*.tsx" | grep -oP 'className="[^"]+"' | sort | uniq -c | sort -rn | head -20
```

### 3. Extract Repeated Patterns
When the same 5+ class combination appears 3+ times, it should become:
- A component (if it's a complete UI element)
- A `cn()` variant (if it's a style pattern)
- A `@apply` in CSS (sparingly)

### 4. Check for Anti-Patterns
- `!important` overrides (`!text-red-500`)
- Arbitrary values where a design token exists (`text-[#FF0000]` → use color from theme)
- Mixing Tailwind with raw CSS in the same element

### 5. Verify PurgeCSS config covers all dynamic class patterns:
```ts
// ❌ Dynamic classes get purged
const color = isError ? 'red' : 'green'
<div className={`text-${color}-500`} />

// ✅ Full class names are safe
const className = isError ? 'text-red-500' : 'text-green-500'
```

Report: N unused classes removed, N patterns extracted.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.