audit-fe-api
Skill9 starsChanged 42 days agoMITView on GitHub
Audit frontend API calls against backend implementation for contract alignment and network shape. Use when "API audit", "FE-BE contract", or "review frontend API integration". Live 4xx/5xx reproduction → debug-fe-be-integration.
- Reads credentials
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- kensaurus/skillsedited, first seen Oct 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- kensaurus/skills★ 969% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository165 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/approved-plan-execution.mdcCursor rule
- .cursor/rules/skill-workflows.mdcCursor rule
- .cursor/rules/verification-before-completion.mdcCursor rule
- llms.txtllms.txt
- audit-accessibilitySkill
- audit-agent-speedSkill
- audit-analyticsSkill
- audit-auth-flowsSkill
- audit-backend-architectureSkill
- audit-bundle-sizeSkill
- audit-cicdSkill
- audit-codemod-safetySkill
- audit-code-qualitySkill
- audit-code-reviewSkill
- audit-db-schemaSkill
- audit-doctrineSkill
- audit-env-paritySkill
- audit-gate-logicSkill
- audit-i18nSkill
- audit-infra-costSkill
- audit-langfuse-llmSkill
- audit-llm-securitySkill
- audit-monetization-iapSkill
- audit-payment-systemSkill
- audit-performanceSkill
- audit-realworldSkill
- audit-registry-listingSkill
- audit-resilienceSkill
- audit-responsiveSkill
- audit-securitySkill
- audit-skill-conflictsSkill
- audit-ui-statesSkill
- audit-uiux-design-systemSkill
- audit-ux-journeysSkill
- audit-uxSkill
- backend-db-performanceSkill
- backend-error-handlingSkill
- backend-observabilitySkill
- backend-patternsSkill
- backend-realtimeSkill
- burndown-fullSkill
- complete-everythingSkill
- data-pipelineSkill
- data-visualizationSkill
- debug-errorSkill
- debug-fe-be-integrationSkill
- debug-sentry-monitorSkill
- deploy-npmSkill
- deploy-verifySkill
- design-apiSkill
- design-canvasSkill
- design-emailSkill
- design-frontendSkill
- design-generative-artSkill
- design-mobile-firstSkill
- design-motionSkill
- design-prdSkill
- design-systemSkill
- design-themeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Read-only. Present findings.
- Very specific: line 117
Search <FRAMEWORK> API integration best practices [current year] (limit 5, web source), then one query per topic below.
- Distinctive: line 208
If the backend reads from Supabase, verify the DB schema matches what the frontend expects:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Frontend API Audit Skill
Degree of freedom: MIXED — Steps 0, 1, 3–6 [HIGH freedom]; Step 2
Sentry queries and schema SQL [LOW freedom — run exactly].
Read-only. Present findings; the Phase 6 snippets are the fix shape to recommend, not edits to make in this pass.
How to reason
- Observe — quote the FE call site, BE route, and response/error
- Interpret — does the contract match (path, method, params, types)?
- Classify — missing route / mismatch / untyped / cache-gap / correct
- Severity — 404/401/type-mismatch in prod = Critical; cache/prefetch = opportunity
Worked example
Observe:
useUserGETs/api/users/${id}; noapp/api/users/[id]/route.ts; Sentry 25× 404 in 14d. Interpret: FE calls a route the BE never registered. Classify: missing route (Critical). Severity: Critical — guaranteed 404. Finding:hooks/useUser.ts| GET/api/users/:id| Critical | no BE route.
Self-critique before reporting [LOW freedom — do not skip]
- Evidenced — FE file + BE route or Sentry event, not "probably 500"
- Contract, not taste — staleTime advice needs a freshness reason
- Severity justified — Critical = broken contract in prod
- Right owner — live 4xx/5xx repro →
debug-fe-be-integration; DB shape →audit-db-schema - Both sides named — every mismatch lists FE file and BE path (or NOT FOUND)
Step 0: Auto-Detect API Layer
0a. Detect Frontend Stack
| Dependency | Technology |
@tanstack/react-query | TanStack Query (React Query) |
swr | SWR |
@reduxjs/toolkit with createApi | RTK Query |
axios | Axios HTTP client |
ky | Ky HTTP client |
ofetch or $fetch | Nuxt/ofetch |
@trpc/client | tRPC (type-safe RPC) |
graphql-request or @apollo/client | GraphQL |
openapi-fetch or openapi-typescript | OpenAPI typed client |
0b. Detect Backend Stack
Glob: **/app/api/**/route.ts → Next.js App Router API routes
Glob: **/pages/api/**/*.ts → Next.js Pages Router API routes
Glob: **/src/routes/**/*.ts → Express/Hono/Fastify routes
Glob: **/server/api/**/*.ts → Nuxt server routes
Glob: **/src/app.py → Flask/Django
Glob: **/main.go → Go backend0c. Find API Service Files
Glob: **/services/*api*.ts → API service files
Glob: **/services/*service*.ts → Service files
Glob: **/api/*.ts → API client files
Glob: **/hooks/use*.ts → Custom hooks (may contain API calls)
Glob: **/lib/api*.ts → API client config
Glob: **/features/*/api.* → Feature-specific API files0d. Detect Dev Server Port
Grep: "dev" in package.json scripts → extract port (3000, 3001, 5173, 8080, etc.)
Grep: "PORT" in .env or .env.local0e. Record Discovery
API LAYER DISCOVERY:
- HTTP client: [axios/fetch/ky/ofetch]
- State management: [TanStack Query/SWR/RTK Query/none]
- API style: [REST/GraphQL/tRPC]
- Backend framework: [Next.js API routes/Express/Hono/etc.]
- API service files: [list paths]
- API hooks: [list paths]
- Dev server: http://localhost:[port]
- API docs: [path or URL if detected]Step 1: Research API Best Practices
1a. Context7 — Library Documentation
Resolve each major dependency (@tanstack/react-query, axios, zod), then query docs for
"staleTime cacheTime retry error handling optimistic updates". Call bodies:
references/research-calls.md §Context7.
1b. Firecrawl — Current API Patterns
Search <FRAMEWORK> API integration best practices [current year] (limit 5, web source), then one
query per topic below. Call body: references/research-calls.md §Firecrawl.
| Topic | Query |
| Caching | <state library> caching strategy staleTime production |
| Error handling | <framework> API error handling patterns retry |
| Type safety | <framework> type-safe API client OpenAPI Zod |
| Performance | frontend API request optimization batching deduplication |
Step 2: Check Production API Errors (Sentry)
2a. Find API-Related Production Errors
sentry:search_issues
{
"organizationSlug": "<ORG_SLUG>",
"query": "API errors 4xx 5xx fetch axios network from the last 14 days",
"projectSlugOrId": "<PROJECT_SLUG>",
"regionUrl": "<REGION_URL>",
"limit": 25
}2b. Find Slowest API Calls
sentry:search_events
{
"organizationSlug": "<ORG_SLUG>",
"projectSlug": "<PROJECT_SLUG>",
"regionUrl": "<REGION_URL>",
"dataset": "spans",
"query": "span.op:http.client",
"sort": "-span.duration",
"limit": 15
}2c. Cross-Reference with Frontend Code
For each Sentry error: identify the endpoint, Grep the FE caller, check error/retry/types.
Phase 3: Discover Frontend API Calls
3a. Find All API Calls
Grep (not bash grep):
Grep: pattern "fetch\(|axios\.|api\.(get|post|patch|put|delete)" glob "*.{ts,tsx,js,jsx}"
Grep: pattern "useQuery|useMutation|useInfiniteQuery|useSuspenseQuery" glob "*.{ts,tsx}"
Grep: pattern "createApi|injectEndpoints" glob "*.{ts,tsx}"3b. Create API Call Inventory
| File | Function/Hook | Method | Endpoint | Params | Used By |
services/user.ts | getUsers | GET | /api/users | page, limit | UserList.tsx |
hooks/useUser.ts | useUser | GET | /api/users/:id | id | UserProfile.tsx |
Phase 4: Validate Against Backend
4a. Check Endpoint Existence
Grep: pattern "<ENDPOINT_PATH>" glob "*.{ts,js,py,go,rb}" — in backend sourceApp Router: app/api/<path>/route.ts must exist.
4b. Check Parameter Correctness
| Check | How |
| Required params sent | Compare FE call params with BE validation schema (Zod, Yup, Joi) |
| Naming convention match | FE camelCase vs BE snake_case — check if transform exists |
| Type match | FE sends string but BE expects number, or vice versa |
| Body shape match | Compare FE request body with BE expected schema |
4c. Verify Schema with Supabase MCP
If the backend reads from Supabase, verify the DB schema matches what the frontend expects:
supabase:execute_sql
{
"query": "SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = '<TABLE>' ORDER BY ordinal_position"
}Compare columns/types to FE TypeScript interfaces.
Phase 5: Identify Issues
Critical Issues
| Issue | Impact | Detection |
| Endpoint does not exist | 404 errors | Grep backend for route — not found |
| Missing required parameter | 500/422 errors | Compare FE params with BE schema |
| Wrong HTTP method | 405 errors | FE uses GET, BE expects POST |
| Auth header missing | 401 errors | Check API client interceptor |
| Type mismatch | Runtime errors | FE interface vs BE response shape |
Warnings
| Issue | Impact | Detection |
| Parameter name mismatch | Silently ignored params | camelCase vs snake_case comparison |
| Deprecated endpoint | Future breakage | Version markers in BE routes |
| Missing error handling | Poor UX | useQuery without error state handling |
| No loading state | Poor UX | No isLoading / isPending check |
Optimization Opportunities
| Issue | Impact | Detection |
| Duplicate requests | Wasted bandwidth | Same queryKey in multiple components |
| No caching configured | Slow UX | staleTime not set (default 0) |
| No request batching | Too many requests | N+1 query pattern in lists |
| Missing prefetch | Slow navigation | No prefetchQuery on hover/focus |
| No optimistic updates | Slow mutations | Mutation waits for server response |
Phase 6: Frontend Optimizations
6a. Caching Strategy
- Set
staleTimeper query from the data's real freshness need (user profile ~10 min, settingsInfinity); default 0 refetches on every mount.
const { data } = useQuery({
queryKey: ['user', userId],
queryFn: () => getUser(userId),
staleTime: 1000 * 60 * 10, // User data: 10 minutes
});6b. Optimistic Updates
onMutate: cancel in-flight queries, snapshotgetQueryData,setQueryDatato the new value, return the snapshot.onError: restore the snapshot;onSettled: invalidate the key.
6c. Prefetching
queryClient.prefetchQuerywith the same key and fn as the detail view, on linkonMouseEnter/focus.
6d. Error Handling
retry: 3with exponentialretryDelaycapped at 30 s; renderisLoading,isError, and empty branches, in that order.
6e. Response Validation (Zod)
- Define the schema once,
type User = z.infer<...>, andUserSchema.parse(response.data)inside the service function.
Full code for 6a–6e: references/fix-patterns.md.
Output Template
Report sections, in order: header (date, framework, client, state library) → Production Error Summary (Sentry) → Critical Issues → Warnings → Optimization Opportunities (caching, prefetching, batching) → API Inventory (endpoint, method, FE file, BE route, status) → Type Safety Status → Research Findings Applied → Next Steps checklist.
Full template: references/report-template.md.
Related
debug-fe-be-integration— live 4xx/5xx reproduction from BE logsaudit-db-schema— FE types vs DB columnsdebug-sentry-monitor— production error volume on the same endpoints
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

