debug-logs

Diagnose runtime bugs by iteratively adding targeted DEBUG() log calls and reading output.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/adam-s/api-interceptor --skill debug-logs-adam-s
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: debug-logs
Source: https://github.com/adam-s/api-interceptor/tree/main/.claude/skills/debug-logs
Command: npx skills add https://github.com/adam-s/api-interceptor --skill debug-logs-adam-s

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When a bug cannot be solved by reading code alone—such as frozen counters, failed browser connections, empty traffic captures, or broken WebSocket updates—this Skill provides a methodical, hypothesis-driven process for observing runtime behavior with targeted logging instead of guessing. ## Core Features & Use Cases - DEBUG() Logging Utility: Uses a shared DEBUG() function from @interceptor/shared (server) or @/lib/debug (client) with lazy factory arguments so expensive computations only run when logging is enabled. - Iterative Narrowing Workflow: Guides a six-step loop—hypothesize, add 2-4 targeted logs, reproduce and read logs, narrow or widen scope, clean up, and clear log files. - Use Case: When an SSE counter freezes because a dedup comparison sets lastJson before the check, add DEBUG() calls in tick() and broadcast(), read the log at /tmp/interceptor-debug/, identify the faulty comparison, fix it, and remove the temporary logs. ## Quick Start Ask Claude to debug the frozen SSE counter by adding targeted DEBUG() logs, reproducing the issue, and reading the debug log output.

Frequently Asked Questions about debug-logs

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

FAQPage Schema
How do I debug a bug that can't be fixed by reading code?▼

Use iterative debug logging: form a hypothesis about the faulty code path, add 2-4 targeted DEBUG() calls at function entries and decision points, reproduce the bug, read the log output, then narrow or widen scope until the root cause is clear.

How do I add debug logging in TypeScript server and client code?▼

Import DEBUG from @interceptor/shared for server and API code, or from @/lib/debug for client components marked 'use client'. Never import @interceptor/shared in browser code. Pass data as a factory function so computation only runs when logging is enabled.

Where does DEBUG() write log output?▼

DEBUG() writes to /tmp/interceptor-debug/debug-YYYY-MM-DD.log and to the console in cyan. You can tail the file live with tail -f /tmp/interceptor-debug/debug-*.log while reproducing the bug.

Why is my DEBUG() output empty or missing?▼

DEBUG is disabled when NODE_ENV is test or production, so verify the environment first. Also check that the /tmp/interceptor-debug directory exists with ls -la, and confirm the code path containing your DEBUG() call actually executes.

When should I remove DEBUG() calls after fixing a bug?▼

Remove calls that were only useful for the current investigation. Keep a call only if it logs values useful for future debugging, sits at a hard-to-reason decision point, or captures otherwise invisible state. When in doubt, remove it.