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

GitHub

New component

  1. Search apps/mobile/src/ui/ and the feature's components/ first; extend instead of duplicating.
  2. Decide the layer:
    • src/ui/<Name>.tsx — dumb, no i18n of domain copy, no queries/stores, no money semantics. May import only lib/. Export from src/ui/index.ts.
    • features/<f>/components/<Name>.tsx — may use i18n and view models, never queries.
  3. File shape (.claude/rules/02-text-and-types.md): imports → TEXT → TEST_ID → LIMITS → exported <Name>Props (readonly) → function declaration → StyleSheet.create from tokens at the bottom.
  4. Props: ≤ 3 primitives, then one typed object; pass a view model, not a whole Transaction. Money via <Money cents>, text via <Text> from src/ui.
  5. Accessibility: localised accessibilityLabel, role, ≥ 44pt target, money read via formatMoneyForSpeech, useReducedMotion() for animation, no colour-only meaning, works at 200% font scale.
  6. Theme via useTheme(); verify light and dark.
  7. RNTL test: renders, fires its callback, exposes its label. ≤ 200 lines — split sub-components if larger.
  8. pnpm check.