css-development-create-component
新しいUI要素やコンポーネントを作成する際に、意味のある命名規則、Tailwind CSSの活用、ダークモード対応、テスト実装などを考慮したスタイリングを効率的に行うSkill。
📜 元の英語説明(参考)
This skill should be used when creating new styled components or adding new CSS classes. Triggers on "create component", "new button", "new card", "add styles", "style component", "build UI element". Guides semantic naming, Tailwind composition, dark mode support, and test coverage.
🇯🇵 日本人クリエイター向け解説
新しいUI要素やコンポーネントを作成する際に、意味のある命名規則、Tailwind CSSの活用、ダークモード対応、テスト実装などを考慮したスタイリングを効率的に行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o css-development-create-component.zip https://jpskill.com/download/16708.zip && unzip -o css-development-create-component.zip && rm css-development-create-component.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16708.zip -OutFile "$d\css-development-create-component.zip"; Expand-Archive "$d\css-development-create-component.zip" -DestinationPath $d -Force; ri "$d\css-development-create-component.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
css-development-create-component.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
css-development-create-componentフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
CSS開発: コンポーネントの作成
概要
確立されたパターンに従って、新しいCSSコンポーネントの作成をガイドします。
- セマンティックなクラス命名
@applyを介した Tailwind ユーティリティの構成- デフォルトでのダークモードのサポート
- テストカバレッジ(静的CSS + コンポーネントのレンダリング)
- 作成よりも構成(既存のクラスの再利用)
これは css-development のサブスキルです - 通常、メインスキルを通じて自動的に呼び出されます。
このスキルが適用される場合
以下の場合に使用します。
- 新しいスタイル付きコンポーネントの作成時(ボタン、カード、フォームフィールドなど)
- components.css に新しいセマンティックCSSクラスを追加する場合
- 再利用可能なUIパターンの構築
- ダークモードのサポートとテストカバレッジを確保する必要がある場合
パターンリファレンス
このスキルは、メインの css-development スキルで文書化されているパターンに従います。主なパターン:
セマンティックな命名: .button-primary であり、.btn-blue ではない
Tailwindの構成: @apply を使用してユーティリティを構成する
ダークモード: デフォルトで dark: バリアントを含める
構成を優先: 既存のクラスを組み合わせることができるか確認する
テストカバレッジ: 静的CSSテスト + コンポーネントのレンダリングテスト
ワークフロー
このスキルが呼び出されたら、TodoWriteチェックリストを作成し、ステップごとに作業を進めます。
使用状況の通知
まず、このスキルを使用していることを通知します。
"css-development:create-component スキルを使用して、この新しいCSSコンポーネントの作成をガイドします。"
TodoWriteチェックリストの作成
TodoWriteツールを使用して、次のチェックリストを作成します。
CSSコンポーネントの作成:
- [ ] 既存のコンポーネントの調査 (components.css を読む)
- [ ] 構成で解決できるか確認する (既存のクラスを組み合わせることができるか?)
- [ ] コンポーネントのタイプを特定する (新しいクラスが必要な場合は atom/molecule/organism)
- [ ] セマンティックな名前を選択する (既存の命名パターンに従う)
- [ ] コンポーネントクラスを作成する (@apply を使用し、dark: バリアントを含める)
- [ ] マークアップの統合を作成する (React/HTML の使用法を示す)
- [ ] 静的CSSテストを作成する (クラスが存在することを確認する)
- [ ] コンポーネントのレンダリングテストを作成する (className の適用を確認する)
- [ ] コンポーネントを文書化する (使用法のコメントを追加する)
ステップごとの詳細
ステップ 1: 既存のコンポーネントの調査
アクション: Readツールを使用して styles/components.css を読みます
目的: 一貫性を確保し、再利用の機会を特定するために、既に何が存在するかを理解します
探すべきもの:
- 構成できる同様のコンポーネント
- 従うべき既存の命名パターン
- 一般的なパターン(ボタンのバリアント、カードのスタイルなど)
開始する前に in_progress としてマーク し、完了したら completed としてマーク します。
ステップ 2: 構成で解決できるか確認する
アクション: 既存のクラスを組み合わせることで目標を達成できるかどうかを分析します
例:
- 「アイコン付きのプライマリボタン」が必要ですか? →
.button-primary+ スペーシングユーティリティを組み合わせます - 「影付きのカード」が必要ですか? →
.cardが存在する場合はそれを使用し、必要に応じてユーティリティクラスを追加します - 「強調表示されたバッジ」が必要ですか? →
.badge+ カラーユーティリティを組み合わせます
YAGNIの原則: 構成が機能しない場合、またはマークアップで過剰な重複が発生する場合にのみ、新しいクラスを作成します。
決定:
- 構成が機能する場合: 組み合わせを文書化し、残りのステップをスキップします(新しいクラスは不要です)
- 新しいクラスが必要な場合: ステップ3に進みます
決定したら completed としてマーク します。
ステップ 3: コンポーネントのタイプを特定する
アクション: アトミックデザインレベルを決定します(新しいクラスを作成する場合)
Atoms - 基本的な構成要素:
- 単一目的の要素
- 例:
.button,.input,.badge,.spinner,.link
Molecules - 構成されたコンポーネント:
- 複数のアトムを組み合わせる
- 例:
.card,.form-field,.empty-state,.alert
Organisms - 複雑なコンポーネント:
- 複数の分子 + アトム
- 例:
.page-layout,.navigation,.session-card,.conversation-timeline
これが重要な理由: 複雑さと依存関係の範囲を絞り込むのに役立ちます
タイプを特定したら completed としてマーク します。
ステップ 4: セマンティックな名前を選択する
アクション: 既存のパターンに従って、記述的でセマンティックなクラス名を選択します
参照コードベースからの命名パターン:
- ベース + バリアント:
.button-primary,.button-secondary,.button-danger - コンポーネント + サブ要素:
.card-title,.card-description,.form-field - コンテキスト + コンポーネント:
.session-card,.marketing-hero,.dashboard-layout - 状態修飾子:
.session-card-active,.button-disabled
アンチパターン (避ける):
- ユーティリティ名:
.btn-blue,.card-sm,.text-big - 省略形:
.btn,.hdr,.desc - 汎用的:
.component,.item,.thing
検証: 名前は目的を明確に示し、既存のパターンに適合する必要があります
名前を選択したら completed としてマーク します。
ステップ 5: コンポーネントクラスを作成する
アクション: Editツールを使用して、styles/components.css にCSSクラスを作成します
テンプレート:
/* [コンポーネント名] - [簡単な説明]
使用法: <[element] className="[class-name]">[content]</[element]> */
.[class-name] {
@apply [background-utilities] [dark-variants];
@apply [spacing-utilities];
@apply [typography-utilities];
@apply [transition-utilities];
}
必要な要素:
- ドキュメントコメント - それが何か、どのように使用するか
- ダークモードバリアント - 色/背景に
dark:を含める - 論理的なグループ化 - 関連するユーティリティをグループ化する(背景、スペーシング、タイポグラフィ、トランジション)
- インタラクティブな状態 - 該当する場合は hover/focus/active を含める
例:
/* プライマリボタン - ホバーリフト効果のあるメインのコールトゥアクションボタン
使用法: <button className="button-primary">クリックしてください</button> */
.button-primary {
@apply bg-indigo-500 hover:bg-indigo-700 dark:bg-indigo-600 dark:hover:bg-indigo-800;
@apply px-6 py-3 rounded-lg font-medium text-white;
@apply transition-all duration-200 hover:-translate-y-0.5;
@apply focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2;
}
Editツールを使用して既存のファイルに追加します (ファイル全体を上書きしないでください)
クラスをファイルに書き込んだら completed としてマーク します。
ステップ 6: マークアップの統合を作成する
アクション: コンポーネントをさまざまな方法で使用する方法を文書化します
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
CSS Development: Create Component
Overview
Guides you through creating new CSS components following established patterns:
- Semantic class naming
- Tailwind utility composition via
@apply - Dark mode support by default
- Test coverage (static CSS + component rendering)
- Composition over creation (reuse existing classes)
This is a sub-skill of css-development - typically invoked automatically via the main skill.
When This Skill Applies
Use when:
- Creating a new styled component (button, card, form field, etc.)
- Adding new semantic CSS classes to components.css
- Building reusable UI patterns
- Need to ensure dark mode support and test coverage
Pattern Reference
This skill follows the patterns documented in the main css-development skill. Key patterns:
Semantic naming: .button-primary not .btn-blue
Tailwind composition: Use @apply to compose utilities
Dark mode: Include dark: variants by default
Composition first: Check if existing classes can be combined
Test coverage: Static CSS tests + component rendering tests
Workflow
When this skill is invoked, create a TodoWrite checklist and work through it step-by-step.
Announce Usage
First, announce that you're using this skill:
"I'm using the css-development:create-component skill to guide creating this new CSS component."
Create TodoWrite Checklist
Use the TodoWrite tool to create this checklist:
Creating CSS Component:
- [ ] Survey existing components (read components.css)
- [ ] Check if composition solves it (can existing classes combine?)
- [ ] Identify component type (atom/molecule/organism if new class needed)
- [ ] Choose semantic name (follow existing naming patterns)
- [ ] Write component class (use @apply, include dark: variants)
- [ ] Create markup integration (show React/HTML usage)
- [ ] Write static CSS test (verify class exists)
- [ ] Write component rendering test (verify className application)
- [ ] Document component (add usage comment)
Step-by-Step Details
Step 1: Survey Existing Components
Action: Use the Read tool to read styles/components.css
Purpose: Understand what already exists to ensure consistency and identify reuse opportunities
What to look for:
- Similar components that could be composed
- Existing naming patterns to follow
- Common patterns (button variants, card styles, etc.)
Mark as in_progress before starting, mark as completed when done.
Step 2: Check if Composition Solves It
Action: Analyze if combining existing classes achieves the goal
Examples:
- Want a "primary button with icon"? → Combine
.button-primary+ spacing utilities - Want a "card with shadow"? → Use
.cardif it exists, add utility class if needed - Want a "highlighted badge"? → Combine
.badge+ color utilities
YAGNI principle: Only create a new class if composition doesn't work or creates excessive duplication in markup.
Decision:
- If composition works: Document the combination and SKIP remaining steps (no new class needed)
- If new class needed: Continue to Step 3
Mark as completed when decision is made.
Step 3: Identify Component Type
Action: Determine atomic design level (if creating new class)
Atoms - Basic building blocks:
- Single-purpose elements
- Examples:
.button,.input,.badge,.spinner,.link
Molecules - Composed components:
- Combine multiple atoms
- Examples:
.card,.form-field,.empty-state,.alert
Organisms - Complex components:
- Multiple molecules + atoms
- Examples:
.page-layout,.navigation,.session-card,.conversation-timeline
Why this matters: Helps scope complexity and dependencies
Mark as completed when type is identified.
Step 4: Choose Semantic Name
Action: Choose a descriptive, semantic class name following existing patterns
Naming patterns from reference codebase:
- Base + variant:
.button-primary,.button-secondary,.button-danger - Component + sub-element:
.card-title,.card-description,.form-field - Context + component:
.session-card,.marketing-hero,.dashboard-layout - State modifiers:
.session-card-active,.button-disabled
Anti-patterns (avoid):
- Utility names:
.btn-blue,.card-sm,.text-big - Abbreviations:
.btn,.hdr,.desc - Generic:
.component,.item,.thing
Validation: Name should clearly indicate purpose and fit existing patterns
Mark as completed when name is chosen.
Step 5: Write Component Class
Action: Create the CSS class in styles/components.css using Edit tool
Template:
/* [Component name] - [Brief description]
Usage: <[element] className="[class-name]">[content]</[element]> */
.[class-name] {
@apply [background-utilities] [dark-variants];
@apply [spacing-utilities];
@apply [typography-utilities];
@apply [transition-utilities];
}
Required elements:
- Documentation comment - What it is, how to use it
- Dark mode variants - Include
dark:for colors/backgrounds - Logical grouping - Group related utilities (background, spacing, typography, transitions)
- Interactive states - Include hover/focus/active if applicable
Example:
/* Primary button - Main call-to-action button with hover lift effect
Usage: <button className="button-primary">Click me</button> */
.button-primary {
@apply bg-indigo-500 hover:bg-indigo-700 dark:bg-indigo-600 dark:hover:bg-indigo-800;
@apply px-6 py-3 rounded-lg font-medium text-white;
@apply transition-all duration-200 hover:-translate-y-0.5;
@apply focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2;
}
Use Edit tool to add to existing file (don't overwrite entire file)
Mark as completed when class is written to file.
Step 6: Create Markup Integration
Action: Document how to use the component in different frameworks
Show usage examples for:
- React (if project uses React)
- Vanilla HTML (always show this)
- Vue or other frameworks (if project uses them)
Example documentation:
## Using the button-primary Component
**React:**
```tsx
const Button = ({ variant = 'primary', className = '', children, ...props }) => {
const classes = `button-${variant} ${className}`.trim();
return <button className={classes} {...props}>{children}</button>;
};
// Usage
<Button variant="primary">Click me</Button>
<Button variant="primary" className="w-full">Full width</Button>
Vanilla HTML:
<button class="button-primary">Click me</button>
<button class="button-primary custom-class">With custom class</button>
**Where to put this:** In project documentation, README, or as a comment in the component file
**Mark as completed** when markup examples are documented.
---
#### Step 7: Write Static CSS Test
**Action:** Add test to `styles/__tests__/components.test.ts` (or create if doesn't exist)
**Purpose:** Verify the CSS class exists in the components.css file
**Test pattern:**
```typescript
import { readFileSync } from 'fs';
import { describe, it, expect } from 'vitest';
describe('components.css', () => {
const content = readFileSync('styles/components.css', 'utf-8');
it('should have button-primary component class', () => {
expect(content).toContain('.button-primary');
});
it('should have button-primary dark mode variants', () => {
expect(content).toContain('dark:bg-indigo');
});
});
Key checks:
- Class exists in file
- Dark mode variants present (search for
dark:) - Documentation comment exists (optional but good)
Run test:
npm test styles/__tests__/components.test.ts
# or
vitest styles/__tests__/components.test.ts
Expected: Test passes (green)
Mark as completed when test is written and passing.
Step 8: Write Component Rendering Test
Action: Add component rendering test (framework-specific)
Purpose: Verify className application works in actual components
React example:
import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Button } from '@/components/atoms/Button';
describe('Button component', () => {
it('applies button-primary class', () => {
render(<Button variant="primary">Click</Button>);
expect(screen.getByRole('button')).toHaveClass('button-primary');
});
it('accepts and applies custom className', () => {
render(<Button variant="primary" className="custom-class">Click</Button>);
const button = screen.getByRole('button');
expect(button).toHaveClass('button-primary', 'custom-class');
});
});
Key checks:
- Semantic class is applied
- Custom className can be added
- Classes don't conflict
Run test:
npm test components/atoms/Button.test.tsx
# or
vitest components/atoms/Button.test.tsx
Expected: Test passes (green)
Mark as completed when test is written and passing.
Step 9: Document Component
Action: Ensure component has usage documentation
Documentation should include:
- Comment in CSS - Already done in Step 5
- Markup examples - Already done in Step 6
- Component API (for framework components) - Props, variants, etc.
Additional documentation (optional but recommended):
- Add to component style guide if project has one
- Add to Storybook if project uses it
- Add visual examples or screenshots
Minimum requirement: CSS comment + markup examples exist
Mark as completed when documentation is verified.
Completion
When all checklist items are completed:
-
Run all tests to ensure everything passes:
npm test -
Show summary of what was created:
- Component class name and file location
- Test file locations
- Documentation locations
-
Suggest next steps:
- Commit the changes
- Create related variants if needed
- Use the component in actual UI
Example summary:
Created button-primary component!
Files created/modified:
- styles/components.css (added .button-primary)
- styles/__tests__/components.test.ts (added static CSS test)
- components/atoms/Button.test.tsx (added rendering test)
- components/atoms/Button.tsx (markup integration)
Next steps:
- Commit these changes: git add . && git commit -m "feat: add button-primary component"
- Use in your UI: <Button variant="primary">Click me</Button>
- Create variants if needed: button-secondary, button-danger, etc.