areas/software/frontend/skills/api-integration/SKILL.md
# Skill: API Integration Patterns ## When to load When connecting a component to a REST API, handling loading/error states, or implementing optimistic updates. ## Standard Fetch Layer ```ts const apiClient = { get: async <T>(path: string, options?: RequestInit): Promise<T> => { const res = await fetch(`${import.meta.env.VITE_API_URL}${path}`, { ...options, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}`, ...option
npx skillsauth add sawrus/agent-guides areas/software/frontend/skills/api-integrationInstall 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.
When connecting a component to a REST API, handling loading/error states, or implementing optimistic updates.
const apiClient = {
get: async <T>(path: string, options?: RequestInit): Promise<T> => {
const res = await fetch(`${import.meta.env.VITE_API_URL}${path}`, {
...options,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${getToken()}`,
...options?.headers,
},
});
if (!res.ok) throw new ApiError(res.status, await res.json());
return res.json();
},
};
const UserList = () => {
const { data, isLoading, isError, error } = useQuery({
queryKey: ['users'],
queryFn: () => apiClient.get<User[]>('/users'),
});
if (isLoading) return <UserListSkeleton />;
if (isError) return <ErrorMessage message={error.message} />;
return <ul>{data.map(user => <UserItem key={user.id} user={user} />)}</ul>;
};
const mutation = useMutation({
mutationFn: (id: string) => apiClient.delete(`/todos/${id}`),
onMutate: async (id) => {
await queryClient.cancelQueries({ queryKey: ['todos'] });
const previous = queryClient.getQueryData<Todo[]>(['todos']);
queryClient.setQueryData<Todo[]>(['todos'], old => old?.filter(t => t.id !== id));
return { previous };
},
onError: (_err, _id, context) => {
queryClient.setQueryData(['todos'], context?.previous);
},
onSettled: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
});
testing
QA Expert for writing E2E tests, test scenarios, test plans, and ensuring test coverage quality.
development
Expert UI/UX design intelligence for creating distinctive, high-craft, and mobile-first interfaces. Focuses on premium aesthetics, touch-first ergonomics, and Flutter performance.
development
Code Review Expert for static analysis, security auditing, architecture review, and ensuring code quality standards.
development
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep watching open PRs so fresh review feedback is surfaced promptly. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.