stack-react-native
Skill0 starsChanged 5 months agoApache-2.0View on GitHub
React Native implementation patterns for agents working in projects whose docs/TECH_STACK.md lists react-native. Load when implementing, testing, or reviewing code on this stack.
In this repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- flow-adoptionSkill
- flow-legacy-migrationSkill
- stack-awsSkill
- stack-azureSkill
- stack-design-systemSkill
- stack-gcpSkill
- stack-javaSkill
- stack-kafkaSkill
- stack-mongodbSkill
- stack-natsSkill
- stack-nestjsSkill
- stack-nextjs-reactSkill
- stack-nxSkill
- stack-playwrightSkill
- stack-postgresqlSkill
- stack-quarkusSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Platform splits via
.native.tsx: when web and mobile genuinely diverge, split at the leaf (component.tsx + component.native.tsx, resolved … - Very specific: line 72
All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Stack: React Native
Bare React Native vs Expo (and which e2e runner: Detox vs Maestro) is a PER-PROJECT choice — read the host's docs/ARCHITECTURE.md and docs/DEV_SETUP.md before assuming either. Shared React idioms (state coverage, typed-client consumption, registry discipline) come from skills/stack-nextjs-react/SKILL.md; this file adds what is mobile-specific.
When this applies
Detection markers (any of):
docs/TECH_STACK.md## Detected stackslistsreact-native- Dependencies:
react-native; optionallyexpo,@react-navigation/*,react-native-web - Files:
metro.config.{js,cjs,ts},app.json/app.config.*(Expo),ios/+android/directories, anapps/mobileproject in an Nx workspace
Implementation patterns
Nx monorepo integration
- The mobile app lives at
apps/mobile(or the host's declared equivalent —docs/ARCHITECTURE.mdwins). Mobile-specific libs follow the workspace's lib conventions and tags (seeskills/stack-nx/SKILL.md). - Shared-lib consumption rules: code consumed by mobile from
libs/shared/*must stay free of web-only dependencies — nonext, noreact-dom, no direct DOM/windowAPI usage. A shared lib that needs them is mis-layered; flag it, don't fork it. - Platform splits via
.native.tsx: when web and mobile genuinely diverge, split at the leaf (component.tsx+component.native.tsx, resolved by the bundler) — neverPlatform.OSbranching scattered through shared logic, and never a duplicated module tree.
Design-token consumption
- All colors, spacing, and typography come from
libs/design-systemtokens (per S6 of.claude/docs/DEFAULT_TARGET_ARCHITECTURE.md, unless host docs declare a stricter convention). Hardcoded hex values, magic pixel numbers, or per-screen style constants are violations — if a token is missing, that is a design-system gap to flag, not a license to inline.
Navigation & deep linking
- One navigator tree, with routes and params typed; every screen the spec declares is reachable via a declared route — no screens mounted ad-hoc outside the navigator.
- Deep links are declared in the central linking configuration (the navigation library's linking config / Expo
app.jsonschemes), never handled by ad-hoc URL parsing in components. A spec flow that enters mid-app implies a deep-link entry — wire it there.
State & data
- Reuse the
libs/sharedAPI clients and Zod schemas — the contract layer is shared with web and backend-owned; never hand-roll a fetch wrapper or redeclare a schema on the mobile side. - Handle every documented response shape explicitly and map each to the SPEC_
<FEATURE>.md §7.2 state, exactly as on web.
Offline / poor-network awareness
- Mobile runs on hostile networks; every mutating flow declares its behavior under failure/offline in the spec, and the implementation honors it: mutations carry idempotency keys so retries replay safely; a write either confirms, queues visibly, or fails visibly — silent dropped writes are a violation.
- Reads degrade per the spec's declared empty/error/offline states — never an infinite spinner.
testID registry discipline
- Mirrors the web
data-testidregistry: SPEC_<FEATURE>.md §7.3 declares the IDs; every interactive element carries its registeredtestID. Add none not in the registry; omit none from it. "Never query by visible text" (R-TESTE-02) applies identically to mobile e2e and component tests. testIDis for tests, NOT a substitute for accessibility — interactive elements also need an accessible name (accessibility label or visible text).
Testing on this stack
- Unit/component: React Native Testing Library for components and hooks — query by
testIDfrom the §7.3 registry, assert the §7.2 states. Pure logic (rules, formatters) belongs in shared libs and is tested there. - E2E: Detox or Maestro — which one, and the exact invocation, per
docs/DEV_SETUP.md. One UI-flagged AC = one e2e, namedAC-<FEATURE>-NN: <behavior>, thin-layer discipline per.claude/rules/TESTING_E2E.md. - Honesty note (environment limits): iOS e2e CANNOT run in docker — iOS simulators require macOS runners. Android emulator containers ARE possible. This is the documented partial exception to R-TESTE-06 (
.claude/rules/TESTING_E2E.md): when a platform's e2e cannot run in the session environment, state it explicitly, record which platform the observed RED/GREEN run covered, and never claim a run that did not happen.
Spec validation checks
Stack-specific checks the spec validators (spec-validate-ui, on SPEC_<FEATURE>.md §7 UI Behavior) delegate here:
| Check | Severity |
| Mobile surface declared in §7 without testID registry entries in §7.3 | BLOCKER |
Shared-lib change hidden inside a mobile task (a dev-mobile task whose scope touches libs/shared/* or libs/design-system without a task in the owning layer) | BLOCKER |
| Missing offline/poor-network behavior for mutating flows | WARNING |
| Missing platform-divergence note where web and mobile differ on the same flow | WARNING |
Live validation commands
R-VAL-03 matrix (mobile/UI changes) — exact invocations live in docs/DEV_SETUP.md; obligations:
| Check | Typical shape |
| Type-check + lint affected projects | nx affected -t typecheck lint per DEV_SETUP |
| Unit/component tests for affected projects | nx affected -t test per DEV_SETUP |
| Bundle build must succeed | metro bundle / expo export build target per DEV_SETUP |
| Exercise the change on a simulator/emulator or dev client | dev target per DEV_SETUP — golden path + at least one edge state |
| E2E (when the task references e2e tasks) | Detox/Maestro target per DEV_SETUP — iOS docker caveat above applies |
All rows must pass before commit per .claude/rules/LIVE_VALIDATION.md. If a row cannot run in this environment (iOS e2e off-macOS), report it explicitly in the handoff — an unrun check is never reported as passed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

