Agent skill
refactor-html
Refactor HTML/TSX files to use existing UI components, DaisyUI classes, and semantic colors. Use when (1) refactoring React/TSX page components to use reusable UI components, (2) replacing raw HTML elements with component library equivalents, (3) converting primitive Tailwind colors to semantic DaisyUI colors, (4) extracting repeated styling patterns into components.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactor-html
SKILL.md
Refactor HTML/TSX
Refactor page components to follow project conventions: use existing UI components, DaisyUI classes, and semantic colors.
Rules
1. Use Existing Components
Replace raw HTML with UI components from packages/ui/src/components/ui/. See components.md for available components and their props.
| Before | After |
|---|---|
<div className="alert alert-error"> |
<Alert variant="error"> |
<button className="btn btn-primary"> |
<Button variant="primary"> |
<input className="input input-bordered"> |
<Input /> |
<select className="select select-bordered"> |
<Select /> |
<fieldset className="fieldset"> |
<Fieldset> |
<span className="loading loading-spinner"> |
<Loading /> |
2. Use Semantic Colors
Replace primitive colors with DaisyUI semantic colors:
| Primitive (NG) | Semantic (OK) |
|---|---|
text-red-* |
text-error |
text-blue-* |
text-primary |
text-green-* |
text-success |
bg-gray-100 |
bg-base-100 |
border-gray-* |
border-base-300 |
3. Extract Repeated Styles
When styling patterns repeat (e.g., border-t border-base-300 pt-6), consider extracting to a component.
Workflow
- Read target file
- Check available components in
packages/ui/src/components/ui/ - Identify rule violations
- Apply refactoring with Edit tool
- Add necessary imports
- Report changes made
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?