← Back to list

migrate-component
by lssm-tech
The deterministic, spec-first compiler that keeps AI-written software coherent, safe, and regenerable.
⭐ 2🍴 0📅 Jan 23, 2026
SKILL.md
name: migrate-component description: 'Migrate a component from raw HTML to design system components' targets: ["*"] claudecode: allowed-tools: - "Bash" - "Read" - "Write" - "Glob" - "Grep"
Migrate Component Skill
This skill migrates components from raw HTML to design system components.
Usage
Invoke when:
- A component uses raw HTML elements (div, button, span, etc.)
- A component needs to adopt design system patterns
- Lint errors flag
prefer-design-systemviolations
Process
Step 1: Analyze Current Component
Read the component and identify:
- Raw HTML elements used
- Current styling approach (CSS, Tailwind, inline)
- Component structure and logic
- Props and state
Step 2: Map to Design System
| Raw HTML | Design System Replacement |
|---|---|
<div> | Box, VStack, HStack, Stack |
<button> | Button, IconButton |
<input> | Input, TextArea |
<form> | Form, FormField |
<span>, <p> | Text |
<h1>-<h6> | Heading |
<ul>, <ol> | List, ListItem |
<a> | Link, ButtonLink |
<img> | Image, Avatar |
| Flex container | HStack, VStack, Stack |
| Grid container | Grid, GridItem |
Step 3: Preserve Functionality
Ensure:
- All event handlers remain connected
- Accessibility attributes are maintained or improved
- Styling intent is preserved with tokens
- Loading/error/empty states are handled
Step 4: Migrate Step by Step
- Import design system components
- Replace elements from innermost to outermost
- Convert inline styles to design tokens
- Add missing accessibility attributes
- Test functionality after each change
Step 5: Update Tests
- Verify component still renders
- Check accessibility
- Test interactions
- Verify state handling
Example Migration
Before (Raw HTML)
const UserCard = ({ user, onEdit }) => (
<div className="flex items-center p-4 border rounded-lg">
<img
src={user.avatar}
className="w-12 h-12 rounded-full"
alt={user.name}
/>
<div className="ml-4 flex-1">
<h3 className="font-semibold">{user.name}</h3>
<span className="text-gray-500">{user.email}</span>
</div>
<button
onClick={onEdit}
className="px-4 py-2 bg-blue-500 text-white rounded"
>
Edit
</button>
</div>
);
After (Design System)
import { HStack, VStack, Box } from '@contractspec/lib.design-system';
import { Avatar, Text, Heading, Button } from '@contractspec/lib.ui-kit-web';
const UserCard = ({ user, onEdit }) => (
<HStack
padding="md"
borderWidth="1px"
borderRadius="lg"
alignItems="center"
gap="md"
>
<Avatar
src={user.avatar}
name={user.name}
size="lg"
/>
<VStack flex={1} alignItems="flex-start" gap="xs">
<Heading size="sm">{user.name}</Heading>
<Text color="muted">{user.email}</Text>
</VStack>
<Button onClick={onEdit} variant="primary">
Edit
</Button>
</HStack>
);
Key Changes Made
<div className="flex">→<HStack>(semantic flex container)<img>→<Avatar>(handles fallback, accessibility)<h3>→<Heading>(semantic, styled)<span>→<Text>(typography tokens)<button>→<Button>(accessibility, variants)- Tailwind classes → Design tokens (padding, gap, etc.)
Verification Checklist
- No raw HTML elements remain
- Component renders correctly
- Accessibility is maintained/improved
- Interactions work as before
- Loading/error states handled
- Tests pass
- Lint passes (no prefer-design-system errors)
Output
After migration, report:
- Elements migrated
- Design system components used
- Any compromises or notes
- Test status
Score
Total Score
75/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon


