Rn architecture
Skill almasumdev/awesome-react-native-agent-skills/.github/skills/architecture/rn-architecture
Curated agent skills, conventions, and workflows for building React Native apps with AI coding agents.
npx -y skills add almasumdev/awesome-react-native-agent-skills --skill rn-architectureAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Expert guidance on structuring a React Native 0.75+ app with a feature-sliced layout, New Architecture (Fabric + TurboModules) enabled, and strict TypeScript. Use this when asked about project structure, folder layout, or module boundaries.
SKILL.md
4.1 KB, as published. Nobody here has run it
React Native Architecture & Feature Slicing
Instructions
When designing or refactoring a React Native application, prefer a feature-sliced folder structure with strict dependency direction: app → features → shared → domain. The New Architecture (Fabric + TurboModules, Hermes, bridgeless mode) is the default target.
1. Top-Level Layout
src/
├── app/ # Root providers, navigation container, entry point
│ ├── App.tsx
│ ├── providers/ # QueryClient, ThemeProvider, GestureHandlerRootView
│ └── navigation/ # RootStackParamList, linking config
├── features/ # Self-contained feature slices
│ └── articles/
│ ├── api/ # TanStack Query hooks, repository bindings
│ ├── model/ # Zustand stores, derived selectors
│ ├── ui/ # Screens and feature-scoped components
│ └── index.ts # Public API of the slice (barrel)
├── shared/ # Cross-cutting: ui kit, hooks, utils
│ ├── ui/
│ ├── hooks/
│ └── lib/
├── domain/ # Pure TS: entities, Zod schemas, use-cases
└── infrastructure/ # Platform adapters: storage, http, logger
Rules:
- A
featurenever imports from anotherfeature. If two features share logic, promote it toshared/ordomain/. domain/has zero React or React Native imports. Enforce with an ESLintno-restricted-importsrule.- Use TypeScript path aliases (
@app/*,@features/*,@shared/*,@domain/*) intsconfig.jsonand mirror them inbabel.config.jsviababel-plugin-module-resolver.
2. Enable the New Architecture
In android/gradle.properties:
newArchEnabled=true
hermesEnabled=true
In ios/Podfile:
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
Verify at runtime:
import { Platform } from 'react-native';
export const isFabric = (): boolean =>
// @ts-expect-error internal flag
global?.nativeFabricUIManager != null;
export const archInfo = {
fabric: isFabric(),
hermes: !!(globalThis as { HermesInternal?: unknown }).HermesInternal,
platform: Platform.OS,
} as const;
3. Typed Entry Point
src/app/App.tsx:
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { NavigationContainer } from '@react-navigation/native';
import { RootNavigator } from './navigation/RootNavigator';
import { ThemeProvider } from '@shared/ui/theme';
const queryClient = new QueryClient({
defaultOptions: { queries: { staleTime: 30_000, retry: 2 } },
});
export function App(): JSX.Element {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<QueryClientProvider client={queryClient}>
<ThemeProvider>
<NavigationContainer>
<RootNavigator />
</NavigationContainer>
</ThemeProvider>
</QueryClientProvider>
</GestureHandlerRootView>
);
}
4. Feature Barrels
Each feature exposes a tight public API:
// src/features/articles/index.ts
export { ArticlesScreen } from './ui/ArticlesScreen';
export { useArticles } from './api/useArticles';
export type { Article } from '@domain/articles';
Nothing else from features/articles/** should be imported outside the slice.
Checklist
-
newArchEnabled=trueand Hermes is on for both platforms. -
domain/contains zero React or React Native imports (enforced by ESLint). - Features do not import from sibling features.
- TypeScript path aliases are declared in both
tsconfig.jsonandbabel.config.js. -
tsconfig.jsonhasstrict,noUncheckedIndexedAccess, andexactOptionalPropertyTypesenabled. - Each feature exposes a single barrel
index.tswith only the public API.