Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

api-integration-architect

БесплатноБез исполняемых скриптовНе проверен

Expert in API integration with React Query, SWR, RTK Query, REST/GraphQL clients, WebSocket real-time, optimistic updates, caching strategies, and error…

diegosouzapwот diegosouzapw★ 68 звёзд на GitHub

Об этом скилле

API Integration Architect

Expert skill for integrating APIs in React applications. Specializes in React Query, SWR, GraphQL, WebSockets, caching strategies, and optimistic updates.

Core Capabilities

1. Data Fetching Libraries

  • React Query (TanStack Query): Powerful async state management
  • SWR: Stale-while-revalidate strategy
  • RTK Query: Redux Toolkit integration
  • Apollo Client: GraphQL client
  • Axios/Fetch: HTTP clients

2. REST API Integration

  • GET Requests: Fetch data
  • POST/PUT/PATCH: Create/update data
  • DELETE: Remove data
  • Query Parameters: Filtering, pagination
  • Headers: Authentication, content-type
  • Error Handling: Network errors, HTTP errors

3. GraphQL Integration

  • Queries: Fetch data with GraphQL
  • Mutations: Modify data
  • Subscriptions: Real-time updates
  • Fragments: Reusable query parts
  • Code Generation: Type-safe queries
  • Caching: Normalized cache

4. Real-Time Communication

  • WebSocket: Bidirectional communication
  • Server-Sent Events: One-way server push
  • Polling: Interval-based updates
  • Long Polling: Efficient polling
  • Socket.io: WebSocket library

5. Caching & Optimization

  • Cache Strategies: Fresh, stale, refetch
  • Background Refetch: Update in background
  • Cache Invalidation: Smart cache updates
  • Prefetching: Load before needed
  • Pagination: Infinite scroll, load more
  • Deduplication: Avoid duplicate requests

6. Optimistic Updates

  • Immediate UI: Update before server response
  • Rollback: Undo on error
  • Pessimistic Updates: Wait for server
  • Concurrent Updates: Handle conflicts
  • Offline Support: Queue mutations

React Query Setup

// queryClient.ts
import { QueryClient } from '@tanstack/react-query'

export const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 5 * 60 * 1000, // 5 minutes
      cacheTime: 10 * 60 * 1000, // 10 minutes
      refetchOnWindowFocus: false,
      retry: 1,
    },
  },
})

// App.tsx
import { QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <YourApp />
      <ReactQueryDevtools initialIsOpen={false} />
    </QueryClientProvider>
  )
}

API Client

// api/client.ts
import axios from 'axios'

const apiClient = axios.create({
  baseURL: process.env.REACT_APP_API_URL,
  headers: {
    'Content-Type': 'application/json',
  },
})

// Request interceptor
apiClient.interceptors.request.use(
  (config) => {
    const token = localStorage.getItem('token')
    if (token) {
      config.headers.Authorization = `Bearer ${token}`
    }
    return config
  },
  (error) => Promise.reject(error)
)

// Response interceptor
apiClient.interceptors.response.use(
  (response) => response.data,
  (error) => {
    if (error.response?.status === 401) {
      // Handle unauthorized
      window.location.href = '/login'
    }
    return Promise.reject(error)
  }
)

export default apiClient

React Query Patterns

// hooks/useUser.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import apiClient from '@/api/client'

interface User {
  id: string
  name: string
  email: string
}

// Fetch user
export function useUser(userId: string) {
  return useQuery({
    queryKey: ['user', userId],
    queryFn: () => apiClient.get<User>(`/users/${userId}`),
    enabled: !!userId,
  })
}

// Update user
export function useUpdateUser() {
  const queryClient = useQueryClient()

  return useMutation({
    mutationFn: (data: Partial<User> & { id: string }) =>
      apiClient.put(`/users/${data.id}`, data),

    // Optimistic update
    onMutate: async (newUser) => {
      await queryClient.cancelQueries({ queryKey: ['user', newUser.id] })
      const previousUser = queryClient.getQueryData(['user', newUser.id])
      queryClient.setQueryData(['user', newUser.id], newUser)
      return { previousUser }
    },

    onError: (err, newUser, context) => {
      queryClient.setQueryData(['user', newUser.id], context?.previousUser)
    },

    onSettled: (data, error, variables) => {
      queryClient.invalidateQueries({ queryKey: ['user', variables.id] })
    },
  })
}

GraphQL with Apollo

// apollo-client.ts
import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client'
import { setContext } from '@apollo/client/link/context'

const httpLink = createHttpLink({
  uri: process.env.REACT_APP_GRAPHQL_URL,
})

const authLink = setContext((_, { headers }) => {
  const token = localStorage.getItem('token')
  return {
    headers: {
      ...headers,
      authorization: token ? `Bearer ${token}` : '',
    },
  }
})

export const apolloClient = new ApolloClient({
  link: authLink.concat(httpLink),
  cache: new InMemoryCache(),
})

//
Полный SKILL.md на GitHub

Установить api-integration-architect в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash
Glob
Grep
Task

Вложенные файлы

metadata.json

FAQ

Что делает скилл api-integration-architect?

Expert in API integration with React Query, SWR, RTK Query, REST/GraphQL clients, WebSocket real-time, optimistic updates, caching strategies, and error handling

Как установить скилл api-integration-architect?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл api-integration-architect запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить api-integration-architect с