/kenji:debug-fe-be-integrationfrom kenji skills
Diagnoses frontend↔backend contract failures by tracing requests, server logs, validation, auth, and responses on both sides. Use for API 4xx/5xx, mismatched payloads, or 'frontend and backend disagree'.
Ships in kenji skills. 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.
None: SKILL.md is the whole skill.
Degree of freedom: MIXED. Which side is wrong [HIGH freedom];
trace-both-sides probes [LOW freedom — run exactly].
Systematic approach to debugging frontend-backend integration issues by analyzing backend logs, production errors, and source code to identify root causes and fix both sides.
| Skill | Owns |
|---|---|
| debug-fe-be-integration (this) | Live FE and BE contract failures, traced on both sides |
debug-error | One bug in one layer, hypotheses and runtime evidence first |
audit-fe-api | Contract-alignment audit of frontend API calls against backend implementation |
Observe: FE
GET /api/reports→ 500; BE logZodError: expected string, received undefinedonyear. Interpret: FE omittedyear; BE schema required it with no default. Classify: missing-param — fix FE call and add a clear BE 422/default. Verify: same request returns 200 with the year bound; both sides updated.
debug-error; proactive contract audit → audit-fe-apiBefore debugging, discover the project's architecture.
Read package.json and look for:
| Signal | Framework |
|---|---|
next | Next.js |
nuxt | Nuxt |
@remix-run/react | Remix |
@sveltejs/kit | SvelteKit |
vite + react | Vite React SPA |
@angular/core | Angular |
Glob: **/app/api/**/route.ts → Next.js App Router
Glob: **/pages/api/**/*.ts → Next.js Pages Router
Glob: **/server/api/**/*.ts → Nuxt server
Glob: **/src/routes/**/*.ts → Express/Hono/Fastify
Glob: **/src/app.ts or **/src/index.ts → Node backend entry
Glob: **/main.py or **/app.py → Python backend
Glob: **/main.go → Go backend
| Signal | Technology |
|---|---|
@trpc/server | tRPC (type-safe, no REST audit needed) |
graphql or @apollo/server | GraphQL |
zod in BE dependencies | Zod validation |
joi in BE dependencies | Joi validation |
yup in BE dependencies | Yup validation |
class-validator | NestJS-style validation |
pydantic | Python Pydantic validation |
Grep: pattern "router\.(get|post|patch|put|delete)" glob "*.{ts,js}" — Express-style
Grep: pattern "app\.(get|post|patch|put|delete)" glob "*.{ts,js}" — Hono/Express
Grep: pattern "export (async function |const )(GET|POST|PATCH|PUT|DELETE)" glob "**/route.ts" — Next.js
Grep: pattern "defineEventHandler" glob "*.{ts,js}" — Nuxt/H3
STACK DISCOVERY:
- Frontend: [framework + version]
- Backend: [framework + version]
- API style: [REST / GraphQL / tRPC]
- Validation: [Zod / Joi / Yup / Pydantic / none]
- Route files: [pattern and locations]
- Controller files: [pattern and locations]
- Schema files: [pattern and locations]
Search the framework and validation library as written — recognizing the name is not knowing its current API or error shape.
firecrawl:firecrawl_search
{
"query": "<FE_FRAMEWORK> <BE_FRAMEWORK> API integration debugging best practices [current year]",
"limit": 5,
"sources": [{ "type": "web" }]
}
Additional targeted searches:
| Topic | Query |
|---|---|
| Validation errors | <VALIDATION_LIB> error handling API response best practices |
| CORS issues | <BE_FRAMEWORK> CORS configuration debugging |
| Type mismatches | TypeScript API type safety frontend backend shared types |
context7:resolve-library-id
{
"libraryName": "<VALIDATION_LIB>",
"query": "error handling error messages custom errors"
}
sentry:search_issues
{
"organizationSlug": "<ORG_SLUG>",
"query": "API integration errors 4xx 5xx validation from the last 7 days",
"projectSlugOrId": "<PROJECT_SLUG>",
"regionUrl": "<REGION_URL>",
"limit": 25
}
If the project has separate FE and BE Sentry projects, check both:
Read the output of the terminal running the backend (npm run dev or equivalent) — in Cursor, terminals/*.txt; in Claude Code, the shell or log file you started it from.
Look for errors in the last 3-5 minutes:
4xx errors (400, 401, 403, 404, 422)5xx errors (500, 502, 503)ZodError / ValidationError — validation failuresAppError / custom error classes| Category | Log Pattern | Root Cause |
|---|---|---|
| Missing parameter | ZodError: expected string, received undefined | FE not sending required param |
| Wrong type | ZodError: invalid_type | FE sending wrong type |
| Endpoint not found | 404 /api/... | FE calling non-existent endpoint |
| Auth error | 401 Unauthorized | Missing or invalid token |
| Permission error | 403 Forbidden | User lacks permission |
| Validation error | 422 Unprocessable | Invalid request body |
| Server error | 500 Internal | Backend bug |
| CORS error | CORS policy | Missing CORS configuration |
For each error found, use Grep to locate:
Frontend call:
Grep: pattern "<ERROR_ENDPOINT>" glob "*.{ts,tsx,js,jsx}"
Backend route:
Grep: pattern "<ERROR_ENDPOINT>" glob "*.{ts,js,py,go,rb}" — in backend source
Validation schema:
Grep: pattern "z\.object|z\.string|z\.number" in the controller/route file
SemanticSearch: "validation schema for <ENDPOINT>" target: [backend directory]
For each error, read the complete request chain:
If the error might be data-related:
supabase:execute_sql
{
"query": "SELECT * FROM <TABLE> WHERE <CONDITION> LIMIT 5"
}
Check:
For each error, provide:
### Issue: [Endpoint] — [Error Type]
**Current FE Call:**
[show the actual code from Grep results]
**Correct FE Call:**
[show the fixed code]
**Why:** [explanation of required parameter/type/format]
**Files to Update:** [list specific files]
For each error, consider backend improvements — as recommendations in the report. Apply the fix for the contract failure at hand; the robustness enhancements ship only when the user asks, and every edit is surgical.
### Backend Enhancement: [Endpoint]
**Current Behavior:** Returns 500 with cryptic validation error
**Recommended Enhancement:**
- Add default value for optional params
- Add clear error message for required params
- Add type coercion where appropriate
- Return helpful 422 instead of 500
Example backend enhancement pattern:
// Before: bare schema, cryptic error on missing param
const schema = z.object({
year: z.string(),
});
// After: defaults, coercion, clear errors
const schema = z.object({
year: z.string({
required_error: "year is required (format: YYYY)"
}).default(() => new Date().getFullYear().toString()),
page: z.coerce.number().default(1).int().positive(),
limit: z.coerce.number().default(10).int().max(100),
});
{ data } or { error })## Frontend-Backend Integration Debug Report
**Analyzed:** [timestamp range]
**Frontend:** [framework]
**Backend:** [framework]
**API style:** [REST/GraphQL/tRPC]
---
### Production Errors (Sentry)
| Endpoint | Error | Events (7d) | Root Cause |
|----------|-------|-------------|------------|
| [endpoint] | [error msg] | [count] | [FE/BE/Data] |
---
### Backend Log Errors
| Endpoint | Method | Status | Error Type | Root Cause |
|----------|--------|--------|------------|------------|
| `/api/...` | GET | 500 | ZodError | Missing `year` param |
| `/api/...` | GET | 404 | Not Found | Endpoint not implemented |
---
### Critical Issues (Must Fix)
#### 1. [Endpoint] — [Status Code]
- **Error:** [error message]
- **Root Cause:** [explanation]
- **Frontend Fix:** [what FE needs to change, with code]
- **Backend Enhancement:** [optional BE improvement, with code]
- **Files:** FE: [path], BE: [path]
---
### Warnings (Should Fix)
#### 1. [Issue description]
- **Impact:** [what happens if not fixed]
- **Recommendation:** [how to fix]
---
### Backend Enhancements (Robustness)
#### 1. [Enhancement description]
- **Current:** [current behavior]
- **Recommended:** [better approach]
- **Benefit:** [why this helps]
---
### Research Findings Applied
- [Pattern from research]: [how it applies]
- [Best practice]: [gap identified]
---
### Summary Table
| Endpoint | Issue | Fix Required | Priority |
|----------|-------|--------------|----------|
| `/api/...` | Missing param | Frontend | HIGH |
| `/api/...` | No error handling | Both | MEDIUM |
| `/api/...` | Endpoint 404 | Remove or implement | LOW |
---
### Next Steps
1. [ ] Frontend fixes: [action items with files]
2. [ ] Backend enhancements: [action items with files]
3. [ ] Re-test: [verification steps]
4. [ ] Monitor: Check Sentry after deploy for regression
Symptom: ZodError: expected string, received undefined
FE Fix: Add the missing parameter to the API call.
BE Fix: Add a default value or a clear error message.
Symptom: 404 /api/endpoint-name
Debug steps:
Grep for the endpoint path in backend route filesSymptom: 500 Internal Server Error with no useful message
Debug steps:
Symptom: CORS policy: No 'Access-Control-Allow-Origin'
Debug steps:
Symptom: Same API called multiple times, or stale data shown
Debug steps:
audit-fe-api: Proactive audit from FE code perspective (run first).debug-sentry-monitor: Triage and fix Sentry errors from production.audit-db-schema: Verify DB schema matches API expectations.What SKILL.md sets; muted values are Claude Code's defaults
highnpx claudepluginhub kensaurus/skills --plugin kenji162 skills in this plugin
/audit-accessibilityWCAG 2.2 AA audit via playwright-cli: axe-core, keyboard, contrast, target size, focus, ARIA. Use when "audit accessibility", "check a11y", "WCAG audit", "check keyboard nav", or "test screen reader".
/audit-agent-speedMeasure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans. Use when "Claude is slow" or "CPU is pinned". App speed → audit-performance.
/audit-analyticsRead-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events. Use when "audit our analytics", "are we tracking the right events", or "funnel instrumentation".
Other plugins' skills for the same job