react-native-boilerplate
AGENTS.md521 starsChanged 15 days agoMITView on GitHub
See README for setup and structure. Use Node ≥24 and npm ≥11. Run from the repository root. Each environment has its own env file and script prefix: Copy .env.<env>.example to create each file. Each environment uses its own EAS project through EXPOPROJECTID. The commands below use dev. Replace it with stg or prod for the other environments.
- Reads credentials
We split this AGENTS.md into the rules it gives an agent
37 rules. About 0 are common, 6 are distinctive, and 31 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
31
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Use Node ≥24 and npm ≥11.
- Distinctive: line 9
Verify rules against code.
- Very specific: line 10
Use manage-docs before editing README.md, AGENTS.md, or skills in .agents/skills.
- Very specific: line 11
Keep secrets out of git. Write variable names to .env.*.example only.
- Very specific: line 16
Import with @/, which maps to src/.
- Distinctive: line 18
Use function declarations for components.
- Very specific: line 20
Keep console.log out of production code.
- Very specific: line 24
Put screens in src/scenes/<name>/<Name>.tsx.
- Very specific: line 25
Put reusable controls in src/components/elements/.
- Very specific: line 27
Use Expo Router for navigation.
- Very specific: line 28
Import navigation helpers such as DrawerActions from expo-router/react-navigation.
- Very specific: line 29
Use StyleSheet.create. Read colors, fonts, and images from @/theme.
- Very specific: line 31
Import SafeAreaView from react-native-safe-area-context.
- Very specific: line 35
Read app settings from @/utils/config.
- Very specific: line 36
Add a new environment variable in three places: .env.*.example, extra in app.config.ts, and src/utils/config.ts.
- Very specific: line 37
Treat values in extra as public.
- Very specific: line 38
Read platform and dimensions from @/utils/deviceInfo.
- Very specific: line 39
Use useAppSlice from @/slices for shared app state.
- Very specific: line 40
Use useDataPersist from @/hooks for local storage.
- Very specific: line 44
Call APIs through @/services.
- Very specific: line 45
Put each resource in src/services/<resource>.service.ts with <action><Resource>Async functions.
- Very specific: line 50
Add Expo and React Native packages with npx expo install <package> so versions match the SDK.
- Very specific: line 51
Run npm run dev:doctor after changing dependencies.
- Very specific: line 56
Place *.test.tsx beside each new component.
- Very specific: line 57
Use React Native Testing Library.
- Very specific: line 58
Add a Maestro flow in .maestro/ for each new screen or user flow.
- Very specific: line 59
Start each flow with runFlow: subflows/launch.yaml.
- Distinctive: line 63
Run from the repository root.
- Very specific: line 74
Start: npm run dev. Use dev:ios, dev:android, or dev:web for one platform.
- Very specific: line 75
Check Expo setup: npm run dev:doctor.
- Very specific: line 88
Test: npm run test. Watch: npm run test:watch.
- Very specific: line 89
Run E2E flows: npm run e2e or npm run e2e:android.
- Distinctive: line 93
Run only requested Git operations.
- Very specific: line 94
Never commit directly to dev, stg, or main.
- Distinctive: line 95
Keep each branch and commit focused.
- Very specific: line 100
Use dev for development, stg for staging, and main for production.
- Very specific: line 125
After a hotfix reaches main, merge main back into stg and dev with merge commits.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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
React Native Boilerplate Rules
See README for setup and structure.
Use Node ≥24 and npm ≥11.
Before Editing
- Verify rules against code. Correct outdated rules.
- Use
manage-docsbefore editingREADME.md,AGENTS.md, or skills in.agents/skills. - Keep secrets out of git. Write variable names to
.env.*.exampleonly.
Code
- Reuse existing components, hooks, and utilities.
- Import with
@/, which maps tosrc/. Keep TypeScript strict. - Export props of reusable elements as
interface <Component>Props. Import shared types from@/types. - Use function declarations for components. Call hooks before early returns.
- Name components and types in PascalCase. Name utilities in camelCase. Prefix hooks with
use. - Keep
console.logout of production code.
Screens and Styles
- Put screens in
src/scenes/<name>/<Name>.tsx. Keepsrc/app/files limited to routing and layouts. - Put reusable controls in
src/components/elements/. Put navigation and sheet layouts insrc/components/layouts/. - Give each component its own folder with
<Name>.tsxand anindex.tsthat re-exports it. - Use Expo Router for navigation. Use
<Redirect>for rendered redirects. Userouter.pushorrouter.replacein event handlers. - Import navigation helpers such as
DrawerActionsfromexpo-router/react-navigation. Import themes fromexpo-router. Do not add@react-navigation/*packages. - Use
StyleSheet.create. Read colors, fonts, and images from@/theme. - Support dark and light mode with
useColorSchemefrom@/hooks/useColorScheme. - Import
SafeAreaViewfromreact-native-safe-area-context.
State and Configuration
- Read app settings from
@/utils/config. Do not hardcode environment values. - Add a new environment variable in three places:
.env.*.example,extrainapp.config.ts, andsrc/utils/config.ts. - Treat values in
extraas public. They ship inside the app bundle. - Read platform and dimensions from
@/utils/deviceInfo. - Use
useAppSlicefrom@/slicesfor shared app state. Add new state as a slice insrc/slices/and register it insrc/utils/store.ts. - Use
useDataPersistfrom@/hooksfor local storage. UseuseKeyboardfrom@/hooksfor keyboard state.
API Calls
- Call APIs through
@/services. Do not call APIs directly from components. - Put each resource in
src/services/<resource>.service.tswith<action><Resource>Asyncfunctions. Export it fromsrc/services/index.ts. - Handle loading and errors. Show readable error messages.
Dependencies
- Add Expo and React Native packages with
npx expo install <package>so versions match the SDK. - Run
npm run dev:doctorafter changing dependencies. - Load env files with
dotenvx run -f .env.<env>. Do not adddotenv-cli.
Tests
- Place
*.test.tsxbeside each new component. Test behavior, including success and failure. - Use React Native Testing Library. Await
renderand user events. Mock external dependencies. - Add a Maestro flow in
.maestro/for each new screen or user flow. Target elements bytestID. - Start each flow with
runFlow: subflows/launch.yaml.
Commands
Run from the repository root. Each environment has its own env file and script prefix:
| Environment | Env file | Prefix | ENV | EAS build profile |
| Development | .env.dev | dev | dev | development |
| Staging | .env.stg | stg | stg | staging |
| Production | .env.prod | prod | prod | production |
Copy .env.<env>.example to create each file. Each environment uses its own EAS project through EXPO_PROJECT_ID.
The commands below use dev. Replace it with stg or prod for the other environments.
- Start:
npm run dev. Usedev:ios,dev:android, ordev:webfor one platform. - Check Expo setup:
npm run dev:doctor. - Show loaded config:
npm run dev:config:public. - Build and run native apps locally:
npm run dev:run:iosornpm run dev:run:android. - Build with EAS:
npm run dev:build:mobile. It uploads.env.devto the EAS project first. - Build and deploy web:
npm run dev:deploy:web.prod:deploy:webdeploys to the production alias.
ios/ and android/ are generated and ignored by git. Delete them before <env>:run:* after changing env files or app.config.ts.
Checks
- Check types:
npm run check-types. - Lint:
npm run lint. - Rewrite formatting:
npm run format. - Test:
npm run test. Watch:npm run test:watch. - Run E2E flows:
npm run e2eornpm run e2e:android. They use.env.dev. Install the app withdev:run:*first and keep Metro running.
Git
- Run only requested Git operations.
- Never commit directly to
dev,stg, ormain. - Keep each branch and commit focused.
- Submit changes through a PR. Use
manage-prs.
Branches
Use dev for development, stg for staging, and main for production. dev is the default branch.
| Change | Branch | Start from | Merge into |
| Feature | feat/<name> | dev | dev |
| Fix | fix/<name> | dev | dev |
| Refactor | refactor/<name> | dev | dev |
| Dependencies, SDK | chore/<name> | dev | dev |
| Docs | docs/<name> | dev | dev |
| Staging | dev | — | stg |
| Release | stg | — | main |
| Production fix | hotfix/<name> | main | main, then stg and dev |
Commits
Use type(scope): description.
- Types:
feat,fix,docs,style,refactor,test,chore. - Scopes are optional:
deps,ios,android,web,ci. - The pre-commit hook runs lint, format, and tests on staged files.
Merge and Version
- Squash merge work branches into
dev. - Promote with merge commits: open a PR from
devtostg, test the staging build, then open a PR fromstgtomain. - After a hotfix reaches
main, mergemainback intostganddevwith merge commits. - Bump
versioninpackage.jsonondevbefore promoting a release. - Tag releases as
vMAJOR.MINOR.PATCHonmain. Usemanage-prsto publish them. - Increment major for Expo SDK upgrades and breaking changes, minor for features, and patch for fixes.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- init-projectSkill
- manage-docsSkill
- manage-prsSkill
- review-codeSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

