react native clean architecture

    1

    Architect and build production-ready React Native apps using a domain-driven Clean Architecture.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    react native clean architecture

    Example session with this skill installed

    Create a new domain for 'Weather' that fetches data from an API and uses geolocation. Follow the clean architecture structure.

    • Read your context and instructions
    • Compiled the react native clean
    • Generated the UI component

    I have created the Weather domain following the Clean Architecture contract. This includes a native geolocation adapter in shared, a weather service in domains, and the UI composition in app.

    Weather Domain Implementation

    src/shared/native/location.ts

    import * as Location from 'expo-location';
    
    export const getCurrentPosition = async () => {
      const { status } = await Location.requestForegroundPermissionsAsync();
      if (status !== 'granted') {
        throw new Error('Permission to access location was denied');
      }
      return await Location.getCurrentPositionAsync({});
    };
    

    src/domains/weather/services/weatherService.ts

    import { getCurrentPosition } from '@/shared/native/location';
    
    export interface WeatherData {
      temp: number;
      condition: string;
    }
    
    export const fetchLocalWeather = async (): Promise<WeatherData> => {
      const pos = await getCurrentPosition();
      const response = await fetch(`https://api.example.com/weather?lat=${pos.coords.latitude}&lon=${pos.coords.longitude}`);
      if (!response.ok) throw new Error('Weather API failure');
      return response.json();
    };
    

    src/domains/weather/components/WeatherCard.tsx

    import React from 'react';
    import { View, Text } from 'react-native';
    import { useQuery } from '@tanstack/react-query';
    import { fetchLocalWeather } from '../services/weatherService';
    
    export const WeatherCard = () => {
      const { data, isLoading, error } = useQuery({ 
        queryKey: ['weather'], 
        queryFn: fetchLocalWeather 
      });
    
      if (isLoading) return <Text>Loading weather...</Text>;
      if (error) return <Text>Error loading weather</Text>;
    
      return (
        <View className="p-4 bg-blue-100 rounded-lg">
          <Text className="text-xl font-bold">{data?.temp}°C</Text>
          <Text>{data?.condition}</Text>
        </View>
      );
    };
    

    Next steps

    1. Add expo-location to your dependencies using npx expo install.
    2. Register the WeatherCard in your src/app/(tabs)/index.tsx layout.
    3. Configure the Location permissions in your app.json for iOS and Android.

    WeatherCard.tsx

    TSX · React component

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Mobile applications often devolve into a "spaghetti" of mixed concerns where UI components handle API calls, business logic, and native device permissions. This skill enforces a strict Clean Architecture for React Native and Expo projects, separating responsibilities into domain-driven folders to ensure long-term maintainability.

    What it does

    • Enforces architectural boundaries by organizing code into src/app, src/domains, and src/shared to isolate business logic from UI and infrastructure.
    • Manages native integrations for geolocation, biometrics, camera, and notifications through platform-aware adapters that handle iOS and Android differences.
    • Standardizes state and data using proven patterns with TanStack Query, Zustand, and React Hook Form without over-engineering simple features.
    • Automates environment audits by checking Expo SDK versions, native module compatibility, and project configurations like app.json or eas.json.
    • Guides deployment workflows including EAS Build, App Store/Google Play submission, and OTA update configurations.

    How it works

    1. Inspection. The agent scans your package.json, app.json, and directory tree to identify the Expo SDK version and navigation setup.
    2. Classification. It determines if the task is a new project, a feature addition, a native integration, or a structural refactor.
    3. Implementation. It writes functional code across the domain layers, including UI, hooks, and native adapters with proper error and permission handling.
    4. Validation. It runs expo-doctor, type checks, and linting to ensure the new code doesn't break the build or violate architectural constraints.

    Frameworks & tools

    React Native, Expo SDK (including Expo Router and CNG), TypeScript, TanStack Query, Zustand, React Hook Form, Zod, and EAS.

    Why this beats prompting it yourself

    Generic prompts often result in flat folder structures or logic-heavy components that are hard to test. This skill follows a rigorous domain-functional-responsibility hierarchy that prevents secrets from leaking into logs and keeps your app ready for native prebuilds and automated testing.

    Use cases

    • Scaffold a new Expo project with strict TypeScript and domain-based folder structures.
    • Add a secure biometric authentication flow with proper platform-specific fallbacks.
    • Refactor a bloated component by extracting business logic into domain services and shared native adapters.
    • Prepare and audit a project for EAS production builds and store submission.

    Known limitations

    Does not perform live execution on physical devices or simulators. It cannot access .env files, keystores, or private credentials for security reasons.

    No live execution on physical devices. Cannot access .env files, keystores, or private credentials. Skips rewriting functional code unless explicitly requested.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 5 days ago

    • Free with an Agensi account

    Requires

    expo
    Node.js
    create-expo-module
    expo-doctor
    tsc
    jest
    install-expo-modules
    uri-scheme
    madge
    create-expo-app
    macOS only

    Permissions

    Network Access
    Write Files
    Environment Variables

    Allowed Hosts

    api.example.com
    Listed5 days ago

    What's inside

    Frequently Asked Questions

    This skill implements a strict separation of concerns by organizing your project into `app`, `domains`, and `shared` layers, preventing business logic from becoming tangled with UI components and native APIs.

    The skill is optimized for the latest Expo SDKs, including support for Expo Router, Continuous Native Generation (CNG), and EAS, though it also functions effectively for bare React Native CLI projects.

    Yes, it is designed to manage complex native features like biometrics, geolocation, and notifications by creating platform-aware adapters that handle iOS/Android differences and permission logic automatically.

    It utilizes a modern stack including TypeScript, TanStack Query for data fetching, Zustand for state management, and Zod for schema validation to ensure type safety across all architectural layers.

    You receive the full architectural logic and domain-driven patterns for the AI agent, allowing it to scaffold, refactor, and audit your mobile projects directly within your AI chat environment.

    While it can architect your entire deployment workflow for EAS and store submissions, it cannot access private credentials, .env files, or execute builds on a physical device for security reasons.

    New in Mobile Development