This skill should be used when refactoring existing CSS from inline styles or utility classes to semantic patterns. Triggers on "refactor CSS", "extract styles", "consolidate CSS", "convert inline", "clean up styles", "migrate to semantic". Transforms to semantic classes with dark mode and tests.
Transforms existing CSS into semantic component patterns:
@apply compositionsThis is a sub-skill of css-development - typically invoked automatically via the main skill.
Use when:
This skill refactors toward patterns documented in the main css-development skill:
Semantic naming: .button-primary not .btn-blue
Tailwind composition: Use @apply to compose utilities
Dark mode: Include dark: variants
Composition first: Reuse existing classes before creating new
Test coverage: Static CSS + component rendering tests
When this skill is invoked, create a TodoWrite checklist and refactor systematically.
"I'm using the css-development:refactor skill to transform this CSS into semantic component patterns."
Use the TodoWrite tool:
Refactoring CSS:
- [ ] Analyze existing CSS (identify what needs refactoring)
- [ ] Find repeated patterns (look for duplicated utility combinations)
- [ ] Check existing components (see if patterns already exist)
- [ ] Extract to semantic classes (create new classes using @apply)
- [ ] Include dark mode (add dark: variants to new classes)
- [ ] Update markup (replace inline/utility classes with semantic names)
- [ ] Add tests (write static CSS and rendering tests)
- [ ] Document components (add usage comments)
- [ ] Verify behavior unchanged (ensure visual output matches original)