/claude-kit:api-integration [API endpoint or feature name]from Claude Kit SDLC
Wire the app to a backend API — data fetching, caching, error handling, loading states. Use when connecting to an endpoint, adding a fetch layer, or fixing API error and loading behaviour.
Ships in Claude Kit SDLC. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Integrate API for: $ARGUMENTS.
Identify the API: Determine the endpoint(s), HTTP method(s), request/response shapes, and authentication requirements for $ARGUMENTS.
Define types: Create typed interfaces for request and response payloads. Co-locate types with the API client module according to the project's conventions.
// TypeScript example
export interface GetItemsParams {
page: number;
limit: number;
status?: 'open' | 'resolved' | 'escalated';
}
export interface ItemResponse {
data: Item[];
total: number;
page: number;
}
# Python example (Pydantic)
from pydantic import BaseModel
class GetItemsParams(BaseModel):
page: int
limit: int
status: str | None = None
class ItemResponse(BaseModel):
data: list[Item]
total: int
page: int
Create API client functions: Place in the project's designated API layer as pure async functions. Use the project's HTTP client.
// TypeScript example
import { httpClient } from '@/lib/httpClient';
import type { GetItemsParams, ItemResponse } from './types/items';
export async function getItems(params: GetItemsParams): Promise<ItemResponse> {
const { data } = await httpClient.get<ItemResponse>('/items', { params });
return data;
}
export async function resolveItem(id: string, resolution: string): Promise<void> {
await httpClient.post(`/items/${encodeURIComponent(id)}/resolve`, { resolution });
}
# Python example (httpx)
import httpx
from .schemas import GetItemsParams, ItemResponse
async def get_items(params: GetItemsParams) -> ItemResponse:
async with httpx.AsyncClient() as client:
response = await client.get('/items', params=params.model_dump())
return ItemResponse.model_validate(response.json())
async def resolve_item(id: str, resolution: str) -> None:
async with httpx.AsyncClient() as client:
await client.post(f'/items/{id}/resolve', json={'resolution': resolution})
Create data-fetching hooks/functions: Wrap API calls with the project's caching/state management layer.
import { useQuery } from '@tanstack/react-query';
import { getItems } from '@/api/items';
import type { GetItemsParams } from '@/api/types/items';
export const itemKeys = {
all: ['items'] as const,
lists: () => [...itemKeys.all, 'list'] as const,
list: (params: GetItemsParams) => [...itemKeys.lists(), params] as const,
details: () => [...itemKeys.all, 'detail'] as const,
detail: (id: string) => [...itemKeys.details(), id] as const,
};
export function useItems(params: GetItemsParams) {
return useQuery({
queryKey: itemKeys.list(params),
queryFn: () => getItems(params),
staleTime: 5 * 60 * 1000, // 5 minutes
placeholderData: keepPreviousData,
});
}
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { resolveItem } from '@/api/items';
export function useResolveItem() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ id, resolution }: { id: string; resolution: string }) =>
resolveItem(id, resolution),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: itemKeys.all });
},
});
}
# Python service layer
from .repository import ItemRepository
from .schemas import GetItemsParams, ItemResponse
class ItemService:
def __init__(self, repo: ItemRepository):
self.repo = repo
async def get_items(self, params: GetItemsParams) -> ItemResponse:
items = await self.repo.find_all(params)
total = await self.repo.count(params)
return ItemResponse(data=items, total=total, page=params.page)
Validate responses at the boundary: Use a validation library to ensure API responses match expected shapes.
// TypeScript with Zod
import { z } from 'zod';
const itemResponseSchema = z.object({
data: z.array(itemSchema),
total: z.number(),
page: z.number(),
});
export async function getItems(params: GetItemsParams) {
const { data } = await httpClient.get('/items', { params });
return itemResponseSchema.parse(data);
}
# Python with Pydantic (validation built-in)
from pydantic import BaseModel, field_validator
class ItemResponse(BaseModel):
data: list[Item]
total: int
page: int
@field_validator('total')
@classmethod
def total_non_negative(cls, v: int) -> int:
if v < 0:
raise ValueError('total must be non-negative')
return v
Use in components/views: Follow the loading/empty/error state pattern.
// React example
function ItemList() {
const { data, isLoading, error } = useItems({ page: 1, limit: 20 });
if (isLoading) return <Spinner />;
if (error) return <EmptyState title="Failed to load items" />;
if (!data?.data.length) return <EmptyState title="No items found" />;
return (
<div className="space-y-3">
{data.data.map((item) => (
<ItemCard key={item.id} item={item} />
))}
</div>
);
}
# Python (FastAPI) example
from fastapi import APIRouter, Depends, HTTPException, status
@router.get('/items', response_model=ItemResponse)
async def list_items(
params: GetItemsParams = Depends(),
service: ItemService = Depends(),
) -> ItemResponse:
try:
return await service.get_items(params)
except Exception as e:
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail='Failed to load items'
)
Verify: Run the project's linter, type checker, and build to confirm all checks pass.
Every feature should have a key factory object for consistent cache management (applies to client-side caching libraries like TanStack Query, SWR, Apollo):
export const featureKeys = {
all: ['feature'] as const,
lists: () => [...featureKeys.all, 'list'] as const,
list: (params: Params) => [...featureKeys.lists(), params] as const,
details: () => [...featureKeys.all, 'detail'] as const,
detail: (id: string) => [...featureKeys.details(), id] as const,
};
| Data Type | Stale Time | Rationale |
|---|---|---|
| Reference data (categories, roles) | 30 minutes | Rarely changes |
| Dashboard KPIs | 5 minutes | Moderate freshness |
| Real-time feeds (notifications, alerts) | 1 minute | Needs frequent updates |
| User-specific (preferences) | Infinity | Only changes on mutation |
Use for operations where the user expects instant feedback:
// TanStack Query example
onMutate: async (newData) => {
await queryClient.cancelQueries({ queryKey });
const previous = queryClient.getQueryData(queryKey);
queryClient.setQueryData(queryKey, (old) => /* optimistic update */);
return { previous };
},
onError: (_err, _new, context) => {
queryClient.setQueryData(queryKey, context?.previous);
},
onSettled: () => {
queryClient.invalidateQueries({ queryKey });
},
# Backend optimistic approach (return before commit)
async def update_item(db: AsyncSession, id: str, update: ItemUpdate) -> Item:
item = await repo.get_by_id(db, id)
if not item:
raise HTTPException(status_code=404)
# Apply changes
for field, value in update.model_dump(exclude_unset=True).items():
setattr(item, field, value)
# Flush to get updated state, but don't commit yet
await db.flush()
await db.refresh(item)
# Return optimistically (commit happens at end of request)
return item
Adapt to your project's conventions. Common patterns:
src/
lib/
httpClient.ts # Shared HTTP client (Axios/Fetch)
queryKeys.ts # Shared query key factories (if using client-side caching)
providers/
QueryProvider.tsx # Data-fetching provider (TanStack Query, SWR, Apollo)
modules/ (or features/)
<feature>/
api/<feature>Api.ts # Plain async API functions
hooks/use<Feature>Queries.ts # Data-fetching hooks wrapping API functions
types/<feature>.ts # Request/response types
app/
api/ # HTTP route handlers
v1/
<feature>/
router.py (or routes.ts) # Route definitions
schemas.py (or dtos.ts) # Request/response schemas
service.py (or service.ts) # Business logic
repository.py (or repository.ts) # Data access
Key rules:
useQuery for reads, useMutation for writesinvalidateQueries after mutationsplaceholderData: keepPreviousData for paginationuseItems)catchError for error handlingshareReplay for cachingTests that hit a live third-party API are slow, flaky, rate-limited, and fail when you're offline or the vendor has an incident — yet hand-written mocks drift out of sync with the real contract and quietly stop reflecting it. The record-replay pattern gets both fidelity and determinism:
Authorization, API keys, cookies, and any PII from the
saved request/response before it lands in the repo — fixtures are committed and must never carry
credentials (ties to .claude/skills/security-and-hardening and secret-scanner).vcrpy / pytest-recording (Python),
Polly.js / nock back: recordings (JS), WireMock (JVM), or a standalone record-replay proxy in front
of the system under test. The pattern is the point, not any one tool.Stack-agnostic adaptation of the record-replay proxy pattern for deterministic external-API testing (record real responses with secrets redacted → replay offline → re-record on drift) from the Apache-2.0
google/test-server. Re-derived in prose; not vendored — the pattern is implemented by record-replay libraries across ecosystems.
code-organization.md for the project's UI component conventionsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
127 skills in this plugin
/accessibility-reviewUI accessibility (WCAG) review — keyboard operability, focus, ARIA semantics, color contrast, touch targets. Returns prioritized fixes. Distinct from performance/visual review./alembic-migrationsAlembic migration setup and patterns for async SQLAlchemy — async engine + run_sync in env.py, autogenerate, RLS/multi-tenant migrations. Use for alembic init, writing migrations, or debugging migration errors./anthropic-vertex-integrationClaude on Vertex AI via the AnthropicVertex SDK — lazy ADC client init, env-based project/region resolution, async helpers, backoff retry. Use when calling Claude via GCP Vertex AI (not direct Anthropic API).npx claudepluginhub ajyadav013/claude-kit --plugin claude-kitOther plugins' skills for the same job