Claude-skill-registry api-expert
Handles backend integration using best practices like expo/fetch and React Query. Use when the user needs to connect to an API, handle data fetching, or implement caching.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/api-expert" ~/.claude/skills/majiayu000-claude-skill-registry-api-expert && rm -rf "$T"
manifest:
skills/data/api-expert/SKILL.mdsource content
API Expert Skill
This skill provides expertise in integrating backend services into React Native Expo applications. It emphasizes reliability, performance, and clean architecture.
Core Principles
- Use
: Always preferexpo/fetch
over standardexpo/fetch
orfetch
.axios - React Query: Use
for managing server state, caching, and synchronization.@tanstack/react-query - Service Layer: Keep API logic in the
directory.services/ - Type Safety: Define Zod schemas for runtime validation and TypeScript interfaces for compile-time safety.
Instructions
- Setup Client: Ensure the React Query client is configured in
.app/_layout.tsx - Define Services: Create service files in
that useservices/api/
.expo/fetch - Custom Hooks: Wrap service calls in custom React Query hooks.
- Error Handling: Implement early returns and use
for unexpected failures.ErrorBoundary - Validation: Use Zod to validate API responses at the network boundary.
Example
// services/api/user-service.ts import { fetch } from 'expo/fetch'; import { z } from 'zod'; const UserSchema = z.object({ id: z.string(), name: z.string(), }); export const fetchUser = async (id: string) => { const response = await fetch(`https://api.example.com/users/${id}`); if (!response.ok) throw new Error('Failed to fetch user'); const data = await response.json(); return UserSchema.parse(data); }; // hooks/use-user.ts import { useQuery } from '@tanstack/react-query'; import { fetchUser } from '@/services/api/user-service'; export const useUser = (id: string) => { return useQuery({ queryKey: ['user', id], queryFn: () => fetchUser(id), }); };
See API Best Practices for more details.