gracefullight/pkgs / .agents/skills/oma-mobile
oma-mobile
UnverifiedImplement Flutter, React Native, or native Swift apps. Use for mobile screens, widgets, platform integrations, and application data flows.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.9 KB |
| resources/checklist.md | markdown | 3.9 KB |
| resources/error-playbook.md | markdown | 10.8 KB |
| resources/execution-protocol.md | markdown | 3.5 KB |
| resources/screen-template.dart | other | 11.0 KB |
| resources/screen-template.swift | script | 8.1 KB |
| resources/screen-template.tsx | other | 5.7 KB |
| resources/tech-stack.md | markdown | 3.8 KB |
| variants/README.md | markdown | 2.0 KB |
| variants/flutter/api-template.dart | other | 18.3 KB |
| variants/flutter/snippets.md | markdown | 41.4 KB |
| variants/flutter/stack.yaml | config | 456 B |
| variants/flutter/tech-stack.md | markdown | 11.4 KB |
| variants/react-native/api-template.ts | script | 16.3 KB |
| variants/react-native/snippets.md | markdown | 30.4 KB |
| variants/react-native/stack.yaml | config | 574 B |
| variants/react-native/tech-stack.md | markdown | 11.2 KB |
| variants/stack.schema.json | config | 2.5 KB |
| variants/swift-ios/api-template.swift | script | 6.8 KB |
| variants/swift-ios/snippets.md | markdown | 35.8 KB |
| variants/swift-ios/stack.yaml | config | 682 B |
| variants/swift-ios/tech-stack.md | markdown | 10.9 KB |
resources/screen-template.tsx
View on GitHub/**
* Screen Template for Mobile Agent (React Native)
*
* Demonstrates best practices for React Native screens:
* - Typed navigation props (React Navigation v7 native-stack)
* - Consumes TanStack Query hooks (useTodosQuery + mutations) — NEVER axios directly
* - Explicit isPending / error-with-retry / empty / data states via the shared
* LoadingView / ErrorView / EmptyStateView components (snippets.md §12)
* - FlatList with a stable keyExtractor and item-level accessibility roles
* - RefreshControl wired to the query's refetch (pull-to-refresh)
* - StyleSheet at the bottom; no inline style objects in render
*
* Layout: src/features/todos/ui/ExampleScreen.tsx
* The hooks (useTodosQuery, useToggleTodo, useDeleteTodo) live in
* src/features/todos/{queries.ts,mutations.ts}; the screen only composes them.
*/
import React, { useCallback } from 'react';
import {
View,
Text,
FlatList,
TouchableOpacity,
RefreshControl,
StyleSheet,
type ListRenderItem,
} from 'react-native';
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
import type { RootStackParamList } from '@navigation/types';
import { LoadingView } from '@shared/components/LoadingView';
import { ErrorView } from '@shared/components/ErrorView';
import { EmptyStateView } from '@shared/components/EmptyStateView';
import { useTodosQuery } from '../queries';
import { useToggleTodo, useDeleteTodo } from '../mutations';
import type { Todo } from '@api/todos';
// Typed screen props: navigation.navigate is compile-time checked against the
// RootStackParamList, so passing the wrong params to 'TodoDetail' is a type error.
type Props = NativeStackScreenProps<RootStackParamList, 'TodoList'>;
export function ExampleScreen({ navigation }: Props) {
// Read hook — returns cached data instantly and revalidates in the background.
const { data: todos, isPending, isError, error, refetch, isRefetching } =
useTodosQuery();
// Write hooks — the screen fires intents; the hooks own optimistic updates,
// rollback, and cache invalidation. The screen never touches the query cache.
const toggleMutation = useToggleTodo();
const deleteMutation = useDeleteTodo();
// --- Intents -------------------------------------------------------------
const handleToggle = useCallback(
(id: string) => toggleMutation.mutate(id),
[toggleMutation],
);
const handleDelete = useCallback(
(id: string) => deleteMutation.mutate(id),
[deleteMutation],
);
const handleOpenDetail = useCallback(
(id: string) => navigation.navigate('TodoDetail', { id }),
[navigation],
);
// renderItem is defined once (stable identity) so FlatList rows don't churn.
const renderItem: ListRenderItem<Todo> = useCallback(
({ item }) => (
<View style={styles.row}>
<TouchableOpacity
style={styles.checkbox}
onPress={() => handleToggle(item.id)}
accessibilityRole="checkbox"
accessibilityState={{ checked: item.completed }}
accessibilityLabel={`Toggle ${item.title}`}
>
<Text style={styles.checkboxGlyph}>{item.completed ? '☑' : '☐'}</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.titleContainer}
onPress={() => handleOpenDetail(item.id)}
accessibilityRole="button"
>
<Text style={[styles.title, item.completed && styles.completed]}>
{item.title}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleDelete(item.id)}
accessibilityRole="button"
accessibilityLabel={`Delete ${item.title}`}
>
<Text style={styles.deleteIcon}>✕</Text>
</TouchableOpacity>
</View>
),
[handleToggle, handleDelete, handleOpenDetail],
);
// --- State switch --------------------------------------------------------
// Order matters: pending (first load, no cached data) → error → empty → data.
// Each non-data state delegates to a shared component so every screen renders
// them identically. isPending is the v5 first-load flag; isRefetching drives
// the pull-to-refresh spinner without hiding already-cached rows.
if (isPending) {
return <LoadingView label="Loading todos" />;
}
if (isError) {
return <ErrorView error={error} onRetry={refetch} />;
}
if (todos.length === 0) {
return <EmptyStateView message="No todos yet. Add your first one!" />;
}
// --- Data state ----------------------------------------------------------
return (
<FlatList
data={todos}
keyExtractor={(item) => item.id}
renderItem={renderItem}
contentContainerStyle={styles.listContent}
refreshControl={
<RefreshControl refreshing={isRefetching} onRefresh={refetch} />
}
// Keep the empty branch above authoritative; this is a defensive fallback.
ListEmptyComponent={
<EmptyStateView message="No todos yet. Add your first one!" />
}
/>
);
}
// StyleSheet at the bottom — StyleSheet.create freezes the objects and lets RN
// pass style IDs across the bridge instead of fresh objects on every render.
const styles = StyleSheet.create({
listContent: {
flexGrow: 1,
},
row: {
flexDirection: 'row',
alignItems: 'center',
paddingHorizontal: 16,
paddingVertical: 12,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#e0e0e0',
},
checkbox: {
marginRight: 12,
},
checkboxGlyph: {
fontSize: 18,
},
titleContainer: {
flex: 1,
},
title: {
fontSize: 16,
color: '#212121',
},
completed: {
textDecorationLine: 'line-through',
color: '#9e9e9e',
},
deleteIcon: {
color: '#9e9e9e',
fontSize: 16,
paddingLeft: 12,
},
});
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 |