debug-and-fix
Skill0 starsChanged 3 months agoMITView on GitHub
Diagnose and optionally fix frontend JavaScript, TypeScript, and React bugs. Use when the user reports broken UI behavior, browser/runtime errors, React rendering or hook issues, hydration problems, failing frontend tests/builds, CSS interaction bugs, asks for a debug report, wants 2-4 hypotheses with file references, needs temporary console probes, or explicitly asks for a minimal verified frontend bug fix.
In this repository3 other files it gives its agents.
- compositionSkill
- explain-diffSkill
- handoff-noteSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 21 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use report mode when the user asks why something is failing, asks to investigate/debug/diagnose/report, or describes a bug without …
- Very specific: line 13
Use fix mode only when the user explicitly asks to fix, patch, repair, implement, or make code changes.
- Distinctive: line 14
If intent is ambiguous between diagnosis-only and editing, ask one concise clarification before changing non-debug code.
- Distinctive: line 23
If the cause is not trivial, provide 2-4 working hypotheses with brief arguments and file references before adding runtime probes.
- Distinctive: line 25
Stop when the root cause is confirmed enough to recommend a concrete fix.
- Distinctive: line 29
When the issue is not immediately obvious, write:
- Distinctive: line 40
Use file and symbol references.
- Distinctive: line 45
Use probes only when code reading cannot distinguish the hypotheses.
- Distinctive: line 47
Add at most 3 probes per round and at most 2 probe rounds before reassessing.
- Distinctive: line 48
Place probes at decision points: handler entry, branch selection, async response shape, render condition, state transition, or effect …
- Distinctive: line 50
Never log or ask the user to paste secrets, tokens, cookies, auth headers, passwords, full request bodies, environment variables, or PII.
- Distinctive: line 61
When asking the user to run with probes, give a strict paste contract:
- Distinctive: line 69
If probes remain while waiting for user output, state the exact files changed and that the work is not complete.
- Distinctive: line 76
If code answers the question, give a concise diagnosis with file references and a recommended fix.
- Distinctive: line 77
If not, give 2-4 hypotheses and either run a local check or add targeted probes with clear run/paste instructions.
- Distinctive: line 79
Remove placeholder-only sections.
- Distinctive: line 85
Do not refactor adjacent code or add fallback logic, backward compatibility layers, adapters, feature flags, or legacy support unless …
- Distinctive: line 86
Follow existing frontend patterns for state management, routing, query/cache usage, forms, styling, testing, and file organization.
- Distinctive: line 87
Add or update the smallest regression test when the repo has a clear pattern and the bug is testable.
- Distinctive: line 88
Run relevant verification discovered from repo scripts, docs, or CI.
- Distinctive: line 89
Remove all temporary debug probes/logs.
- Distinctive: line 94
Prefer investigating these areas when relevant:
- Distinctive: line 107
Keep final output short and evidence-based.
≈ “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
Debug and Fix
Diagnose frontend issues by reading the code first, then using the smallest runtime evidence needed. Work in one of two modes: report for diagnosis and collaboration, or fix for minimal verified code changes.
Mode Selection
- Use
reportmode when the user asks why something is failing, asks to investigate/debug/diagnose/report, or describes a bug without explicitly asking for code changes. - Use
fixmode only when the user explicitly asks to fix, patch, repair, implement, or make code changes. - If intent is ambiguous between diagnosis-only and editing, ask one concise clarification before changing non-debug code.
- In
reportmode, do not implement the fix. Temporary debug probes are allowed only to identify the issue and must be removed before claiming completion. - In
fixmode, remove all temporary probes/logs, implement the smallest confirmed fix, and run relevant verification.
Core Workflow
- Capture the failure shape: exact UI path/action, expected behavior, actual behavior, error text, browser/environment, input/state, and whether it reproduces.
- Inspect code before asking the user to run anything when the code can answer the question. Trace the route/component, props, state, hooks, effects, data loaders, query/cache keys, event handlers, forms, async boundaries, styling branches, and nearby tests/stories.
- Answer from code when possible. If code proves the root cause, report it or fix it without adding probes.
- If the cause is not trivial, provide 2-4 working hypotheses with brief arguments and file references before adding runtime probes.
- Confirm or reject hypotheses with the cheapest evidence: existing tests, type/lint/build output, local repro, browser checks, then targeted sanitized console probes.
- Stop when the root cause is confirmed enough to recommend a concrete fix.
Hypotheses
When the issue is not immediately obvious, write:
Working hypotheses:
1. H1: <possible cause> -- likely because <evidence>. Refs: `<file>`, `<symbol>`.
Confirm/rule out: <specific check>.
2. H2: ...- Rank hypotheses by cheapest confirmation path.
- Include 2-4 hypotheses, not a broad brainstorm.
- Use file and symbol references; line references are useful when stable.
- Mark a hypothesis confirmed only after code, runtime, or test evidence supports it.
Debug Probes
Use probes only when code reading cannot distinguish the hypotheses.
- Add at most 3 probes per round and at most 2 probe rounds before reassessing.
- Place probes at decision points: handler entry, branch selection, async response shape, render condition, state transition, or effect trigger.
- Log only sanitized discriminators: booleans, enum names, counts, lengths, route names, and redacted identifiers.
- Never log or ask the user to paste secrets, tokens, cookies, auth headers, passwords, full request bodies, environment variables, or PII.
- Use searchable IDs:
console.log("[DBG frontend issue=<slug> probe=H2 point=<point>]", {
hasUserId: Boolean(userId),
itemCount: items.length,
activeTab,
});When asking the user to run with probes, give a strict paste contract:
Run `<command or UI action>`.
Paste only lines containing `[DBG frontend issue=<slug>`.
Do not paste tokens, cookies, auth headers, passwords, full request bodies, environment variables, or PII.If probes remain while waiting for user output, state the exact files changed and that the work is not complete. Remove probes before the final report or fix whenever the session can continue.
Report Mode
Goal: identify the issue quickly with the user, using code first and targeted probes only when needed.
- State reproduction status:
REPRODUCED,PARTIAL, orNOT REPRODUCED. - If code answers the question, give a concise diagnosis with file references and a recommended fix.
- If not, give 2-4 hypotheses and either run a local check or add targeted probes with clear run/paste instructions.
- Once the root cause is confirmed, produce a report using
references/debug-report-template.md. - Remove placeholder-only sections. Include only evidence that mattered.
Fix Mode
- Confirm or derive the root cause before changing behavior.
- Make the smallest scoped edit that directly fixes the confirmed cause.
- Do not refactor adjacent code or add fallback logic, backward compatibility layers, adapters, feature flags, or legacy support unless explicitly requested.
- Follow existing frontend patterns for state management, routing, query/cache usage, forms, styling, testing, and file organization.
- Add or update the smallest regression test when the repo has a clear pattern and the bug is testable.
- Run relevant verification discovered from repo scripts, docs, or CI. Do not invent commands.
- Remove all temporary debug probes/logs.
- Final response: root cause, changed files, verification, and residual risk if any.
Frontend Checks
Prefer investigating these areas when relevant:
- UI events: handler binding, default prevention, disabled states, overlays, pointer events, stale closures.
- State and render: controlled inputs, derived state, memoization, keys, conditional guards, React StrictMode double invocation.
- Async and data: loading/error states, cache key mismatches, races, cancellation, stale query data, response shape, optimistic updates.
- Routing and hydration: route/search params, server/client boundaries, browser-only APIs during SSR, hydration mismatches.
- Styling and layout: overflow clipping, z-index, media/container queries, focus states, keyboard interaction.
- Verification: existing unit, component, E2E, Storybook, typecheck, lint, or build commands found in the repo.
Output Rules
- In
reportmode, usereferences/debug-report-template.mdfor final reports. - In
fixmode, do not use the full report template unless the user asks for it. - Keep final output short and evidence-based. Avoid unresolved open-ended TODOs unless you are explicitly waiting for user-provided probe output.
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.

