Przejdź do treści
Biblioteka skilli
Projektowanie i UX · Budowanie i kod

component-api-design

/component-api-design

Projektuje czytelne, komponowalne API komponentów React i Vue z wbudowaną dostępnością: właściwości, kompozycja, zdarzenia, a także poprawa API, które stało się trudne w użyciu.

Repozytorium
skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
13.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 13.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Projektuje czytelne, komponowalne API komponentów React i Vue z wbudowaną dostępnością: właściwości, kompozycja, zdarzenia, a także poprawa API, które stało się trudne w użyciu.

Oryginalny opis (EN)

Design clean, composable React/Vue component APIs with accessibility built in. Use when designing or reviewing a component's props, composition, events or accessibility, or when a component API has grown hard to use.

Jak działa

  1. Principles
  2. Step 1: Name the responsibilities
  3. Step 2: Choose the composition model
  4. Step 3: Design the props
  5. Step 4: Events
  6. Step 5: Accessibility contract
  7. Step 6: Write the usage examples first
  8. Output
Sekcje z nagłówków SKILL.md, w oryginale · 66 linii, 402 słów
Podgląd SKILL.md
---
name: component-api-design
description: Design clean, composable React/Vue component APIs with accessibility built in. Use when designing or reviewing a component's props, composition, events or accessibility, or when a component API has grown hard to use.
metadata:
  title: "Component API Design"
---

# Component API Design

Use this skill to design the public API of a UI component before writing
implementation. A good API is learnable, hard to misuse, and composable.

## Principles

1. **Make the common case effortless, the complex case possible.**
2. **Prefer composition over configuration** - slots beat boolean explosions.
3. **The prop name is documentation** - it should read aloud as English.
4. **Accessibility is not a prop** - it is the default behavior.

## Step 1: Name the responsibilities

List every job the component does. If it does more than one thing that could vary
independently, split it. A `Menu` that also manages a button is two components:
`Menu` and `MenuTrigger`.

## Step 2: Choose the composition model

Pick one and stay consistent:

- **Props model** - flat config for simple, leaf components (`Badge`, `Avatar`).
- **Compound components** - shared context for related parts (`Tabs`, `Tab`, `TabPanel`).
- **Render props / slots** - when the consumer must control rendering.

## Step 3: Design the props

For each prop, decide:

- **Controlled vs uncontrolled.** Offer both with the `value` / `defaultValue` pair
  plus `onChange`. Never silently switch modes.
- **Type.** Prefer string unions over booleans: `variant="ghost"` not `ghost={true}`.
- **Default.** Every optional prop needs a sensible default documented in one place.

Avoid these smells:

- More than two boolean props that interact (combinatorial explosion).
- Props named after implementation (`useFlexbox`) instead of intent (`align`).
- A `style` or `className` escape hatch as the only customization path.

## Step 4: Events

- Name handlers `onSomethingHappened`, past or present tense consistently.
- Pass semantic payloads, not raw DOM events: `onSelect(item)` beats `onClick(e)`.
- Make events cancelable only when the consumer can meaningfully prevent default.

## Step 5: Accessibility contract

- Forward `ref` to the focusable root.
- Spread remaining props (`...rest`) onto the semantic element so `aria-*` works.
- Manage focus, roles, and keyboard interaction internally; expose hooks to override.
- Document the rendered semantics (role, tab order) in the API notes.

## Step 6: Write the usage examples first

Before implementing, write three example call sites: the trivial case, the typical
case, and the hardest case you expect. If any reads awkwardly, revise the API now -
it is free to change before code exists and expensive after.

## Output

Deliver a typed interface (TypeScript props or Vue `defineProps`), three usage
examples, and a one-paragraph rationale for the composition model chosen.

Wersje

RepozytoriumWynikLicencja
Ta strona · SkillMedev/skills100MIT
segunadebayo/design-eng-skills85MIT

Migawka bazy z 13.11.2026 · wersja paczki 0fcec0ceeed9 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90frontend-design-system
    Buduje system projektowy frontendu: trzy poziomy tokenów, właściwości CSS, warianty komponentów, API z limitem propsów i tryb ciemny.
  • 100web-component-design
    Obejmuje wzorce komponentów React, Vue i Svelte: CSS-in-JS, strategie kompozycji i architekturę komponentów wielokrotnego użytku, przy budowie bibliotek UI i systemów projektowych.
  • 100web-component-design
    Obejmuje wzorce komponentów React, Vue i Svelte: CSS-in-JS, strategie kompozycji i architekturę komponentów wielokrotnego użytku, przy budowie bibliotek UI i systemów projektowych.
  • 100figma-design-react
    Analizuje projekt Figma i proponuje architekturę komponentów React: API właściwości i obsługę wariantów, bez budowania samych komponentów.
  • 100component-api-and-library-build
    Projektuje i buduje dostępny, kompozycyjny komponent biblioteki z publicznym API: kompozycja czy konfiguracja, kontrolowany czy niekontrolowany, role, fokus, klawiatura, story i dokumentacja.
  • 100design-systems
    Buduje i utrzymuje systemy designu oraz wspólne biblioteki komponentów: tokeny, motywy, API komponentów, stany, testy wizualne i wydania semver.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.