OmniscioGuidesCLAUDE.md examplesReact Native
CLAUDE.md for a React Native project
This page is for an Expo app in TypeScript, which is what the file below is written for. A React Native repository is two codebases pretending to be one: the JavaScript an agent can read, and the native project it can only partly see. The file below draws the line between them, so a session does not fix a UI bug by editing a generated folder.
Every load-bearing block is explained underneath with the documentation it rests on, and the examples hub compares this file with the other eight stack guides if you want the shape first.
- The file, ready to copy.
- Why each block is there.
- What was left out, and why.
- Adapting it to bare React Native, Expo Router or a monorepo.
Checked against Anthropic's Claude Code documentation and React Native's, Expo's and Jest's own documentation on November 25, 2026. By the Omniscio team. Updated .
The file
This one describes a single Expo app that captures notes offline and syncs later. Save it as ./CLAUDE.md or ./.claude/CLAUDE.md in the app's root, next to app.json.
# field-notes Expo app (React Native, TypeScript) for capturing notes offline and syncing later. One app in the repository root; ios/ and android/ are generated, not source. ## Commands npm install npx expo start # Metro; press a or i to open a simulator npx expo run:android # development build against the native dirs npx expo run:ios # the same build for the simulator npx expo install expo-dev-client # add a library at the SDK-matched version npm test # Jest npm test -- -t "saves offline" # one test by name npx tsc --noEmit # type check npx expo lint ## Layout - app.json Expo config; every native setting lives here - src/screens/ one screen per route; imports no native module - src/components/ presentation; props in, callbacks out - src/lib/ plain TypeScript: money, dates, sync rules, the logger - src/native/ the only place a native module is imported - __mocks__/ one Jest mock per native module ## Rules - TypeScript strict. No any, and no @ts-expect-error without a reason. - Anything that reaches a native API goes through src/native/, never a screen. - Platform differences live in Button.ios.tsx and Button.android.tsx, imported as ./Button. A platform suffix in the import defeats the resolution. - src/lib/ imports nothing from react-native, so its files test without the RN preset or any native mock. - No console.log in a committed file; use the logger in src/lib. - A feature that needs a new native library is a development build, not Expo Go. ## Testing - Jest with the jest-expo preset (npx expo install jest-expo jest @types/jest --dev); component tests use React Native Testing Library. - A test that reaches a native module mocks it. Everything else uses the real object. - A test asserts what a user can see, not the shape of a style object. - A bug fix starts with a test that fails before the fix. ## Traps - ios/ and android/ are generated. Change a native setting in app.json, then run npx expo prebuild --clean; never hand-edit the generated folders. - Component tests run in Node. They cannot catch a bug in Swift, Kotlin or Java. - Dev mode is far slower than a release build. Never judge speed inside it. - npx expo run:ios starts the dev server itself; never also run npx expo start.
That is 53 lines. Everything an agent could learn by opening app.json or running the app once is deliberately absent.
Why each block is there
The first two lines
The opening says Expo and TypeScript because both change what a correct command looks like. React Native's documentation recommends a framework for a new app and says the best way to experience it is through one, so an app with a framework and an app without one do not share a command line, and the first line settles which this is.
The command block
Anthropic's guidance is that build commands are the kind of fact the file exists to hold, and that each one should be concrete enough to verify. npx expo start and npm test pass that test; "start the dev server" does not.
The start command is the one an agent gets wrong first. Expo's guide says the QR code or the a and i keys are what open the app on a device or simulator, and that a run command compiles the app, installs it and starts the development server itself, so the trap line stops an agent starting a second one.
The development-build line and the lint line are the two the app cannot do without. Expo documents a development build as your own version of Expo Go, where you can use any native library, documents npx expo install as the command that picks a version compatible with your project, and documents npx expo lint as the command that installs ESLint and writes the config the first time it runs.
The layout
Five directories, each carrying one rule an agent cannot infer from the folder name. The two that matter are src/native, the only place a native module is imported, and src/lib, which may not import React Native at all: that is what lets a test of a sync rule run without Metro and without a native mock.
Anthropic's size target is what keeps this list at six. A tree of the whole app is the quickest way to spend the budget on something an agent could have read.
The rules
The platform-file rule is the one that saves the most debugging. React Native's documentation says it detects a .ios. or .android. extension and loads the relevant file when another component requires it, and that it picks the right file from the running platform. An import that repeats the suffix skips that, and the app builds on one platform only.
The console.log rule comes from the performance guide, not from taste: it says those statements can cause a big bottleneck in the JavaScript thread in a bundled app, and asks you to remove them before bundling.
Testing
The preset is documented: Expo's unit-testing guide says to install and configure jest-expo after creating an Expo project, with npx expo install jest-expo jest @types/jest --dev. The Node fact is documented too, and it is the one an agent needs most: component tests are JavaScript tests running in Node.js and do not take into account the iOS or Android code behind the components.
The mocking rule names the case the same guide gives for a mock: a JavaScript unit test that relies on a native module written in Java or Objective-C. The naming of test files is left to Jest's defaults, which its documentation says are files in __tests__ folders and files ending .test or .spec.
Traps
A hand edit to ios/ is discarded by the next prebuild, which is why this line earns its place. Expo's development-build documentation describes prebuild creating the native directories and a clean run regenerating them.
The dev-mode line is quoted almost exactly from React Native's performance guide, which says JavaScript thread performance suffers greatly in dev mode and asks you to test performance in release builds. A session that measures a list's smoothness in the simulator will report a regression that does not exist.
What was left out, and why
- The screen list. It changes weekly, and an agent can read the router or the screens folder faster than it can read a stale copy.
- The dependency list. It is in
package.json. A copy here goes stale the first time somebody installs a library. - Design tokens and styling rules. They belong in the theme file the components already import, where a reviewer can see them enforced.
- The release and store-submission procedure. That is a multi-step process, and Anthropic's guidance is to keep it in a skill rather than in every session's context.
- A device name or a personal API host. Those are
CLAUDE.local.md, which you add to.gitignore. - "Write clean React code." Uncheckable, and paid for on every turn.
Adapting it
Three swaps cover most React Native repositories.
- Bare React Native instead of Expo. Replace the start, build and prebuild lines with the Community CLI's, and delete the generated-folders trap: without prebuild, the native projects are source. React Native's own guide for that path documents creating a project with the Community CLI and running Metro with
npm start. - A monorepo. Add the absolute path to each package's commands, and add one rule about which package owns the native one. Everything else carries over.
- The default template, which uses Expo Router. A fresh
npx create-expo-appproject keeps its screens insrc/app/; move them tosrc/screens/to match this file, or replace the screens line with the router's convention and keep the rule that a screen imports no native module.
Then prove it loaded. /context all lists the memory files read at launch, and a file that is missing from the list is not being ignored; it is not being seen.
How this page was written
The guidance on what belongs in a CLAUDE.md, how long it should be and how Claude treats it was read from Anthropic's Claude Code memory documentation on November 25, 2026. The statements about React Native, Expo and Jest were read from each project's own documentation the same day, and every one is linked in the Sources below.
The example file was written for this page and has not been run against a live app. It is a starting point whose every command you should check against your own package.json before keeping it.
Sources
- Anthropic's How Claude remembers your project, for what belongs in a CLAUDE.md, the size target, the concreteness rule and the conflict rule, read November 25, 2026.
- React Native — Get started, for the framework recommendation and the framework-free alternative, read November 25, 2026.
- React Native — Get started without a framework, for the Community CLI and how Metro is started, read November 25, 2026.
- React Native — Platform-specific code, for how a platform file is resolved, read November 25, 2026.
- React Native — Testing overview, for the Jest preset, what component tests can see and when to mock, read November 25, 2026.
- React Native — Performance, for the JavaScript thread, dev-mode speed and
console.log, read November 25, 2026. - Expo — Start developing, for
npx expo startand opening on a device or simulator, read November 25, 2026. - Expo — Development builds, for what a development build is and when it is needed, read November 25, 2026.
- Expo — Using libraries, for
npx expo install, read November 25, 2026. - Expo — Using ESLint, for
npx expo lint, read November 25, 2026. - Jest — Configuration, for the test-file patterns Jest looks for, read November 25, 2026.
Common questions
What should a CLAUDE.md for a React Native project contain?
The commands that start Metro, build a development client and run the tests, the rule for how platform-specific files are found, where native modules may be imported, and the traps: generated native folders, tests that run in Node and cannot see native bugs, and dev-mode performance. Anthropic's target is under 200 lines, so anything Claude can read from app.json stays out.
Should the file tell Claude to use Expo or bare React Native?
Name the one your repository uses, in the first line. React Native's own documentation says the best way to experience it is through a framework and recommends one for a new app, while still documenting the framework-free path with the Community CLI. A session that has to guess will mix commands from both.
Why do my platform-specific files never load?
Because the import names the platform. React Native loads Button.ios.tsx or Button.android.tsx when you import ./Button, and the documentation says it picks the right file from the running platform. An import written as ./Button.ios skips that mechanism and breaks every other platform.
Should I edit the ios and android folders by hand?
Not in an Expo project that generates them. Expo regenerates those directories from app.json when you run prebuild, and its documentation says a clean prebuild is what you run after changing native configuration or installing a native library. Put the setting in app.json so the next generation keeps it.
Write CLAUDE.md once, and every agent reads it
Omniscio keeps your canonical CLAUDE.md or AGENTS.md mirrored to the filenames Codex, Gemini, Cursor and Copilot look for, and flags a copy that was edited outside it. Any model, any harness.
The features page covers what else it does, pricing covers the plans, and you can download it for Windows, macOS or Linux.