/claude-kit:frontend-repo-architecturefrom Claude Kit SDLC
Provides three production-proven React frontend architectures (module-scoped, feature-sliced, GraphQL-SSR) with API layer patterns, hand-written types, and state management conventions. Use when setting up a new React + Vite + TypeScript project or reviewing existing architecture.
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: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Encode three production-proven React frontend architectures and their API/state/types conventions: module-scoped monolith, feature-sliced, and GraphQL-SSR.
Shared stack baseline — All three models use React 18/19 + Vite + TypeScript strict (noUncheckedIndexedAccess: true) + Tailwind + react-router-dom + zustand + Sentry + vitest + @testing-library/react. Function components only; PascalCase files. (reference service A, reference service B, reference service C)
Three organizational models — Choose one:
src/modules/<feature>/{api,components,hooks,stores,types,pages,route.tsx} + src/routes.tsx aggregator) for large monoliths with parallel domains (reference service A)src/{features,pages,lib,stores,types,components/{ui,domain}} + lazy-loaded pages) for medium-sized apps with cross-cutting features (reference service B)src/{graphql,pages,components,contexts,stores,utils}) for schema-driven apps with SSR (reference service C)API layer: three patterns — Match your backend contract:
lib/api.ts exports ApiService + apiFetch/apiPost wrappers; modules/<x>/api/<x>Api.ts export useQuery/useMutation hooks; 401 → clear session + /login, 403 → /unauthorized) for envelope-based REST APIs (reference service A)lib/api.ts exports api.get/post/put/patch/delete; single refreshPromise race-guard; access_token/refresh_token in localStorage; errors as APIError class with .is(code) helpers) for flat JSON REST APIs (reference service B)graphql/client.ts with authLink (setContext adds Bearer token + x-org-id) + errorLink (UNAUTHENTICATED → /login if not on auth page) + createUploadLink; apollo-require-preflight: true header) for GraphQL (reference service C)Hand-written API types — NO OpenAPI/GraphQL codegen anywhere. Define types in types/<domain>.ts or modules/<feature>/types/<x>.types.ts; API response shapes are manually transcribed. Wire/FE adapter pattern (separate API DTOs from FE models) is optional but common. (reference service A, reference service B, reference service C)
State management: server vs client split — Use React Query or Apollo cache for server state (GET-equivalent, cache/refetch/dedup); use zustand or React Context for client state (UI toggles, active filters, form drafts). Never mix: storing fetched data in zustand bypasses caching/dedup (anti-pattern observed in reference service B). (reference service A uses react-query+zustand; reference service C uses Apollo+context+zustand)
Runtime config via window._conf — Inject config from a Vite plugin or /env-config endpoint; read in environment.ts as window._conf?.API_BASE_URL with fallbacks. Build-time import.meta.env.VITE_* is allowed but less flexible. (reference service A uses window.conf; reference service B/reference service C use VITE vars)
Token refresh race-guard — If using fetch + JWT refresh, maintain a single refreshPromise: Promise<boolean> | null; if already in progress, await it instead of firing a second refresh. Clear it in finally so next refresh can proceed. (reference service B lib/api.ts lines 218–262)
Path aliases — Configure tsconfig.app.json paths (@/*, @components/*, @features/*, @lib/*, @stores/*, @types/*, @pages/*) and mirror in vite.config.ts resolve.alias. (reference service B tsconfig.app.json lines 42–50)
Tailwind + Radix/Headless UI + cn() helper — Install tailwind-merge + clsx; export cn(...inputs) => twMerge(clsx(inputs)) in lib/utils.ts. Use Radix (reference service A) or Headless UI (reference service C) for unstyled primitives. (reference service A lib/utils.ts)
Module route.tsx aggregator (module-scoped model only) — Each module exports a fragment of <Route> elements in route.tsx; src/routes.tsx imports and composes them into appRoutes. (reference service A routes.tsx lines 1–80)
Lazy-loaded pages (feature-sliced model) — Use React.lazy(() => import('./pages/XPage')) + <Suspense fallback={<LoadingScreen />}> in the router for code-splitting. (reference service B pattern, not shown but conventional)
Vitest + testing-library + msw — Test files colocated in __tests__/ (reference service B: __tests__/{contracts,components,stores,hooks,pages}) or adjacent .test.tsx. Use msw (Mock Service Worker) for contract tests (API mocking at network layer). Apollo MockedProvider for GraphQL tests. (reference service B __tests__/contracts/*, vitest.config.ts, __tests__/setup.ts)
Sentry integration — Install @sentry/react; report 5xx API errors (not 4xx). Capture network errors (no response) and unhandled exceptions. (reference service B lib/api.ts lines 383–385, 398–401)
Module-scoped model (reference service A pattern):
src/
modules/
auth/
api/authApi.ts # exports useLoginMutation, useSessionQuery
components/LoginForm.tsx
hooks/useAuthGuard.ts
stores/authStore.ts # zustand slice
types/auth.types.ts
pages/LoginPage.tsx
route.tsx # exports authRoutes fragment
purchasing/
api/purchasingApi.ts
components/...
route.tsx
lib/
api.ts # ApiService + apiFetch/apiPost wrappers + DYNAMIC_HEADERS proxy
utils.ts # cn() helper, getActiveTenantId, etc.
routes.tsx # aggregates all module route fragments
environment.ts # window._conf reader
Feature-sliced model (reference service B pattern):
src/
features/
auth/ # domain logic, service, hooks
analytics/
documents/
pages/ # lazy-loaded route containers
LoginPage.tsx
DashboardPage.tsx
lib/
api.ts # fetch wrapper + refreshAccessToken race-guard
video.ts # service modules
stores/
video.ts # zustand with persist middleware
analytics.ts
types/
video.ts
error-codes.ts
components/
ui/ # generic primitives
domain/ # feature-specific composed components
GraphQL model (reference service C pattern):
src/
graphql/
client.ts # apolloClient with authLink + errorLink
queries/
jobs.ts # gql`` tagged templates
candidates.ts
pages/
JobsPage.tsx # 80+ inline routes (anti-pattern; refactor to router)
components/ # flat (anti-pattern; 50+ files)
contexts/
AuthContext.tsx # useAuth hook + ME_QUERY + LOGIN_MUTATION
OrgContext.tsx
stores/
authStore.ts # zustand
utils/
entry-server.tsx # SSR
ssr-server.ts
API layer snippets:
// Axios + react-query (reference service A)
export async function apiFetch<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T> {
const res = await ApiService.get(`${API_BASE}${path}`, { params: cleanParams, headers: DYNAMIC_HEADERS });
return res.data?.data ?? res.data;
}
// Fetch + token refresh (reference service B)
let refreshPromise: Promise<boolean> | null = null;
async function refreshAccessToken(): Promise<boolean> {
if (refreshPromise) return refreshPromise;
refreshPromise = (async () => { /* ... */ })();
return refreshPromise;
}
// Apollo links (reference service C)
const authLink = setContext((_, { headers }) => {
const token = localStorage.getItem('app_token');
const orgId = localStorage.getItem('app_org_id');
return { headers: { ...headers, authorization: token ? `Bearer ${token}` : '', ...(orgId && { 'x-org-id': orgId }) } };
});
const errorLink = onError(({ graphQLErrors }) => {
graphQLErrors?.forEach(({ extensions }) => {
if (extensions?.code === 'UNAUTHENTICATED' && !isAuthPage) {
localStorage.removeItem('app_token');
window.location.href = '/login';
}
});
});
lib/api directly)ui/ (primitives) and feature-scoped folders. (reference service C)refreshPromise, concurrent requests will fire multiple refresh calls. (implement reference service B pattern)window._conf) for multi-tenant values that change per deployment. (reference service A pattern is correct)lib/api.ts line 383)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
React, TypeScript, Vite, Tailwind, Zustand, TanStack Query, GraphQL
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