Web
react-native - Claude MCP Skill
React Native mobile patterns, platform-specific code
SEO Guide: Enhance your AI agent with the react-native tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to react native mobile patterns, platform-specific code... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# React Native Skill
*Load with: base.md + typescript.md*
---
## Project Structure
```
project/
āāā src/
ā āāā core/ # Pure business logic (no React)
ā ā āāā types.ts
ā ā āāā services/
ā āāā components/ # Reusable UI components
ā ā āāā Button/
ā ā ā āāā Button.tsx
ā ā ā āāā Button.test.tsx
ā ā ā āāā index.ts
ā ā āāā index.ts # Barrel export
ā āāā screens/ # Screen components
ā ā āāā Home/
ā ā ā āāā HomeScreen.tsx
ā ā ā āāā useHome.ts # Screen-specific hook
ā ā ā āāā index.ts
ā ā āāā index.ts
ā āāā navigation/ # Navigation configuration
ā āāā hooks/ # Shared custom hooks
ā āāā store/ # State management
ā āāā utils/ # Utilities
āāā __tests__/
āāā android/
āāā ios/
āāā CLAUDE.md
```
---
## Component Patterns
### Functional Components Only
```typescript
// Good - simple, testable
interface ButtonProps {
label: string;
onPress: () => void;
disabled?: boolean;
}
export function Button({ label, onPress, disabled = false }: ButtonProps): JSX.Element {
return (
<Pressable onPress={onPress} disabled={disabled}>
<Text>{label}</Text>
</Pressable>
);
}
```
### Extract Logic to Hooks
```typescript
// useHome.ts - all logic here
export function useHome() {
const [items, setItems] = useState<Item[]>([]);
const [loading, setLoading] = useState(false);
const refresh = useCallback(async () => {
setLoading(true);
const data = await fetchItems();
setItems(data);
setLoading(false);
}, []);
return { items, loading, refresh };
}
// HomeScreen.tsx - pure presentation
export function HomeScreen(): JSX.Element {
const { items, loading, refresh } = useHome();
return (
<ItemList items={items} loading={loading} onRefresh={refresh} />
);
}
```
### Props Interface Always Explicit
```typescript
// Always define props interface, even if simple
interface ItemCardProps {
item: Item;
onPress: (id: string) => void;
}
export function ItemCard({ item, onPress }: ItemCardProps): JSX.Element {
...
}
```
---
## State Management
### Local State First
```typescript
// Start with useState, escalate only when needed
const [value, setValue] = useState('');
```
### Zustand for Global State (if needed)
```typescript
// store/useAppStore.ts
import { create } from 'zustand';
interface AppState {
user: User | null;
setUser: (user: User | null) => void;
}
export const useAppStore = create<AppState>((set) => ({
user: null,
setUser: (user) => set({ user }),
}));
```
### React Query for Server State
```typescript
// hooks/useItems.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
export function useItems() {
return useQuery({
queryKey: ['items'],
queryFn: fetchItems,
});
}
export function useCreateItem() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: createItem,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['items'] });
},
});
}
```
---
## Testing
### Component Testing with React Native Testing Library
```typescript
import { render, fireEvent } from '@testing-library/react-native';
import { Button } from './Button';
describe('Button', () => {
it('calls onPress when pressed', () => {
const onPress = jest.fn();
const { getByText } = render(<Button label="Click me" onPress={onPress} />);
fireEvent.press(getByText('Click me'));
expect(onPress).toHaveBeenCalledTimes(1);
});
it('does not call onPress when disabled', () => {
const onPress = jest.fn();
const { getByText } = render(<Button label="Click me" onPress={onPress} disabled />);
fireEvent.press(getByText('Click me'));
expect(onPress).not.toHaveBeenCalled();
});
});
```
### Hook Testing
```typescript
import { renderHook, act } from '@testing-library/react-hooks';
import { useCounter } from './useCounter';
describe('useCounter', () => {
it('increments counter', () => {
const { result } = renderHook(() => useCounter());
act(() => {
result.current.increment();
});
expect(result.current.count).toBe(1);
});
});
```
---
## Platform-Specific Code
### Use Platform.select Sparingly
```typescript
import { Platform } from 'react-native';
const styles = StyleSheet.create({
shadow: Platform.select({
ios: {
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
},
android: {
elevation: 2,
},
}),
});
```
### Separate Files for Complex Differences
```
Component/
āāā Component.tsx # Shared logic
āāā Component.ios.tsx # iOS-specific
āāā Component.android.tsx # Android-specific
āāā index.ts
```
---
## React Native Anti-Patterns
- ā Inline styles - use StyleSheet.create
- ā Logic in render - extract to hooks
- ā Deep component nesting - flatten hierarchy
- ā Anonymous functions in props - use useCallback
- ā Index as key in lists - use stable IDs
- ā Direct state mutation - always use setter
- ā Mixing business logic with UI - keep core/ pure
- ā Ignoring TypeScript errors - fix them
- ā Large components - split into smaller piecesSignals
Information
- Repository
- alinaqi/claude-bootstrap
- Author
- alinaqi
- Last Sync
- 3/12/2026
- Repo Updated
- 3/11/2026
- Created
- 1/14/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
upgrade-nodejs
Upgrading Bun's Self-Reported Node.js Version
cursorrules
CrewAI Development Rules
CLAUDE
CLAUDE.md
Confidence Check
Pre-implementation confidence assessment (ā„90% required). Use before starting any implementation to verify readiness with duplicate check, architecture compliance, official docs verification, OSS references, and root cause identification.
Related Guides
Python Django Best Practices: A Comprehensive Guide to the Claude Skill
Learn how to use the python django best practices Claude skill. Complete guide with installation instructions and examples.
Mastering Python and TypeScript Development with the Claude Skill Guide
Learn how to use the python typescript guide Claude skill. Complete guide with installation instructions and examples.
Mastering Python Development with Claude: A Complete Guide to the Python Skill
Learn how to use the python Claude skill. Complete guide with installation instructions and examples.