frontend-component-build
について
このClaudeスキルは、開発者が適切なアクセシビリティ、適切に設計されたプロパティ、定義された状態を備えた再利用可能で本番環境対応のフロントエンドコンポーネントを構築するのを支援します。コンポーネントをゼロから作成する場合、既存コンポーネントをリファクタリングする場合、またはコンポーネントAPIを設計する場合に、スタックに依存しないガイダンスを提供します。堅牢で保守性の高いボタン、モーダル、フォーム入力などのUI要素を実装する際にご利用ください。
クイックインストール
Claude Code
推奨npx skills add rampstackco/claude-skills -a claude-code/plugin add https://github.com/rampstackco/claude-skillsgit clone https://github.com/rampstackco/claude-skills.git ~/.claude/skills/frontend-component-buildこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Frontend Component Build
Build production-ready components. Stack-agnostic principles. Most patterns translate to React, Vue, Svelte, or vanilla web components.
This skill is about implementing a component well. For broader system design see design-system. For day-to-day visual decisions see design-standards.
When to use
- Building a new component from scratch
- Refactoring an existing component
- Designing a component API (props, slots, events)
- Adding accessibility to an existing component
- Implementing a component from a design
When NOT to use
- Building a full design system (use
design-system) - Page-level design decisions (use
design-standards) - Backend or data work (use
code-review-web) - Performance-only optimization (use
performance-optimization)
Required inputs
- The component's purpose (what UI need it serves)
- The design (or willingness to design it)
- The framework or technical context
- The states the component must support
- Accessibility requirements
The framework: 6 dimensions
A complete component handles six dimensions. Skip any one and the component is incomplete.
1. Anatomy
Identify the parts that make up the component before writing any markup.
Common anatomies:
- Button: container + label + (optional) icon + (optional) loading indicator
- Modal: backdrop + container + header + body + footer + close affordance
- Form input: label + input + (optional) help text + (optional) error message
- Card: container + (optional) header + body + (optional) footer + (optional) media
Naming the parts up front makes the API obvious.
2. Variants
What variations does the component support?
- Visual variants (primary, secondary, ghost, danger)
- Size variants (small, medium, large)
- Functional variants (with icon, without icon, icon-only)
Variants should be a managed set, not a free-for-all. Document the supported set; reject requests for new variants without a real use case.
3. States
What states must the component handle?
- Default
- Hover (when pointer is supported)
- Focus (always - keyboard navigation requires it)
- Active / pressed
- Disabled
- Loading (where applicable)
- Error (for inputs, forms, validation-bound components)
- Empty (for components that display data)
Every state needs visual treatment AND accessibility treatment.
4. Props / API
Design the component's contract.
API design principles:
- Required props minimal. What's truly needed every time? That's required. Everything else has a sensible default.
- Boolean props are red flags. Three booleans means seven combinations. Prefer enum strings:
variant: "primary" | "secondary" | "ghost"overprimary={true} ghost={false}. - Children > props. Where content is content, accept children. Don't invent
headerTextandbodyTextprops when slots work. - Composition > configuration. A component that does 5 things via 12 props often should be 5 smaller components.
- Type the props. TypeScript or PropTypes or JSDoc. The type is documentation that won't go out of date.
5. Accessibility
Build it accessible from the start. Adding accessibility later is 5x harder.
Universal:
- Semantic HTML elements (
<button>,<a>,<nav>,<form>, etc.) over generic<div> - Keyboard navigable (Tab, Shift+Tab, Enter/Space for buttons)
- Focus visible
- Tap targets minimum 44 by 44 pixels
- ARIA only where semantic HTML is insufficient
Component-specific:
- Button: use
<button>. Don't fake one with a<div>. - Modal: focus trap, ESC to close, returns focus to trigger on close,
role="dialog"andaria-labelledby. - Form input: label associated via
for/idoraria-labelledby. Error messages linked viaaria-describedby.aria-invalidwhen in error state. - Toggles:
<button>witharia-pressedfor two-state, orrole="switch"for on/off. - Tabs:
role="tablist"/role="tab"/role="tabpanel"witharia-selectedand arrow-key navigation. - Tooltips and popovers: triggered by focus AND hover. Dismissible with ESC.
- Loading states: announce with
aria-liveso screen readers know something changed.
6. Tests
Verify the component works before declaring it done.
Test types by priority:
- Visual regression. Renders correctly across variants and states. (Storybook + visual diff tools, or manual screenshots.)
- Accessibility. Passes axe or equivalent automated checks.
- Keyboard navigation. Tab, Enter, Escape, arrow keys all work as expected.
- Component logic. Props produce expected output. Events fire correctly. (Unit tests.)
- Integration. Component works inside its expected parent contexts.
A component without at least automated accessibility testing is not done.
Workflow
- Understand the use case. What UI need does this component serve? Where will it appear? Adjacent components?
- Sketch the anatomy. Name the parts.
- List variants and states. Match the design system or define new ones if needed.
- Design the API. Required props, optional props, children, events. Type it.
- Build the markup with semantic HTML. Choose the right elements. Avoid generic
<div>for interactive things. - Style with tokens. No hardcoded colors, spacing, or sizes.
- Add interaction. Focus management, keyboard handlers, ARIA.
- Add states. Hover, focus, active, disabled, loading, error.
- Test. Automated accessibility, keyboard navigation, visual regression.
- Document. Usage, API, examples, anti-patterns.
Failure patterns
- Building with
<div onClick>. Loses keyboard accessibility, screen reader semantics, and focus. Use<button>or<a>. - Hardcoding colors and sizes. Tokens exist for a reason. Hardcoded values resist theming and consistency.
- Boolean prop explosion.
<Button primary large rounded fullWidth disabled icon />. Too many booleans means you actually need fewer variants designed more thoughtfully. - Forgetting focus states. Hover gets attention; focus gets neglected. Keyboard users see invisible buttons.
- Skipping disabled-state thought. A disabled button should look obviously disabled AND be
aria-disabledAND not respond to clicks. - Inventing ARIA. ARIA roles and properties have specific behaviors. Made-up ARIA is worse than no ARIA. Use semantic HTML first.
- Loading state that doesn't announce. Screen readers don't know the spinner appeared. Use
aria-live="polite"orrole="status". - Tooltip-only critical content. Hover-only content is invisible to keyboard and touch users. Critical content goes in the visible UI.
- Component without docs. Future-you, your teammate, or the next maintainer cannot use what they cannot understand.
Output format
A complete component delivery includes:
- Component code (in the appropriate framework)
- Storybook (or equivalent) entry showing all variants and states
- Documentation:
- Anatomy diagram or description
- Props/API table
- Usage examples (basic, advanced, edge cases)
- When to use vs. when to use an alternative
- Anti-patterns (what to avoid)
- Accessibility notes
- Tests (visual regression + accessibility + logic)
Reference files
references/component-spec-template.md- Template for documenting a component (props, states, accessibility, edge cases) before building.references/component-api-patterns.md- Common patterns for designing flexible component APIs (compound components, controlled vs uncontrolled, polymorphicasprop, render props, slots).references/accessibility-patterns.md- ARIA patterns for common interactive components.
GitHub リポジトリ
関連スキル
sparc-methodology
開発SPARC手法は、体系的なソフトウェア構築のための17の専門モードを備えた包括的なマルチエージェント開発フレームワークを提供します。この手法は、仕様策定、擬似コード作成、アーキテクチャ設計、リファインメント、完成の各フェーズを開発者に導き、TDDとオーケストレーションパターンを統合しています。初期調査からデプロイメントに至る、構造化されたエンドツーエンドの開発ワークフローが必要な場合に、このスキルをご利用ください。
sparc-methodology
開発SPARCメソドロジースキルは、包括的なソフトウェア開発のための体系的なマルチエージェントフレームワークを提供します。仕様とアーキテクチャからリファインメント、完成までの全フェーズをカバーする17の専門モードを通じて開発者を導きます。統合されたテスト、オーケストレーション、デプロイメント機能を備えた構造化された開発ワークフローが必要な際に、このスキルをご利用ください。
sparc-methodology
開発SPARCメソドロジースキルは、包括的なソフトウェアプロジェクトのための体系的なマルチエージェント開発フレームワークを提供します。作業を5つのフェーズ(仕様、擬似コード、アーキテクチャ、リファインメント、完成)に構造化し、研究からデプロイメントまでを網羅する17の専門モードを備えています。複雑な開発タスクを最初から最後まで導く、調整された構造的なアプローチが必要な場合に、このスキルをご利用ください。
rust-desktop-applications
開発このスキルは、主にTauriフレームワークまたはネイティブGUI代替手段を用いて、Rustでクロスプラットフォームなデスクトップアプリケーションを構築する開発者を支援します。システム統合、小さなバンドルサイズ、および高性能を必要とするパフォーマンス重視のアプリケーション作成に最適です。ガイダンスは、プロジェクト設定、IPC、状態管理、クロスプラットフォームテストとデプロイを網羅しています。
