react-native-boilerplate
CLAUDE.md517 starsChanged 15 months agoMITView on GitHub
This React Native Expo project follows specific patterns and uses built-in features for consistency and reusability. Technology Stack:
- Reads credentials
In this repositoryOne other file it gives its agents.
- .cursor/rules/coding-guidelines.mdcCursor rule
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
41 rules. About 0 are common, 32 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈32
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Never hardcode values that should come from configuration
- Distinctive: line 29
Always use theme system instead of hardcoded styles
- Very specific: line 41
Use useAppSlice for accessing global state
- Distinctive: line 42
Keep local state minimal, prefer global state for shared data
- Distinctive: line 47
Never make direct API calls from components
- Distinctive: line 48
Use the services layer for data transformation
- Distinctive: line 53
Always define component prop interfaces
- Distinctive: line 54
Use strict TypeScript - project is configured for it
- Distinctive: line 77
Use function declarations (not arrow functions)
- Distinctive: line 78
Place hooks at the top
- Distinctive: line 79
Use early returns for conditional rendering
- Very specific: line 80
Use StyleSheet.create for styles
- Very specific: line 101
Check if similar component exists in components/elements
- Distinctive: line 102
Use existing built-in features instead of creating new ones
- Distinctive: line 103
Import theme colors instead of hardcoding
- Distinctive: line 104
Use TypeScript interfaces for all props
- Distinctive: line 105
Write tests for all new components
- Distinctive: line 109
Use Redux Toolkit for global state
- Very specific: line 110
Use useAppSlice for state operations
- Distinctive: line 111
Keep component state local only when not shared
- Distinctive: line 112
Use built-in hooks for common functionality
- Very specific: line 116
Always import from @/theme/colors
- Very specific: line 117
Use StyleSheet.create for performance
- Distinctive: line 118
Use platform-specific styles when needed
- Distinctive: line 124
Test behavior, not implementation
- Distinctive: line 125
Use descriptive test names
- Distinctive: line 130
Use flat config format (already configured)
- Distinctive: line 131
Keep route files minimal - delegate to scene components
- Very specific: line 132
Use <Redirect> for programmatic navigation
- Distinctive: line 138
Always handle loading and error states
- Distinctive: line 140
Keep functions focused and small
- Distinctive: line 145
Reuse First: - Always check existing components and utilities before creating new ones
- Distinctive: line 146
Follow Patterns: - Use established patterns in the codebase
- Distinctive: line 148
Type Safety: - Use TypeScript strictly for better code quality
- Distinctive: line 149
Test Everything: - Write tests for all components
- Distinctive: line 150
Stay Consistent: - Follow naming conventions and code structure
- Very specific: line 232
Check existing components in components/elements for similar functionality
- Very specific: line 233
Use built-in utilities from utils/, @/theme, and @/hooks
- Distinctive: line 234
Follow the established patterns in the codebase
- Distinctive: line 235
Prefer extending existing components over creating new ones
- Distinctive: line 236
Always use the theme system for consistent UI
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
Claude AI Development Guide
This React Native Expo project follows specific patterns and uses built-in features for consistency and reusability.
Project Context
Technology Stack:
- React Native with Expo SDK 54
- TypeScript (strict mode)
- Expo Router v6 (flat config)
- Redux Toolkit for state management
- ESLint 9 with flat config
- React 19.1 and React Native 0.81.4
Always Use These Built-in Features
Configuration & Environment
utils/config.ts- For all environment variables and app configurationutils/deviceInfo.ts- For platform detection, screen dimensions, and device info- Never hardcode values that should come from configuration
Theme & Styling
@/theme/colors- For all color values (supports dark/light mode)@/theme/fonts- For font loading and typography@/theme/images- For image assets and loading- Always use theme system instead of hardcoded styles
Custom Hooks (Reuse These)
useColorSchemefrom@/hooks- For dark/light theme detectionuseDataPersistfrom@/hooks- For local storage operationsuseKeyboardfrom@/hooks- For keyboard state managementuseAppSlicefrom@/slices- For global state operations
State Management
- Redux Toolkit slices in
@/slices- For all global state - Use
useAppSlicefor accessing global state - Keep local state minimal, prefer global state for shared data
Services & API
@/services- For all API calls and external integrations- Never make direct API calls from components
- Use the services layer for data transformation
Type Definitions
@/types- For all TypeScript interfaces and types- Always define component prop interfaces
- Use strict TypeScript - project is configured for it
Directory Structure
app/ # Expo Router routes (keep minimal, delegate to scenes)
components/
elements/ # Reusable UI components (Button, Image, etc.)
layouts/ # Layout-specific components (headers, navigation)
scenes/ # Screen components (main UI logic)
hooks/ # Custom React hooks
slices/ # Redux Toolkit slices
services/ # API and external services
theme/ # Colors, fonts, styling system
types/ # TypeScript type definitions
utils/ # Utility functions (config, deviceInfo)Component Development Patterns
Component Structure
- Define TypeScript interface for props
- Use function declarations (not arrow functions)
- Place hooks at the top
- Use early returns for conditional rendering
- Use
StyleSheet.createfor styles - Export default at bottom
Import Order
- React and React Native
- Third-party libraries
- Internal imports with
@/paths - Relative imports
File Naming
- Components: PascalCase (
Button.tsx) - Hooks: camelCase with "use" prefix (
useColorScheme.ts) - Utils: camelCase (
deviceInfo.ts) - Types: PascalCase (
User.ts)
Development Guidelines
When Creating Components
- Check if similar component exists in
components/elements - Use existing built-in features instead of creating new ones
- Import theme colors instead of hardcoding
- Use TypeScript interfaces for all props
- Write tests for all new components
State Management Rules
- Use Redux Toolkit for global state
- Use
useAppSlicefor state operations - Keep component state local only when not shared
- Use built-in hooks for common functionality
Styling Rules
- Always import from
@/theme/colors - Use
StyleSheet.createfor performance - Use platform-specific styles when needed
- Support dark/light mode through theme system
Testing Requirements
- One test file per component
- Test behavior, not implementation
- Use descriptive test names
- Mock external dependencies
Navigation (Expo Router v5)
- Use flat config format (already configured)
- Keep route files minimal - delegate to scene components
- Use
<Redirect>for programmatic navigation - Handle deep linking through router
Code Quality Standards
- No
console.login production code - Always handle loading and error states
- Write self-documenting code
- Keep functions focused and small
- Use TypeScript strictly
Key Development Principles
- Reuse First - Always check existing components and utilities before creating new ones
- Follow Patterns - Use established patterns in the codebase
- Use Built-ins - Leverage project's built-in features (theme, hooks, utils)
- Type Safety - Use TypeScript strictly for better code quality
- Test Everything - Write tests for all components
- Stay Consistent - Follow naming conventions and code structure
Common Utilities Available
Device & Platform
// From utils/deviceInfo.ts
import { isIos, isAndroid, windowWidth, windowHeight } from '@/utils/deviceInfo';Configuration
// From utils/config.ts
import config from '@/utils/config';
// Access env and apiUrlTheme
// From @/theme
import { colors, loadFonts, loadImages } from '@/theme';Hooks
// From @/hooks
import useColorScheme from '@/hooks/useColorScheme';
import { useDataPersist } from '@/hooks';Architecture Notes
- Project upgraded to Expo SDK 54
- Using React 19.1 with React Native 0.81.4
- ESLint 9 with flat config
- Directory "pages" was renamed to "scenes"
- TypeScript strict mode enabled (v5.9.2)
- Custom theme system with dark/light support
- SafeAreaView imported from react-native-safe-area-context (not React Native)
- Required peer dependencies: @expo/metro-runtime, react-native-worklets
Available Scripts
Development Commands:
npm run dev- Start Expo development server for all platforms with cache clearednpm run dev:ios- Start development server for iOS simulator onlynpm run dev:android- Start development server for Android emulator onlynpm run dev:web- Start development server for web browser onlynpm run dev:doctor- Run Expo diagnostics to check project health
Building & Deployment:
npm run dev:build:mobile- Build iOS (IPA) and Android (APK) using EAS Build for developmentnpm run dev:build:web- Export static web application todist/directorynpm run dev:serve:web- Serve the built web app locally (run afterdev:build:web)npm run dev:deploy:web- Build and deploy web app to EAS Hosting
Environment & Configuration:
npm run dev:secret:push- Upload environment variables from.env.devto EAS secretsnpm run dev:secret:list- List all environment variables stored in EASnpm run dev:config:public- Display current Expo configuration for debugging
Code Quality & Testing:
npm run lint- Run ESLint to check code quality and stylenpm run lint:staged- Run linting only on staged Git files (used in pre-commit)npm run format- Format code using Prettiernpm run test- Run Jest unit testsnpm run test:watch- Run Jest tests in watch mode for development
Git Hooks:
npm run prepare- Set up Husky Git hooks for pre-commit quality checks
When in Doubt
- Check existing components in
components/elementsfor similar functionality - Use built-in utilities from
utils/,@/theme, and@/hooks - Follow the established patterns in the codebase
- Prefer extending existing components over creating new ones
- Always use the theme system for consistent UI
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.

