tailwind-conflict-auditor
npx skills add https://github.com/handxr/tailwind-conflict-auditor --skill tailwind-conflict-auditor
Agent 安装分布
Skill 文档
Tailwind Class Conflict & Redundancy Auditor
Scan project files for Tailwind CSS class issues. Conservative approach: report and suggest, never auto-apply changes.
Workflow
- Locate files using Glob (
**/*.{html,jsx,tsx,vue,svelte,astro,erb,php,hbs,ejs,njk,twig,js,ts}) - Run the auditor script from the skill directory:
python3 <skill-path>/scripts/tailwind_class_auditor.py <file_or_dir> --json - Parse the JSON output
- Present findings grouped by severity (errors first, then warnings, then info)
- For each issue, show the file, line, conflicting classes, and a concrete suggestion
- Wait for user approval before applying any changes
Running the Auditor
Single file:
python3 <skill-path>/scripts/tailwind_class_auditor.py src/components/Button.tsx --json
Entire directory:
python3 <skill-path>/scripts/tailwind_class_auditor.py src/ --json
Include ordering suggestions (default: only conflicts/duplicates/obsolete):
python3 <skill-path>/scripts/tailwind_class_auditor.py src/ --json --strict
Human-readable output (omit --json):
python3 <skill-path>/scripts/tailwind_class_auditor.py src/
What It Detects
Conflicts (severity: error)
Two classes setting the same CSS property in the same variant context:
p-4 p-6â both setpaddingtext-red-500 text-blue-500â both setcolorflex blockâ both setdisplaymd:hidden md:blockâ both setdisplayatmd:
Duplicates (severity: warning)
Same class appearing twice in the same attribute:
mt-4 ... mt-4
Obsolete v3 patterns (severity: warning)
Classes renamed or removed in Tailwind v3/v4:
transform,filter,backdrop-filterâ no longer neededflex-growâgrow,flex-shrinkâshrinkbg-opacity-50âbg-red-500/50(slash notation)
Ordering (severity: info, only with --strict)
Classes not following recommended order: layout > position > flex/grid > spacing > sizing > typography > backgrounds > borders > effects > transitions > transforms
Interpreting Results
The JSON report per file contains:
- summary: Counts for class_attributes, conflicts, duplicates, obsolete, ordering
- issues: Array of issue objects, each with:
type: “conflict” | “duplicate” | “obsolete” | “ordering”severity: “error” | “warning” | “info”line: Line number in the filemessage: Human-readable descriptionsuggestion: Concrete fix
Presenting Suggestions
When reporting to the user:
- Start with summary stats per file
- Group issues by severity (errors first)
- For conflicts: show both classes and the CSS property they fight over
- For obsolete: show the old class and its modern replacement
- For duplicates: show the duplicated class
- Propose specific fixes (e.g., “Remove
p-4, keepp-6“)
For detailed rules on conflict types and valid patterns, read references/tailwind-conflict-rules.md.
Known Limitations
cn()/clsx()/classnames()calls: the auditor extracts all string literals and merges them. Conditional classes likecn("p-4", condition && "p-6")may produce false-positive conflicts. Review these before suggesting fixes.
Applying Corrections
Only apply corrections after user approval. When the user approves:
- Apply one change at a time
- Re-run the auditor after each batch to verify improvement
- Never introduce new conflicts while fixing existing ones