Repository navigation
Add AGENTS.md #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add AGENTS.md #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # AGENTS.md | ||
|
|
||
| This is a React Native app created with the React Native Community CLI. | ||
|
|
||
| It does not include Expo: `npx expo` commands and `expo-*` packages need `npx install-expo-modules` first, so don't use them unless asked. | ||
|
|
||
| ## Commands | ||
|
|
||
| Use the package manager whose lockfile is present. With npm: | ||
|
|
||
| ```sh | ||
| npm start # Start Metro; runs in the foreground until stopped | ||
| npm run ios # Build and launch the iOS app | ||
| npm run android # Build and launch the Android app | ||
| npm test # Run Jest | ||
| npm run lint # Run ESLint | ||
| npx tsc --noEmit # Typecheck | ||
| ``` | ||
|
|
||
| Run lint, typecheck and tests before considering a change done. | ||
|
|
||
| Clean commands, only for a build that fails from stale state, such as after an upgrade or branch switch: | ||
|
|
||
| ```sh | ||
| (cd android && ./gradlew clean) # Clean the Android build | ||
| rm -rf ios/Pods # Remove CocoaPods; `npm run ios` reinstalls them | ||
| npm run ios:clear-prebuild-caches # Clear cached React Native iOS prebuilds | ||
| npm start -- --reset-cache # Start Metro with its cache cleared | ||
| ``` | ||
|
|
||
| ## Rules | ||
|
|
||
| - `ios/` and `android/` are source code, edited directly and committed, not generated. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the first two lines are needed. This is known by LLMS for sure by now. |
||
| - JavaScript and TypeScript changes reach a running app through Fast Refresh. Native changes, and adding or removing packages with native code, need a rebuild. | ||
| - Check APIs against the docs for the React Native version in `package.json` ([reactnative.dev](https://reactnative.dev/docs/getting-started)). Many examples online use deprecated APIs, such as `SafeAreaView` from `react-native`; use `react-native-safe-area-context` instead. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow up to consider: Would be better if all APIs are documented inside the repo instead like what we did with Metro. |
||
| - Write native code as [Turbo Native Modules](https://reactnative.dev/docs/turbo-native-modules-introduction) or [Fabric Native Components](https://reactnative.dev/docs/fabric-native-components-introduction), not the legacy `NativeModules` or `requireNativeComponent` APIs. Use Nitro Modules or the Expo Modules API only when asked. | ||
|
|
||
| ## Native libraries | ||
|
|
||
| - Find third-party libraries on [React Native Directory](https://reactnative.directory/), and prefer maintained ones that support the New Architecture. | ||
| - Never downgrade React Native, or install with `--force` or `--legacy-peer-deps`, to fit a library. Choose a library version whose `react-native` peer dependency matches, or tell the user when none does. | ||
|
|
||
| ## Upgrading | ||
|
|
||
| - To upgrade React Native, apply the diff from the [Upgrade Helper](https://react-native-community.github.io/upgrade-helper/), or use the [upgrade-react-native](https://www.skills.sh/react-native-community/skills/upgrade-react-native) skill (recommended), not only the version bumps in `package.json`. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this is too trivial to be added to AGENTS.md.
Making sure we have a clear
package.jsonlist of commands should make it redundant, for this end let's consider addingnpm run clearthat does whatever is mentioned below.