css-specificity
SKILL.md
CSS Specificity Analyzer
Analyze CSS files for specificity issues, detect conflicts between rules, and suggest concrete improvements. Conservative approach: report and suggest, never auto-apply changes.
Workflow
- Locate
.cssfiles in the project using Glob (**/*.css) - Run the analyzer script on discovered files:
python3 <skill_dir>/scripts/css_specificity_analyzer.py <file_or_dir> --json - Parse the JSON output
- Present findings grouped by severity (errors first, then warnings)
- For each issue, show the selector, line number, current specificity, and a concrete suggestion
- Wait for user approval before applying any changes
Running the Analyzer
Single file:
python3 scripts/css_specificity_analyzer.py styles.css --json
Entire directory:
python3 scripts/css_specificity_analyzer.py src/ --json
Custom threshold (default 30, flag selectors scoring >= this):
python3 scripts/css_specificity_analyzer.py src/ --json --threshold 20
Human-readable output (omit --json):
python3 scripts/css_specificity_analyzer.py styles.css
Interpreting Results
The JSON report contains:
- summary: Total selectors, average/max specificity, !important count, conflict count
- selectors: Only selectors with issues (warning/error severity with suggestions)
- conflicts: Pairs of rules with large specificity gaps targeting the same property
- importants: Each
!importantusage with assessment of whether it's necessary
Severity levels:
- error: Score >= threshold * 2 (default 60+)
- warning: Score >= threshold (default 30+)
- ok: Below threshold (not included in output)
Presenting Suggestions
When reporting to the user:
- Start with summary stats
- Group issues by severity (errors first)
- Show before/after specificity for each suggestion
- For conflicts, show both competing rules side by side
- For
!important, explain whether it masks a real conflict or is unnecessary - Propose specific rewrites (e.g., "Replace
#header .nav awith.nav-link")
For detailed rules on common anti-patterns and fixes, read references/specificity-rules.md.
Applying Corrections
Only apply corrections after user approval. When the user approves:
- Apply one change at a time
- Re-run the analyzer after each batch to verify improvement
- Never introduce new specificity issues while fixing existing ones
Weekly Installs
2
Repository
handxr/css-spec…ty-skillFirst Seen
Feb 18, 2026
Security Audits
Installed on
gemini-cli2
opencode2
antigravity2
github-copilot2
windsurf2
codex2