Designs or reviews Vue 3 component APIs. Handles prop drilling decisions, applies compound component patterns with provide/inject, defines minimal public API surfaces with typed props/emits/slots, and enforces Vue 3.4+ composition conventions. Invoked when creating new components, refactoring existing ones, or reviewing component contracts.
Installation
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Designs or reviews Vue 3 component APIs. Handles prop drilling decisions, applies compound component patterns with provide/inject, defines minimal public API surfaces with typed props/emits/slots, and enforces Vue 3.4+ composition conventions. Invoked when creating new components, refactoring existing ones, or reviewing component contracts.
Determine the component type before designing the API:
Page component — orchestrates data fetching, permissions, and layout. Coordinates child components. Tests: mock data fetching, verify correct children are rendered.
Feature component — contains feature-specific business logic and local state. May call store actions. Tests: mock store, assert state changes.
UI component — pure presentational, props + slots only, no async logic, no store access. Tests: assert correct markup for given props.
Step 2 — Design the Public API Surface
Props: minimal, typed with TypeScript interfaces, withDefaults for optional props with safe defaults.
Emits: typed defineEmits<{ eventName: [payload] }>() — one event per user action.
Slots: default for content, named for layout regions, scoped when parent needs child-provided state.
expose(): only for imperative handles (focus, open, reset) — never expose internal state.
Use defineModel<T>() (Vue 3.4+) for two-way binding instead of modelValue + update:modelValue.
Step 3 — Evaluate Prop Drilling Depth
Count how many component levels the data crosses:
1–2 levels → props are acceptable
3+ levels through components that do not use the data → refactor to provide/inject with typed Symbol keys