expo_boilerplate / rules
Cursor rule34 starsChanged 5 months agoMITView on GitHub
Advanced Best Practices covering Error Handling, Environment Variables, Performance, and Accessibility rules
- Reads credentials
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,157 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 repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/app_feature_first_architecture.mdcCursor rule
- .cursor/rules/app_rules.mdcCursor rule
- mobilelauncherSkill
- spec-harness-auditSkill
- spec-harness-buildSkill
- spec-harness-generate-agentsSkill
- spec-harness-installSkill
- spec-harness-learnSkill
- spec-harness-planSkill
- spec-harness-rulesSkill
- spec-harnessSkill
- spec-harness-specSkill
- spec-harness-tasksSkill
- spec-harness-ticketsSkill
- spec-harness-verifySkill
The file
We split this best_practices.mdc into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 11
Never allow API failures to crash the app or fail silently.
- Very specific: line 12
When calling RTK Query mutations, handle .unwrap() errors or isRejectedWithValue reliably.
- Very specific: line 13
Use explicit try/catch and fire user-facing toasts (e.g., via react-native-toast-message) on failure.
- Very specific: line 21
Never use process.env scattered across components.
- Very specific: line 23
Never commit .env or credentials.
- Distinctive: line 29
Avoid passing massive objects to worklets.
- Very specific: line 32
Prefer Expo Image over standard React Native Image for aggressive caching and memory performance, especially in FlashList components.
- Distinctive: line 36
All UI elements must be accessible.
- Very specific: line 39
Use accessibilityState dynamically (e.g., selected, disabled) so screen readers announce correct context.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule 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
--- description: Advanced Best Practices covering Error Handling, Environment Variables, Performance, and Accessibility rules globs: **/*.ts, **/*.tsx --- # Advanced Best Practices ## 🔴 Error Handling & Observability ### 1. API Error Handling - Never allow API failures to crash the app or fail silently. - When calling RTK Query mutations, handle `.unwrap()` errors or `isRejectedWithValue` reliably. - Use explicit `try/catch` and fire user-facing toasts (e.g., via `react-native-toast-message`) on failure. ### 2. Global Error Boundaries - Since `react-native-error-boundary` is installed, ensure that any major rendering block is wrapped where appropriate. - Log fatal crashes to the logging service before presenting the fallback UI. ## 🟢 Environment Variables & Secrets - Never use `process.env` scattered across components. - Validate environment variables at startup. Use `zod` to schemas in a central config file (e.g., `src/config/env.ts`) so missing or invalid keys throw an immediate exception. - Never commit `.env` or credentials. Use `Expo Secure Store` for user session tokens or keys, never `MMKV` for sensitive data. ## 🚀 Performance & Reanimated ### 1. Animations with Reanimated 4 - Differentiate between the UI thread and the JS Thread. Use `runOnJS` when invoking state changes from a worklet. - Avoid passing massive objects to worklets; pick out primitive dependencies. ### 2. Image Loading - Prefer `Expo Image` over standard React Native `Image` for aggressive caching and memory performance, especially in `FlashList` components. ## ♿ Accessibility (A11y) All UI elements must be accessible. - Pass `accessibilityRole="button"` and `accessibilityLabel` to all custom touchables. - Account for scaling text. Since we use Restyle, configure typography variants to respect dynamic font types cleanly without breaking layout. - Use `accessibilityState` dynamically (e.g., `selected`, `disabled`) so screen readers announce correct context.
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.

