borghei/Claude-Skills / engineering/senior-mobile
senior-mobile
UnverifiedMobile development across SwiftUI, Jetpack Compose, React Native (Expo) and Flutter: scaffolding, feature architecture, static performance checks and store listings. Use when building, optimizing or shipping a mobile app.
| File | Kind | Size |
|---|---|---|
| REFERENCE.md | markdown | 8.9 KB |
| SKILL.md | skill md | 8.6 KB |
| references/ios-android-patterns.md | markdown | 18.8 KB |
| references/mobile-security-guide.md | markdown | 21.4 KB |
| references/react-native-patterns.md | markdown | 17.9 KB |
| references/tool-reference.md | markdown | 5.7 KB |
| references/troubleshooting-and-success.md | markdown | 2.9 KB |
| references/workflows.md | markdown | 6.1 KB |
| scripts/app_performance_analyzer.py | script | 29.6 KB |
| scripts/mobile_scaffold.py | script | 40.4 KB |
| scripts/store_metadata_generator.py | script | 35.7 KB |
REFERENCE.md
View on GitHub# Senior Mobile Developer -- Reference Code Examples
Extended code examples for the senior-mobile skill. See [SKILL.md](SKILL.md) for workflows and quick start.
---
## React Native: Animated Button Component
```typescript
import { View, Text, Pressable, StyleSheet, ActivityIndicator } from 'react-native';
import Animated, {
useAnimatedStyle,
withSpring,
useSharedValue,
} from 'react-native-reanimated';
interface ButtonProps {
title: string;
variant?: 'primary' | 'secondary';
loading?: boolean;
disabled?: boolean;
onPress: () => void;
}
export function Button({
title,
variant = 'primary',
loading,
disabled,
onPress,
}: ButtonProps) {
const scale = useSharedValue(1);
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ scale: scale.value }],
}));
return (
<Pressable
onPress={onPress}
onPressIn={() => { scale.value = withSpring(0.95); }}
onPressOut={() => { scale.value = withSpring(1); }}
disabled={disabled || loading}
>
<Animated.View
style={[styles.button, styles[variant], disabled && styles.disabled, animatedStyle]}
>
{loading ? (
<ActivityIndicator color="#fff" />
) : (
<Text style={[styles.text, styles[`${variant}Text`]]}>{title}</Text>
)}
</Animated.View>
</Pressable>
);
}
const styles = StyleSheet.create({
button: { paddingVertical: 12, paddingHorizontal: 24, borderRadius: 8, alignItems: 'center', justifyContent: 'center' },
primary: { backgroundColor: '#007AFF' },
secondary: { backgroundColor: 'transparent', borderWidth: 1, borderColor: '#007AFF' },
disabled: { opacity: 0.5 },
text: { fontSize: 16, fontWeight: '600' },
primaryText: { color: '#fff' },
secondaryText: { color: '#007AFF' },
});
```
## React Native: Expo Router Navigation Setup
```typescript
// app/_layout.tsx
import { Stack } from 'expo-router';
import { AuthProvider } from '@/contexts/AuthContext';
export default function RootLayout() {
return (
<AuthProvider>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="(tabs)" />
<Stack.Screen name="auth" />
<Stack.Screen name="modal" options={{ presentation: 'modal' }} />
</Stack>
</AuthProvider>
);
}
// app/(tabs)/_layout.tsx
import { Tabs } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
export default function TabLayout() {
return (
<Tabs>
<Tabs.Screen
name="index"
options={{
title: 'Home',
tabBarIcon: ({ color, size }) => <Ionicons name="home" size={size} color={color} />,
}}
/>
<Tabs.Screen
name="profile"
options={{
title: 'Profile',
tabBarIcon: ({ color, size }) => <Ionicons name="person" size={size} color={color} />,
}}
/>
</Tabs>
);
}
```
## React Native: Zustand Auth Store with Persistence
```typescript
import { create } from 'zustand';
import { persist, createJSONStorage } from 'zustand/middleware';
import AsyncStorage from '@react-native-async-storage/async-storage';
interface AuthState {
user: { id: string; email: string; name: string } | null;
token: string | null;
isLoading: boolean;
login: (email: string, password: string) => Promise<void>;
logout: () => void;
refreshToken: () => Promise<void>;
}
export const useAuthStore = create<AuthState>()(
persist(
(set, get) => ({
user: null,
token: null,
isLoading: false,
login: async (email, password) => {
set({ isLoading: true });
try {
const response = await api.post('/auth/login', { email, password });
set({ user: response.data.user, token: response.data.token, isLoading: false });
} catch (error) {
set({ isLoading: false });
throw error;
}
},
logout: () => set({ user: null, token: null }),
refreshToken: async () => {
const { token } = get();
if (!token) return;
const response = await api.post('/auth/refresh', { token });
set({ token: response.data.token });
},
}),
{
name: 'auth-storage',
storage: createJSONStorage(() => AsyncStorage),
partialize: (state) => ({ user: state.user, token: state.token }),
}
)
);
```
## iOS: SwiftUI Product List with Search and Pull-to-Refresh
```swift
import SwiftUI
struct ProductListView: View {
@StateObject private var viewModel = ProductListViewModel()
@State private var searchText = ""
var body: some View {
NavigationStack {
Group {
if viewModel.isLoading {
ProgressView()
} else if let error = viewModel.error {
ErrorView(error: error, onRetry: viewModel.loadProducts)
} else {
List(viewModel.filteredProducts(searchText)) { product in
NavigationLink(value: product) {
ProductRow(product: product)
}
}
.navigationDestination(for: Product.self) { product in
ProductDetailView(product: product)
}
}
}
.navigationTitle("Products")
.searchable(text: $searchText)
.refreshable { await viewModel.loadProducts() }
}
.task { await viewModel.loadProducts() }
}
}
struct ProductRow: View {
let product: Product
var body: some View {
HStack(spacing: 12) {
AsyncImage(url: product.imageURL) { image in
image.resizable().aspectRatio(contentMode: .fill)
} placeholder: {
Color.gray.opacity(0.3)
}
.frame(width: 60, height: 60)
.clipShape(RoundedRectangle(cornerRadius: 8))
VStack(alignment: .leading, spacing: 4) {
Text(product.name).font(.headline)
Text(product.formattedPrice).font(.subheadline).foregroundStyle(.secondary)
}
Spacer()
}
.padding(.vertical, 4)
}
}
```
## Android: Jetpack Compose Product List
```kotlin
@Composable
fun ProductListScreen(
viewModel: ProductListViewModel = hiltViewModel(),
onProductClick: (Product) -> Unit
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
Scaffold(
topBar = { TopAppBar(title = { Text("Products") }) }
) { padding ->
when (val state = uiState) {
is UiState.Loading -> {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
CircularProgressIndicator()
}
}
is UiState.Error -> {
ErrorContent(message = state.message, onRetry = { viewModel.loadProducts() })
}
is UiState.Success -> {
LazyColumn(
modifier = Modifier.padding(padding),
contentPadding = PaddingValues(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
items(state.data, key = { it.id }) { product ->
ProductCard(product = product, onClick = { onProductClick(product) })
}
}
}
}
}
}
@Composable
fun ProductCard(product: Product, onClick: () -> Unit, modifier: Modifier = Modifier) {
Card(modifier = modifier.fillMaxWidth(), onClick = onClick) {
Row(modifier = Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
AsyncImage(
model = product.imageUrl,
contentDescription = null,
modifier = Modifier.size(60.dp).clip(RoundedCornerShape(8.dp)),
contentScale = ContentScale.Crop
)
Column {
Text(text = product.name, style = MaterialTheme.typography.titleMedium)
Text(text = product.formattedPrice, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
}
```
## React Native: FlatList Performance Configuration
```typescript
<FlatList
data={items}
renderItem={renderItem}
keyExtractor={(item) => item.id}
initialNumToRender={10}
maxToRenderPerBatch={10}
windowSize={5}
removeClippedSubviews={true}
getItemLayout={(data, index) => ({
length: ITEM_HEIGHT,
offset: ITEM_HEIGHT * index,
index,
})}
/>
```
## iOS: Collection View Prefetching
```swift
func collectionView(
_ collectionView: UICollectionView,
prefetchItemsAt indexPaths: [IndexPath]
) {
for indexPath in indexPaths {
let product = products[indexPath.row]
imageLoader.prefetch(url: product.imageURL)
}
}
```
## Android: RecyclerView Optimization
```kotlin
recyclerView.apply {
setHasFixedSize(true)
setItemViewCacheSize(20)
recycledViewPool.setMaxRecycledViews(0, 20)
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |