Install
openclaw skills install react-native-clean-patternManages end-to-end React Native Expo app lifecycle with strict Controller-View separation, type safety, RTL support, and optimized performance in coder79 eco...
openclaw skills install react-native-clean-patternA unified, intelligent guide for building and maintaining high-performance mobile applications within the Clawhub ecosystem.
Add this directory to your agent's skill path.
Ensure you have the following global dependencies installed:
npm install -g expo-cli eas-cli react-native-clean-pattern
OR
bun clawdhub install react-native-clean-pattern
/provision-app
/make-screen
/make-component
/setup-api
/setup-navigation
Follow these steps for any task in the Clawhub ecosystem:
@shared components or @hooks.getStyles using the useAppStyle() hook for RTL-compliance. Use HSL tokens from @styles/common.controller.ts, utilizing @hooks/useRedux and @services/apiClient.mountedRef is used in all async controllers to prevent Memory Leaks.npx tsc --noEmit and check RTL/LTR UI toggle.Standardized, strictly typed, and RTL-ready folder architecture. All files must be interconnected via aliases.
.
├── app/ # Expo Router (routes & layouts)
├── screens/ # Feature-specific implementations (MVC-Lite)
├── components/ # Distributed Atom/Molecule components
│ ├── [RegularComponent]/ # Regular/Feature components (e.g., DynamicIsland)
│ └── SharedComponent/ # Global blessed component library (@shared)
├── services/ # Infrastructure (API, Auth, Firebase, Storage)
├── store/ # State Management (Redux Power Slices)
├── hooks/ # Custom logical hooks (@hooks)
├── helpers/ # Shared pure logic & utilities (@helpers)
├── enums/ # Global Constants & Types (@enums)
├── styles/ # Design Token System (@styles)
├── i18n/ # Localization assets (@i18n)
└── assets/ # Media & Fonts (@assets)
Never use relative paths (../../). Always use:
@shared, @services, @hooks, @store, @helpers, @config, @styles, @enums.
@enums)Use these enums to ensure zero string-literal errors across the app.
| Enum | Key Values |
|---|---|
AuthScreen | LOGIN, REGISTER, FORGOT_PASSWORD, OTP_VERIFY |
ValidationRule | REQUIRED, EMAIL, MIN_LENGTH, MATCH |
UserType | USER, VENDOR, ADMIN, DELIVERY_BOY |
TokenKey | ACCESS_TOKEN, REFRESH_TOKEN, FCM_TOKEN |
@hooks)| Hook | Responsibility |
|---|---|
useAppDispatch / useAppSelector | Strictly typed Redux access. |
useRTL | Manages I18nManager force-flipping and app reloads. |
useAppStyle | Dynamic UI pipe that merges base themes with remote config, resolves RTL directionality (rowDirection, textAlign), and provides centralized design tokens and localized font resolution. |
useAppConfig | Reactive access to merged Local/Remote Config. |
useColorScheme | Reactive system theme detection (Light/Dark mode). |
useNotifications | Orchestrates FCM registration, Notifee channel management, and real-time state rehydration (Profile/Theme) upon receipt of push payloads. |
@config)Environment-driven, strictly typed central config:
.env variables via process.env.AppConfig interface.@services/apiClient)Singleton wrapper with:
Accept-Language headers.JSON and FormData.@services/authService)Orchestrator for Login, Register, OTP, and Profile management with:
EMAIL_PASSWORD, EMAIL_OTP, and PHONE_OTP.@services/firebaseService)Platform-aware initialization for Expo Go and Development Builds.
@services/notificationService)Management of paginated alert listing and "read" state synchronization.
@services/tokenStorage)Encrypted or AsyncStorage persistence for tokens and user metadata.
@helpers/logger)Sensitized logging system with:
password, token, authorization, otp).request(), response(), and error() tracing with latency tracking.addBreadcrumb and captureException.__DEV__) with terminal icons (🌐, ✅, ❌, 🔴, ℹ️, ⚠️).@i18n)RTL-First standard with:
i18next with compatibilityJSON: 'v3' for React Native safe pluralization.AsyncStorage usage to remember language selection across reloads.initializeI18n() async boot sequence required in _layout.tsx.I18nManager force-flip with expo-updates reload (try/catch protected).store directly into the i18n instance.expo-updates for mandatory UI rehydration on direction change.setupRTL() boot helper to maintain state consistency.@store)Strictly typed state management with:
useAppDispatch and useAppSelector for type-safe state access.| Component | Purpose | Key Props |
|---|---|---|
AppText | Typography with RTL font scaling. | variant, weight, align |
Button | Themed touchable with loading states. | title, loading, icon, variant |
AppHeader | RTL-aware screen header with back/actions. | title, showBackButton, rightComp |
AppInput | Validated text input with icons. | label, error, icon, secure |
PriceTag | Currency-aware formatted price display. | price, originalPrice, discount |
AppLoader | Lottie-powered full-screen or inline loading. | visible, variant, message |
AppModal | Standardized bottom-sheet or center popup. | visible, onClose, title |
Implemented as isolated folders under screens/ following MVC-Lite:
expo@~55.0.5, react@19.2.0, react-native@0.83.2.@react-navigation/native, @react-navigation/native-stack, @react-navigation/bottom-tabs.
key remounting.@reduxjs/toolkit@^2.11.2, react-redux@^9.2.0.@react-native-firebase/app, @react-native-firebase/messaging.@react-native-async-storage/async-storage@^2.2.0.i18next@^25.8.16, react-i18next@^16.5.6, expo-localization.lottie-react-native@~7.3.4, react-native-reanimated@4.2.1, react-native-render-html.react-native-maps, react-native-maps-directions, expo-location.@expo-google-fonts/cairo, @expo-google-fonts/outfit, @expo-google-fonts/roboto.@sentry/react-native@~7.11.0.@notifee/react-native, expo-image-picker, expo-document-picker.Every new screen, feature, OR shared component MUST consist of exactly 4 files:
index.tsx (Skin): Pure JSX. Connects to controller.ts.controller.ts (Brain): logic hook, utilizes @hooks/useRedux.styles.ts (Nerves): Function-based styles consuming useAppStyle.types.ts (Structure): Interface definitions. Zero any.isMounted ref in controllers. Abort all API calls in useEffect cleanup.@hooks or @helpers. Don't copy-paste styles; use @styles/common. Hard Requirement: All sizes, spacing, and colors must be consumed via useAppStyle().tokens and useAppStyle().colors.#FFFFFF) or RGBA strings in UI components is FORBIDDEN. All UI colors must be resolved from the colors object provided by the central styling hook.style={{ ... }} prop in JSX is FORBIDDEN for layout and presentation. All styles MUST be defined in the accompanying styles.ts file and resolve via the screen/component controller to ensure theme and RTL reactivity.src/config/index.ts and consumed via @constants/Colors.ts to support white-labeling and remote branding.rowDirection and textAlign from useAppStyle.password or token.../../) are forbidden.
@/, @components, @hooks, @constants, @store, @i18n, @assets, @config, @app-types, @enums, @utils, @helpers, @services, @screens, @styles.npx tsc --noEmit passes with zero errors.@styles/common.mountedRef safety.When starting a NEW application, you must follow this interactive training flow to ensure architectural integrity without merely copy-pasting old classes.
You MUST ask the user for authorization to implement:
app/_layout.tsx: Master orchestrator (Sentry, Redux, RTL, Hydration).app/(auth): Auth flow group (Login, Register, OTP).app/(tabs): Main application navigation.Instead of copying files, generate fresh implementations based on these patterns:
Login, Register, OTP) gets its own Skin, Brain, Nerves, and Structure.apiClient.ts and authService.ts.package.json, tsconfig.json, and app.json.npm install or bun install to pull the Approved Dependency Matrix..env file from the .env.example template.npx expo start to verify the baseline.Use these commands to automate common development tasks within the Clawhub ecosystem:
| Command | Purpose | When to Use |
|---|---|---|
/provision-app | Initialize Project | Starting a new app from scratch. |
/setup-api | API & Observability | Adding a production-grade apiClient.ts and logger.ts. |
/setup-navigation | Router Setup | Scaffolding Root (Auth) and Main (Dynamic Tab) navigators. |
/make-screen | Feature Scaffolding | Creating a new screen using the 4-file MVC-Lite pattern. |
/make-component | UI Scaffolding | Creating a new Shared, Regular, or Local component. |