nextjs-debug-flow

Diagnoses and fixes Next.js bugs through a four-phase root-cause debugging workflow.

Updated Sep 8, 2026
One-click install
npx skills add https://github.com/lucaszhh/agents --skill nextjs-debug-flow-lucaszhh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nextjs-debug-flow
Source: https://github.com/lucaszhh/agents/tree/main/skills/front/nextjs-debug-flow
Command: npx skills add https://github.com/lucaszhh/agents --skill nextjs-debug-flow-lucaszhh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Debugging frontend bugs often leads to trial-and-error fixes that mask symptoms instead of resolving the actual cause. This Skill enforces a disciplined four-phase methodology (investigate, analyze, hypothesize, implement) so every bug fix in a Next.js/React Query codebase is grounded in a verified root cause and protected by a regression test. ## Core Features & Use Cases - Structured 4-Phase Debugging: Sequentially investigate evidence, trace the data flow (component → hook → service → query key), formulate a one-sentence root-cause hypothesis, then apply a minimal verified fix. - Mandatory TDD Regression Test: Requires a failing reproduction test before any production code change, and the fix is only complete when that test passes. - React Query Cache Inspection: Provides concrete techniques for diagnosing stale data, invalidation issues, and query key mismatches using queryClient state dumps. - Direct-to-Disk Reporting: Generates a structured debug report in .agents/debug/ using the included template, keeping chat output concise. - Use Case: A user reports "the procedures list crashes when empty." The Skill reproduces the bug, traces it to a service not handling a 204 response, writes a failing spec, applies a defensive fix, and documents the root cause. ## Quick Start Ask the agent to debug why a specific page or feature is failing and have it find the root cause before applying any fix.

Frequently Asked Questions about nextjs-debug-flow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a Next.js bug systematically instead of trial and error?▼

Follow a four-phase workflow: reproduce the bug and capture full error evidence, trace the data flow from component to service, write a one-sentence root-cause hypothesis, then apply a minimal fix. Never modify code before the hypothesis is validated.

How to diagnose React Query stale data and cache invalidation issues?▼

Identify the exact query key in the module's keys file, then dump query state with queryClient.getQueryState and getQueryData to inspect status, isStale, and dataUpdatedAt. Verify that mutations call invalidateQueries with matching keys.

Should I write a test before fixing a bug?▼

Yes. Create a regression test or reproduction script that fails and confirms the root-cause hypothesis before touching production code. The fix is only complete when that test passes, preventing the bug from recurring.

When should I not use a full root-cause debugging process?▼

Skip the four-phase cycle for obvious one-line typos, which can be fixed directly and verified with code review. Visual or design issues, type/lint errors, and infrastructure problems should also be routed to their respective specialized workflows.

Why does my component crash when the API returns an empty result?▼

Components often assume response data is always present and crash on null or undefined payloads, such as unhandled 204 responses. Verify the real backend response and add defensive handling for null, undefined, and empty arrays.