css-development-refactor
БесплатноБез исполняемых скриптовНе проверенThis skill should be used when refactoring existing CSS from inline styles or utility classes to semantic patterns. Triggers on "refactor CSS", "extract…
от aiskillstore★ 509 звёзд на GitHubОб этом скилле
CSS Development: Refactor
Overview
Transforms existing CSS into semantic component patterns:
- Extract inline styles to semantic classes
- Consolidate utility classes from markup into
@applycompositions - Add dark mode variants
- Add test coverage
- Preserve existing functionality (behavior-neutral refactoring)
This is a sub-skill of css-development - typically invoked automatically via the main skill.
When This Skill Applies
Use when:
- Converting inline styles to semantic classes
- Extracting repeated utility combinations from markup
- Migrating from pure utility-first to semantic components
- Adding dark mode to existing CSS
- Cleaning up scattered or duplicated CSS
Pattern Reference
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
Workflow
When this skill is invoked, create a TodoWrite checklist and refactor systematically.
Announce Usage
"I'm using the css-development:refactor skill to transform this CSS into semantic component patterns."
Create TodoWrite Checklist
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)
Refactoring Checklist Details
Step 1: Analyze Existing CSS
Action: Read and understand the CSS that needs refactoring
Look for:
- Inline styles in component files
- Repeated utility class combinations in markup
- CSS scattered across multiple files
- Missing dark mode support
- Lack of semantic class names
Example patterns to refactor:
// Inline styles
<button style={{ background: 'indigo', padding: '1.5rem 2rem' }}>Click</button>
// Repeated utilities in markup
<button class="bg-indigo-500 hover:bg-indigo-700 px-6 py-3 rounded-lg text-white">
Click me
</button>
<button class="bg-indigo-500 hover:bg-indigo-700 px-6 py-3 rounded-lg text-white">
Submit
</button>
// Non-semantic CSS
.btn-blue {
background: blue;
padding: 12px 24px;
}
Capture:
- File locations
- Pattern frequency (how many times repeated)
- Current approach (inline, utilities, old CSS)
Mark as completed when analysis is done.
Step 2: Find Repeated Patterns
Action: Identify duplicated utility combinations that should become semantic classes
Use Grep tool to search for repeated patterns:
# Search for common utility combinations
grep -r "bg-indigo-500 hover:bg-indigo-700 px-6 py-3" .
grep -r "rounded-lg shadow-md p-6" .
Categorize patterns:
- High frequency (5+ occurrences): Definitely extract
- Medium frequency (2-4 occurrences): Probably extract
- Low frequency (1 occurrence): Keep as-is or compose existing classes
For each pattern:
- Count occurrences
- List file locations
- Identify semantic purpose (is this a button? card? badge?)
Mark as completed when patterns are cataloged.
Step 3: Check Existing Components
Action: Read styles/components.css to see if patterns already exist
Before creating new classes, check:
- Does a similar class already exist?
- Can existing classes be composed?
- Would a variant of an existing class work?
Example:
Pattern found: bg-indigo-500 hover:bg-indigo-700 px-6 py-3 rounded-lg text-white
Check: Does .button-primary already exist? YES
Solution: Use .button-primary instead of creating new class
Decision for each pattern:
- ✅ Use existing class as-is
- ✅ Compose existing classes
- ✅ Create variant of existing class
- ⚠️ Create new class (only if no existing solution)
Mark as completed when reuse opportunities are identified.
Step 4: Extract to Semantic Classes
Action: Create new semantic classes in styles/components.css for patterns that need extraction
For each pattern being extracted:
- Choose semantic name following existing patterns
- Write CSS class using
@apply - Include dark mode variants
- Add documentation comment
Example extraction:
Before (in markup):
<button class="bg-indigo-500 hover:bg-indigo-700 px-6 py-3 rounded-lg text-white transition-all duration-200">
Click me
</button>
After (in components.css):
/* Primary button - Main call-
Установить css-development-refactor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл css-development-refactor?
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.
Как установить скилл css-development-refactor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл css-development-refactor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic