.claude/skills/debug-agent/SKILL.md
Systematic evidence-based debugging using runtime logs. Generates hypotheses, instruments code with NDJSON logs, guides reproduction, analyzes log evidence, and iterates until root cause is proven with cited log lines. Use when the user reports a bug, unexpected behavior, or asks to debug an issue.
npx skillsauth add bitsocialnet/bitsocial-web debug-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are now in DEBUG MODE. You must debug with runtime evidence.
Why this approach: Traditional AI agents jump to fixes claiming 100% confidence, but fail due to lacking runtime information. They guess based on code alone. You cannot and must NOT fix bugs this way — you need actual runtime data.
Your systematic workflow:
#region debug log / #endregion markers and deleting those blocks (see Cleanup section). If failed: FIRST remove any code changes from rejected hypotheses (keep only instrumentation and proven fixes), THEN generate NEW hypotheses from different subsystems and add more instrumentationCritical constraints:
Run the debug server in daemon mode before any instrumentation. The --daemon flag starts the server in the background and exits immediately with the server info — no backgrounding or & required.
npx debug-agent --daemon
The command prints a single JSON line to stdout and exits:
{
"sessionId": "a1b2c3",
"port": 54321,
"endpoint": "http://127.0.0.1:54321/ingest/a1b2c3",
"logPath": "/tmp/debug-agent/debug-a1b2c3.log"
}
Capture and remember these values:
endpoint value (the HTTP endpoint URL where logs will be sent via POST requests)logPath value (NDJSON logs are written here)sessionId value (unique identifier for this debug session)If the server fails to start, STOP IMMEDIATELY and inform the user.
Example log entry:
{
"sessionId": "a1b2c3",
"id": "log_1733456789_abc",
"timestamp": 1733456789000,
"location": "test.js:42",
"message": "User score",
"data": { "userId": 5, "score": 85 },
"runId": "run1",
"hypothesisId": "A"
}
ENDPOINT and SESSION_ID with values from Step 0), even if filesystem access is available:fetch('ENDPOINT',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sessionId:'SESSION_ID',location:'file.js:LINE',message:'desc',data:{k:v},timestamp:Date.now()})}).catch(()=>{});
In non-JavaScript languages (Python, Go, Rust, Java, C, C++, Ruby), instrument by opening the log path in append mode using standard library file I/O, writing a single NDJSON line with your payload, and then closing the file. Keep these snippets as tiny and compact as possible (ideally one line, or just a few).
Decide how many instrumentation logs to insert based on the complexity of the code under investigation and the hypotheses you are testing. A single well-placed log may be enough when the issue is highly localized; complex multi-step flows may need more. Aim for the minimum number that can confirm or reject ALL your hypotheses. Guidelines:
Choose log placements from these categories as relevant to your hypotheses:
Each log must map to at least one hypothesis (include hypothesisId in payload).
Use this payload structure: {sessionId, runId, hypothesisId, location, message, data, timestamp}
REQUIRED: Wrap EACH debug log in a collapsible code region:
// #region debug log, // #endregion for JS/TS)FORBIDDEN: Logging secrets (tokens, passwords, API keys, PII)
DELETE request to the server endpoint to clear the log file before each run. For example: curl -X DELETE ENDPOINT (replace ENDPOINT with the endpoint value from Step 0).runId="post-fix" to distinguish verification runs from initial debugging runs.setTimeout, sleep, or artificial delays as a "fix"; use proper reactivity/events/lifecycles.When it is time to remove instrumentation (after verified fix or user request):
#region debug log markers (e.g., grep/ripgrep for #region debug log)#region debug log line through its corresponding #endregion line (inclusive)git diff to review all changes — confirm only your intentional fix remains and no stray debug code was missedThis is why wrapping every debug log in #region debug log / #endregion is mandatory — it enables deterministic cleanup.
| Method | Effect |
| --------------------------- | ------------------------------------------- |
| POST /ingest/:sessionId | Append JSON body as NDJSON line to log file |
| GET /ingest/:sessionId | Read full log file contents |
| DELETE /ingest/:sessionId | Clear the log file |
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
data-ai
Add or update i18next translation keys across all language files by spawning translator subagents. Use when the user asks to add a new translation, update existing translations, translate text, or work with i18n keys. Triggers on "translate", "add translation", "translation key", "i18n", "localization".
development
Test and debug Android wrapper features for Bitsocial Web using a local Android emulator or attached device. Manages emulator lifecycle, builds and installs the wrapper when commands are provided, runs focused checks, captures logcat diagnostics, and debugs WebView or TWA behavior. Use when the user asks to test Android, debug WebView behavior, run emulator tests, or says "test-apk".
testing
Review an open GitHub pull request, inspect bot and human feedback, decide which findings are valid, implement fixes on the PR branch, and merge the PR into master when it is ready. Use when the user says "check the PR", "address review comments", "review PR feedback", or "merge this PR".