.claude/skills/ts-apollo-client/SKILL.md
You are an expert in Apollo Client, the comprehensive GraphQL client for React applications. You help developers fetch data with GraphQL queries and mutations, manage local and remote state with Apollo's normalized cache, implement optimistic UI updates, handle pagination, and configure authentication — providing a complete data management solution for GraphQL-powered apps.
npx skillsauth add eliferjunior/Claude apollo-clientInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in Apollo Client, the comprehensive GraphQL client for React applications. You help developers fetch data with GraphQL queries and mutations, manage local and remote state with Apollo's normalized cache, implement optimistic UI updates, handle pagination, and configure authentication — providing a complete data management solution for GraphQL-powered apps.
import { ApolloClient, InMemoryCache, ApolloProvider, gql, useQuery, useMutation } from "@apollo/client";
const client = new ApolloClient({
uri: "https://api.example.com/graphql",
cache: new InMemoryCache({
typePolicies: {
Query: {
fields: {
posts: { keyArgs: ["filter"], merge(existing = [], incoming) { return [...existing, ...incoming]; } },
},
},
},
}),
headers: { Authorization: `Bearer ${getToken()}` },
});
const GET_POSTS = gql`
query GetPosts($limit: Int!, $offset: Int!, $filter: PostFilter) {
posts(limit: $limit, offset: $offset, filter: $filter) {
id
title
excerpt
author { id name avatar }
createdAt
}
}
`;
function PostList({ filter }: { filter?: PostFilter }) {
const { data, loading, error, fetchMore } = useQuery(GET_POSTS, {
variables: { limit: 10, offset: 0, filter },
});
if (loading) return <Skeleton />;
if (error) return <Error message={error.message} />;
return (
<div>
{data.posts.map(post => <PostCard key={post.id} post={post} />)}
<button onClick={() => fetchMore({ variables: { offset: data.posts.length } })}>
Load more
</button>
</div>
);
}
const CREATE_POST = gql`
mutation CreatePost($input: CreatePostInput!) {
createPost(input: $input) { id title excerpt author { id name } createdAt }
}
`;
function CreatePostForm() {
const [createPost, { loading }] = useMutation(CREATE_POST, {
optimisticResponse: (vars) => ({
createPost: {
__typename: "Post",
id: "temp-id",
title: vars.input.title,
excerpt: vars.input.body.slice(0, 200),
author: { __typename: "User", id: currentUser.id, name: currentUser.name },
createdAt: new Date().toISOString(),
},
}),
update(cache, { data: { createPost } }) {
cache.modify({
fields: {
posts(existing = []) {
const ref = cache.writeFragment({ data: createPost, fragment: POST_FRAGMENT });
return [ref, ...existing];
},
},
});
},
});
const handleSubmit = (data) => createPost({ variables: { input: data } });
return <Form onSubmit={handleSubmit} loading={loading} />;
}
import { ApolloClient, createHttpLink, ApolloLink } from "@apollo/client";
import { setContext } from "@apollo/client/link/context";
import { onError } from "@apollo/client/link/error";
const httpLink = createHttpLink({ uri: "/graphql" });
const authLink = setContext((_, { headers }) => ({
headers: { ...headers, authorization: `Bearer ${localStorage.getItem("token")}` },
}));
const errorLink = onError(({ graphQLErrors, networkError }) => {
if (graphQLErrors?.some(e => e.extensions?.code === "UNAUTHENTICATED")) {
localStorage.removeItem("token");
window.location.href = "/login";
}
});
const client = new ApolloClient({
link: ApolloLink.from([errorLink, authLink, httpLink]),
cache: new InMemoryCache(),
});
npm install @apollo/client graphql
__typename:id; updates to one entity propagate everywhereoptimisticResponse for mutations; UI updates instantly, corrects on server responsetypePolicies for pagination merging, field read/write policiesgraphql-codegen to generate TypeScript types from your schema; fully typed queriesonError link for global error handling (auth refresh, logging, retry)update function or refetchQueries after mutations; prefer cache.modify for performancepollInterval for simple real-time, WebSocket subscriptions for true real-timedevelopment
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.