Skill v1.0.2
currentAutomated scan100/100~4 modified
name: core-components description: "Adapt an existing project component library and design tokens to a UI change; inspect real exports, preserve native behavior, and verify accessibility." risk: none source: community date_added: "2026-02-27" metadata: version: "1.0.2"
Core Components
Design System Overview
Inspect the actual project component exports, token definitions and framework first. The names, $ tokens and props below illustrate an assumed local library; none is bundled here. Use its real documented API, preserve accessibility/native behavior and do not invent components/core imports or variantStyles. Reuse project primitives when appropriate rather than replacing valid native components solely to match this example.
Design Tokens
Prefer the project's existing semantic tokens. If no token expresses the requirement, document the exception or propose a scoped token addition; do not invent token names or change the whole design system.
Spacing Tokens
// CORRECT - Use tokens<Box padding="$4" marginBottom="$2" />// WRONG - Hard-coded values<Box padding={16} marginBottom={8} />
| Token | Value | |
|---|---|---|
$1 | 4px | |
$2 | 8px | |
$3 | 12px | |
$4 | 16px | |
$6 | 24px | |
$8 | 32px |
Color Tokens
// CORRECT - Semantic tokens<Text color="$textPrimary" /><Box backgroundColor="$backgroundSecondary" />// WRONG - Hard-coded colors<Text color="#333333" /><Box backgroundColor="rgb(245, 245, 245)" />
| Semantic Token | Use For | |
|---|---|---|
$textPrimary | Main text | |
$textSecondary | Supporting text | |
$textTertiary | Disabled/hint text | |
$primary500 | Brand/accent color | |
$statusError | Error states | |
$statusSuccess | Success states |
Typography Tokens
<Text fontSize="$lg" fontWeight="$semibold" />
| Token | Size | |
|---|---|---|
$xs | 12px | |
$sm | 14px | |
$md | 16px | |
$lg | 18px | |
$xl | 20px | |
$2xl | 24px |
Core Components
Box
Base layout component with token support:
<Boxpadding="$4"backgroundColor="$backgroundPrimary"borderRadius="$lg">{children}</Box>
HStack / VStack
Horizontal and vertical flex layouts:
<HStack gap="$3" alignItems="center"><Icon name="user" /><Text>Username</Text></HStack><VStack gap="$4" padding="$4"><Heading>Title</Heading><Text>Content</Text></VStack>
Text
Typography with token support:
<TextfontSize="$lg"fontWeight="$semibold"color="$textPrimary">Hello World</Text>
Button
Interactive button with variants:
<ButtononPress={handlePress}variant="solid"size="md"isLoading={loading}isDisabled={disabled}>Click Me</Button>
| Variant | Use For | |
|---|---|---|
solid | Primary actions | |
outline | Secondary actions | |
ghost | Tertiary/subtle actions | |
link | Inline actions |
Input
Form input with validation:
<Inputvalue={value}onChangeText={setValue}placeholder="Enter text"error={touched ? errors.field : undefined}label="Field Name"/>
Card
Content container:
<Card padding="$4" gap="$3"><CardHeader><Heading size="sm">Card Title</Heading></CardHeader><CardBody><Text>Card content</Text></CardBody></Card>
Layout Patterns
Screen Layout
const MyScreen = () => (<Screen><ScreenHeader title="Page Title" /><ScreenContent padding="$4">{/* Content */}</ScreenContent></Screen>);
Form Layout
<VStack gap="$4" padding="$4"><Input label="Name" {...nameProps} /><Input label="Email" {...emailProps} /><Button isLoading={loading}>Submit</Button></VStack>
List Item Layout
<HStackpadding="$4"gap="$3"alignItems="center"borderBottomWidth={1}borderColor="$borderLight"><Avatar source={{ uri: imageUrl }} size="md" /><VStack flex={1}><Text fontWeight="$semibold">{title}</Text><Text color="$textSecondary" fontSize="$sm">{subtitle}</Text></VStack><Icon name="chevron-right" color="$textTertiary" /></HStack>
Anti-Patterns
// WRONG - Hard-coded values<View style={{ padding: 16, backgroundColor: '#fff' }}>// CORRECT - Design tokens<Box padding="$4" backgroundColor="$backgroundPrimary">// Native components: valid when the project has no equivalent primitiveimport { View, Text } from 'react-native';// Project primitives: use only if these exports exist and preserve behaviorimport { Box, Text } from 'components/core';// WRONG - Inline styles<Text style={{ fontSize: 18, fontWeight: '600' }}>// CORRECT - Token props<Text fontSize="$lg" fontWeight="$semibold">
Component Props Pattern
When creating components, use token-based props:
interface CardProps {padding?: '$2' | '$4' | '$6';variant?: 'elevated' | 'outlined' | 'filled';children: React.ReactNode;}const Card = ({ padding = '$4', variant = 'elevated', children }: CardProps) => (<Boxpadding={padding}backgroundColor="$backgroundPrimary"borderRadius="$lg"{...variantStyles[variant]}>{children}</Box>);
Integration with Other Skills
- react-ui-patterns: Use core components for UI states
- testing-patterns: Mock core components in tests
- Existing project Storybook, if configured: document component variants; no
storybookskill or setup is bundled here.
When to Use
Use when implementing or adjusting UI in a repository with an existing component library or token system. For the specific ChrisWiles showcase conventions, inspect code-showcase-core-components; the two entries overlap and do not provide two different component libraries.
Worked example: adapt a settings form
Given a request to add an email field to an existing settings screen:
- Inspect the screen, component exports, token definitions and an existing validated field.
- Reuse the actual input API and semantic spacing/color tokens. The
onChangeTextand$4examples above apply only if the project defines them. - Preserve the visible label, error association, keyboard focus and submit behavior. Check light/dark contrast using the rendered result.
- Return the changed file paths, the existing components reused and the checks actually run. If the project has no such library, state that prerequisite instead of fabricating
components/coreimports.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.