MCP HubMCP Hub
스킬 목록으로 돌아가기

frontend-component-build

rampstackco
업데이트됨 2 days ago
4 조회
239
27
239
GitHub에서 보기
개발testingapidesign

정보

이 Claude 스킬은 개발자가 적절한 접근성, 잘 설계된 props, 정의된 상태를 갖춘 재사용 가능하고 프로덕션 환경에 적합한 프론트엔드 컴포넌트를 구축하도록 돕습니다. 이는 컴포넌트를 처음부터 생성하거나, 기존 컴포넌트를 리팩터링하거나, 컴포넌트 API를 설계할 때 스택에 구애받지 않는 지침을 제공합니다. 버튼, 모달, 폼 입력과 같이 견고하고 유지보수가 가능해야 하는 UI 요소를 구현할 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add rampstackco/claude-skills -a claude-code
플러그인 명령대체
/plugin add https://github.com/rampstackco/claude-skills
Git 클론대체
git 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" over primary={true} ghost={false}.
  • Children > props. Where content is content, accept children. Don't invent headerText and bodyText props 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" and aria-labelledby.
  • Form input: label associated via for/id or aria-labelledby. Error messages linked via aria-describedby. aria-invalid when in error state.
  • Toggles: <button> with aria-pressed for two-state, or role="switch" for on/off.
  • Tabs: role="tablist" / role="tab" / role="tabpanel" with aria-selected and arrow-key navigation.
  • Tooltips and popovers: triggered by focus AND hover. Dismissible with ESC.
  • Loading states: announce with aria-live so screen readers know something changed.

6. Tests

Verify the component works before declaring it done.

Test types by priority:

  1. Visual regression. Renders correctly across variants and states. (Storybook + visual diff tools, or manual screenshots.)
  2. Accessibility. Passes axe or equivalent automated checks.
  3. Keyboard navigation. Tab, Enter, Escape, arrow keys all work as expected.
  4. Component logic. Props produce expected output. Events fire correctly. (Unit tests.)
  5. Integration. Component works inside its expected parent contexts.

A component without at least automated accessibility testing is not done.


Workflow

  1. Understand the use case. What UI need does this component serve? Where will it appear? Adjacent components?
  2. Sketch the anatomy. Name the parts.
  3. List variants and states. Match the design system or define new ones if needed.
  4. Design the API. Required props, optional props, children, events. Type it.
  5. Build the markup with semantic HTML. Choose the right elements. Avoid generic <div> for interactive things.
  6. Style with tokens. No hardcoded colors, spacing, or sizes.
  7. Add interaction. Focus management, keyboard handlers, ARIA.
  8. Add states. Hover, focus, active, disabled, loading, error.
  9. Test. Automated accessibility, keyboard navigation, visual regression.
  10. 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-disabled AND 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" or role="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

GitHub 저장소

rampstackco/claude-skills
경로: skills/frontend-component-build
0
agent-skillsai-agentsanthropicclaudeclaude-aiclaude-code

연관 스킬

sparc-methodology

개발

SPARC 방법론은 체계적인 소프트웨어 생성을 위한 17개의 특화된 모드를 갖춘 포괄적인 다중 에이전트 개발 프레임워크를 제공합니다. 이는 개발자를 명세화, 의사코드, 아키텍처, 정제 및 완성 단계로 안내하며, TDD와 오케스트레이션 패턴을 통합합니다. 초기 연구부터 배포까지 구조화된 종단 간 개발 워크플로가 필요할 때 이 스킬을 사용하십시오.

스킬 보기

sparc-methodology

개발

SPARC 방법론 스킬은 포괄적인 소프트웨어 개발을 위한 체계적인 다중 에이전트 프레임워크를 제공합니다. 명세 및 아키텍처부터 정제와 완성에 이르는 모든 단계를 아우르는 17개의 전문 모드를 통해 개발자를 안내합니다. 통합된 테스트, 오케스트레이션, 배포 기능을 갖춘 구조화된 개발 워크플로우가 필요할 때 이 스킬을 사용하세요.

스킬 보기

sparc-methodology

개발

SPARC 방법론 스킬은 포괄적인 소프트웨어 프로젝트를 위한 체계적인 다중 에이전트 개발 프레임워크를 제공합니다. 작업을 5단계(명세, 의사코드, 아키텍처, 정제, 완성)로 구조화하며, 연구부터 배포까지 모든 것을 아우르는 17개의 특화 모드를 포함합니다. 처음부터 끝까지 복잡한 개발 작업을 안내하는 체계적이고 조직적인 접근 방식이 필요할 때 이 스킬을 사용하세요.

스킬 보기

rust-desktop-applications

개발

이 스킬은 개발자들이 Tauri 프레임워크 또는 네이티브 GUI 대안을 주로 활용하여 Rust로 크로스 플랫폼 데스크톱 애플리케이션을 구축하도록 지원합니다. 시스템 통합이 필요하고 작은 번들 크기와 높은 성능을 요구하는 애플리케이션을 제작하는 데 이상적입니다. 가이드는 프로젝트 설정, IPC, 상태 관리, 그리고 크로스 플랫폼 테스트 및 배포를 다룹니다.

스킬 보기