new-component
Create a design-system primitive in src/ui or a presentational feature component, with tokens, TEXT/TEST_ID, accessibility and a test. Use for any reusable UI element.
SKILL.md.claude/skills/new-component/SKILL.md
GitHubNew component
- Search
apps/mobile/src/ui/and the feature'scomponents/first; extend instead of duplicating. - Decide the layer:
src/ui/<Name>.tsx— dumb, no i18n of domain copy, no queries/stores, no money semantics. May import onlylib/. Export fromsrc/ui/index.ts.features/<f>/components/<Name>.tsx— may use i18n and view models, never queries.
- File shape (
.claude/rules/02-text-and-types.md): imports →TEXT→TEST_ID→LIMITS→ exported<Name>Props(readonly) → function declaration →StyleSheet.createfrom tokens at the bottom. - Props: ≤ 3 primitives, then one typed object; pass a view model, not a whole
Transaction. Money via<Money cents>, text via<Text>fromsrc/ui. - Accessibility: localised
accessibilityLabel, role, ≥ 44pt target, money read viaformatMoneyForSpeech,useReducedMotion()for animation, no colour-only meaning, works at 200% font scale. - Theme via
useTheme(); verify light and dark. - RNTL test: renders, fires its callback, exposes its label. ≤ 200 lines — split sub-components if larger.
pnpm check.