Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when reviewing stylesheets or components that use JavaScript to toggle classes on parent elements based on child state, form input values, or content presence — :has() may replace the JavaScript entirely.
.claude/skills/thedaviddias-has-selector/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 71% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 86% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-12 | ✗→✓ | ▲ Improved | -13% | 0% |
Before :has(), styling a parent based on its children required JavaScript: detecting state, toggling classes, and keeping DOM and styles in sync. This created coupling between styling logic and application logic. :has() moves that relationship back into CSS where it belongs, reducing JavaScript complexity, eliminating class-toggling boilerplate, and making styling intent readable in the stylesheet itself.
Look for patterns in this code where JavaScript toggles a class on a parent element based on the state or content of a child element. These are candidates for replacement with :has().
Replace the JavaScript class-toggling logic with a CSS :has() selector. Show the selector that targets the parent element when the relevant child condition is met.
Explain how the :has() pseudo-class works, how it differs from :is() and :not(), what descendant vs child combinators mean inside :has(), and how browser support stands today.
Review the stylesheets and component JavaScript in this file. Flag any locations where a parent element's style is controlled by toggling a class from JavaScript based on child state — and show the equivalent :has() rule.
For full implementation details, code examples, and framework-specific guidance, see references/rule.md.
Rule page: https://frontendchecklist.io/en/rules/css/has-selector
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 6,116 | 8,305 | +36% | 1 | 1 | 0% | 1,344 | 2,304 | +71% | 0 | 0 | — |
case-02 | fail→pass | 4,133 | 5,261 | +27% | 1 | 1 | 0% | 812 | 1,509 | +86% | 0 | 0 | — |
case-03 | pass→pass | 7,840 | 6,926 | -12% | 1 | 1 | 0% | 1,553 | 1,677 | +8% | 0 | 0 | — |
case-04 | fail→pass | 7,547 | 7,732 | +2% | 1 | 1 | 0% | 1,523 | 1,824 | +20% | 0 | 0 | — |
case-05 | fail→fail | 7,571 | 5,786 | -24% | 1 | 1 | 0% | 1,608 | 1,626 | +1% | 0 | 0 | — |
case-06 | fail→fail | 3,880 | 4,732 | +22% | 1 | 1 | 0% | 817 | 1,348 | +65% | 0 | 0 | — |
case-07 | pass→pass | 5,534 | 6,074 | +10% | 1 | 1 | 0% | 1,250 | 1,606 | +28% | 0 | 0 | — |
case-08 | pass→fail | 7,297 | 6,204 | -15% | 1 | 1 | 0% | 1,412 | 1,732 | +23% | 0 | 0 | — |
case-09 | fail→pass | 9,346 | 6,147 | -34% | 1 | 1 | 0% | 1,928 | 1,640 | -15% | 0 | 0 | — |
case-10 | fail→fail | 5,201 | 4,560 | -12% | 1 | 1 | 0% | 1,014 | 1,382 | +36% | 0 | 0 | — |
case-11 | fail→fail | 9,050 | 7,004 | -23% | 1 | 1 | 0% | 1,786 | 1,657 | -7% | 0 | 0 | — |
case-12 | fail→pass | 10,037 | 7,191 | -28% | 1 | 1 | 0% | 2,110 | 1,836 | -13% | 0 | 0 | — |
case-13 | fail→fail | 4,275 | 3,840 | -10% | 1 | 1 | 0% | 919 | 1,071 | +17% | 0 | 0 | — |
case-14 | pass→fail | 4,916 | 5,181 | +5% | 1 | 1 | 0% | 1,040 | 1,583 | +52% | 0 | 0 | — |
case-15 | fail→fail | 7,732 | 5,967 | -23% | 1 | 1 | 0% | 1,546 | 1,731 | +12% | 0 | 0 | — |
case-16 | fail→fail | 8,192 | 5,499 | -33% | 1 | 1 | 0% | 1,888 | 1,591 | -16% | 0 | 0 | — |
case-17 | pass→pass | 4,195 | 5,718 | +36% | 1 | 1 | 0% | 926 | 1,425 | +54% | 0 | 0 | — |
case-18 | fail→fail | 4,396 | 3,890 | -12% | 1 | 1 | 0% | 931 | 1,001 | +8% | 0 | 0 | — |
case-19 | pass→pass | 7,241 | 9,230 | +27% | 1 | 1 | 0% | 1,582 | 2,112 | +34% | 0 | 0 | — |
case-20 | pass→pass | 8,657 | 6,455 | -25% | 1 | 1 | 0% | 1,700 | 1,766 | +4% | 0 | 0 | — |
case-21 | pass→pass | 9,025 | 6,344 | -30% | 1 | 1 | 0% | 1,770 | 1,729 | -2% | 0 | 0 | — |
case-22 | pass→pass | 12,519 | 8,272 | -34% | 1 | 1 | 0% | 2,597 | 1,792 | -31% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.