agentleFS
LeonxLJXLeonxLJX/web-engineer-skills/skills/browser-debugging/SKILL.md

browser-debugging

Skill0 starsChanged 2 months agoMITView on GitHub

A systematic frontend debugging workflow — reproduce first, isolate second, bisect third, verify with DevTools evidence. Covers the classic trapdoors: stale closures, z-index cascades, hydration mismatches, event listener leaks. Use when something is broken and guessing isn't working.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Double effects in dev StrictMode: don't "fix" by removing StrictMode.

    line 32

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend debugging: evidence over vibes

The loop

Reproduce → isolate → hypothesis → experiment → verify. One variable at a time; write down what you ruled out. If you can't reproduce it, you're not debugging — you're gambling.

  1. Reproduce reliably: exact URL/state/steps, same viewport, throttled CPU/network if intermittent. Save it as a test when possible.
  2. Isolate the layer: is it data (network), logic (JS), paint (CSS), or integration (build/env)? DevTools first — console, Network, Elements, Performance — before touching code.
  3. Bisect: git history (git bisect) for regressions; component tree (comment out halves) for render bugs; feature flags for config.

Network first (it usually is)

  • Filter to the failing request; check status, payload, and timing. A 200 with wrong body is a data bug, not an HTTP bug.
  • Reproduce the request in isolation (curl/HTTP file) — separates backend from frontend.
  • Watch for the classics: CORS preflight failing, cookie not sent (SameSite), stale SW cache, duplicated requests from double effects.

Render/UI bugs

  • Element pick → Computed styles: which rule won, and why (specificity/layers). @layer order and inherited vs set properties explain 80% of "my CSS doesn't apply".
  • Z-index: it's not a number war, it's stacking contexts — find the ancestor creating a context (transform/filter/opacity/will-change) before touching z-values.
  • Layout shift: Performance panel → Experience track highlights the shifting element.
  • "Works in dev, broken in prod": check minified behavior differences, env config, CDN caching of stale HTML/assets.

Reactivity bugs (the big three)

  1. Stale closure: a callback captured old state/props. Evidence: value is right in render, wrong in handler. Fix: include the dep, or latest-value ref.
  2. Double effects in dev StrictMode: don't "fix" by removing StrictMode; make the effect idempotent (proper cleanup) — prod runs once, dev twice by design.
  3. Hydration mismatch (Next/SSR): server and client rendered different trees. Usual causes: Date.now()/Math.random()/locale-dependent formatting during render, browser-only APIs. Fix: compute in effects, or suppressHydrationWarning only where truly cosmetic.

Leaks & jank

  • Memory: Allocation instrumentation on the suspect flow; look for detached DOM held by closures, listeners never removed, timers without cleanup.
  • Jank: Performance recording → long tasks → what's blocking (layout thrash from read/write interleaving? giant sync DOM update?).

Verification

The bug is fixed when the failing behavior is covered by a regression test or a checklist entry, not when it "looks right on my machine". Write the test while the repro is fresh.

Definition of done (agent checklist)

  • Root cause identified with DevTools evidence, not pattern-matching
  • One-variable-at-a-time changes; ruled-out causes noted
  • Regression test or documented checklist added
  • Similar code paths audited for the same bug class

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.