agentleFS
renathoazrenathoaz/arsyn/skills/debugging/SKILL.md

debugging

Skill2 starsChanged 8 months agoMITView on GitHub

Structured root-cause investigation for bugs and failures.

116 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use Problem-Solving Techniques, media-processing and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • truongtv22Skill

    Problem-Solving Techniques

    Apply systematic problem-solving techniques for complexity spirals (simplification cascades), innovation blocks (collision-zone thinking), recurring patterns (meta-pattern recognition), assumption constraints (inversion exercise), scale uncertainty (scale game), and dispatch when stuck. Techniques derived from Microsoft Amplifier project patterns adapted for immediate application.

    Also in 4 projects that use this

  • mrgoonieSkill

    media-processing

    Process multimedia files with FFmpeg (video/audio encoding, conversion, streaming, filtering, hardware acceleration) and ImageMagick (image manipulation, format conversion, batch processing, effects, composition). Use when converting media formats, encoding videos with specific codecs (H.264, H.265, VP9), resizing/cropping images, extracting audio from video, applying filters and effects, optimizing file sizes, creating streaming manifests (HLS/DASH), generating thumbnails, batch processing images, creating composite images, or implementing media processing pipelines. Supports 100+ formats, hardware acceleration (NVENC, QSV), and complex filtergraphs.

    Also in 6 projects that use this

  • JetBrainsSkill

    ssr

    Guide for using Structural Search and Replace in IntelliJ. Use when creating or modifying SSR inspections or search patterns.

    Also in 3 projects that use this

  • mrgoonieSkill

    web-frameworks

    Build modern full-stack web applications with Next.js (App Router, Server Components, RSC, PPR, SSR, SSG, ISR), Turborepo (monorepo management, task pipelines, remote caching, parallel execution), and RemixIcon (3100+ SVG icons in outlined/filled styles). Use when creating React applications, implementing server-side rendering, setting up monorepos with multiple packages, optimizing build performance and caching strategies, adding icon libraries, managing shared dependencies, or working with TypeScript full-stack projects.

    Also in 6 projects that use this

  • DevNewbie1826Skill

    remove-ai-slops

    Remove AI-generated code slop from branch changes or an explicit file list while preserving behavior, including junk tests (prose pins, source greps, copied inventories, mock echoes), each proven by its class rule before a cut. Use when asked to remove slop, clean AI code, deslop, clean up generated code, strip slop, prune junk tests, or review generated-code cleanup. Start by locking behavior with regression tests, then use the category and workflow references.

    Also in 3 projects that use this

  • DevNewbie1826Skill

    programming

    MUST USE for work on Python, Rust, TypeScript, JavaScript, or Go source files and project manifests, and whenever a test or spec file is written, reshaped, reviewed, or deleted. Triggers: write or edit code; add, change, or delete a test; test authoring gate; junk tests; new project; Go HTTP service (gin lane); Bubble Tea TUI; CJK IME; Connect-Go RPC; sqlc or pgx; branded IDs; exhaustive matching; unsafe Rust; Miri; oversized file; refactoring; logging, log levels, structured logging, or observability; arena, allocator, bumpalo, const fn, const generics, compile-time programming, zero-allocation APIs, bitfields, repr, scope guards, errdefer-style cleanup, Zig-like patterns, zero-copy parsing, packed data, or FFI; Rust public API design or macros.

    Also in 3 projects that use this

  • +6 more from mrgoonie

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 104 edited versions we read keep these.

  • 8

    Distinctive

    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:

    If Phase 1 is incomplete, no fix proposals allowed.

    line 14
  2. Distinctive:

    If non-reproducible: gather more data — do not guess

    line 40
  3. Distinctive:

    When the system spans multiple layers (CI pipeline, API chain, build tooling):

    line 48
  4. Distinctive:

    If implementing a known pattern, read the reference implementation completely — no skimming

    line 67
  5. Distinctive:

    Do not layer fixes on top of each other

    line 78
  6. Distinctive:

    Stop and reconsider fundamentals: Is the current approach viable, or is inertia the only reason to continue?

    line 96
  7. Distinctive:

    Use this when: the investigation touches 5+ files, spans multiple tool calls, or you catch yourself re-reading earlier findings.

    line 125
  8. Distinctive:

    If any of these thoughts arise, return to Phase 1 immediately:

    line 129

“Common” is measured: kept by at least 6 in 10 of the 104 edited versions of this file we could read. “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

Debugging

Constraint

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION

If Phase 1 is incomplete, no fix proposals allowed. Period.

When to Activate

Any technical malfunction: test failures, runtime errors, unexpected behavior, performance regressions, build breaks, integration mismatches.

Activate especially when:

  • Time pressure makes guessing tempting
  • An "obvious quick fix" presents itself
  • Previous attempts have not resolved the issue
  • The failure mechanism is not fully understood

Investigation Protocol

Complete each phase sequentially. Do not skip ahead.

Phase 1: Root Cause Investigation

1. Read error output thoroughly

  • Full stack traces, not just the top frame
  • Note line numbers, file paths, error codes
  • Warnings preceding the error often contain the answer

2. Reproduce consistently

  • Determine exact trigger steps
  • Confirm it repeats reliably
  • If non-reproducible: gather more data — do not guess

3. Check recent changes

  • git diff, git log --oneline -10
  • New dependencies, config modifications, environment drift

4. Instrument multi-component boundaries

When the system spans multiple layers (CI pipeline, API chain, build tooling):

For EACH component boundary:
  - Log inputs entering the component
  - Log outputs leaving the component
  - Verify config/env propagation across the boundary
  - Run once, collect evidence, identify the failing seam

5. Trace data flow backward

See references/root-cause-tracing.md for the full technique.

Short version: start at the crash site, ask "where did this bad value come from?", trace upstream until you reach the originating mutation. Fix there.

Phase 2: Pattern Comparison

  1. Locate analogous working code in the same codebase
  2. If implementing a known pattern, read the reference implementation completely — no skimming
  3. Diff working vs. broken — list every difference, however trivial
  4. Map dependencies: config, environment, shared state, ordering assumptions

Phase 3: Hypothesis Testing

  1. State one hypothesis explicitly: "X causes the failure because Y"
  2. Make the smallest possible change to test it — one variable only
  3. Evaluate:
    • Confirmed → proceed to Phase 4
    • Refuted → form a new hypothesis from the new evidence
    • Do not layer fixes on top of each other

Phase 4: Fix and Verify

  1. Write a failing test that captures the bug (use arsyn:tdd if available)
  2. Apply a single fix targeting the root cause — no bundled refactoring
  3. Run the full relevant test suite — not just the new test
  4. If the fix fails:
    • Count total attempts
    • Under 3: return to Phase 1 with new data
    • 3 or more: stop fixing. The problem is likely architectural.

On 3+ failed attempts: Indicators of structural mismatch:

  • Each fix surfaces new coupling in a different location
  • Fixes demand large-scale refactoring to implement
  • Each patch spawns new symptoms elsewhere

Stop and reconsider fundamentals: Is the current approach viable, or is inertia the only reason to continue? Escalate for discussion before further changes.

File-System-as-State Pattern

For investigations spanning many files or long debugging sessions, offload findings to disk instead of relying on context memory:

# Initialize a debug log at the start of investigation
echo "# Debug Log — $(date -Iminutes)" > debug-log.md

# Append findings as you go
echo "## Phase 1 — Error Analysis" >> debug-log.md
echo "- Stack trace points to auth.ts:142" >> debug-log.md
echo "- Token is null at middleware boundary" >> debug-log.md

# Append hypotheses and results
echo "## Hypothesis 1: Token not forwarded by proxy" >> debug-log.md
echo "- Result: REFUTED — proxy logs show token present" >> debug-log.md

# Later, grep across your own findings instead of scrolling context
grep "REFUTED\|CONFIRMED" debug-log.md

Benefits:

  • Survives context window limits in long sessions
  • Grep-searchable — faster than re-reading conversation history
  • Shareable artifact for post-incident review
  • Prevents re-testing already-refuted hypotheses

Use this when: the investigation touches 5+ files, spans multiple tool calls, or you catch yourself re-reading earlier findings.

Stop Signals

If any of these thoughts arise, return to Phase 1 immediately:

  • "Quick fix now, investigate later"
  • "Let me try changing X and see"
  • "Multiple changes at once, then run tests"
  • "Skip the test, I'll verify manually"
  • "It's probably X" (without evidence)
  • "I don't fully understand but this might work"
  • Proposing solutions before tracing data flow
  • "One more attempt" after 2+ failures

Common Rationalizations

RationalizationCounter
"Too simple for a process"Simple bugs have root causes. The protocol is fast for simple cases.
"Emergency — no time"Structured investigation is faster than guess-and-check cycling.
"Let me try this first"The first attempted fix sets the pattern. Start correctly.
"I'll add the test after"Untested fixes regress. Test-first proves resolution.
"Multiple fixes save time"Prevents isolating what worked. Introduces new defects.
"I see the problem"Seeing symptoms is not understanding causation.
"One more try" (after 2+ failures)3+ failures signal structural issues, not missing patches.

Quick Reference

PhaseCore ActivityExit Criterion
1. Root CauseRead errors, reproduce, trace dataUnderstand what fails and why
2. PatternFind working analogues, diff against brokenDifferences catalogued
3. HypothesisState theory, test minimallyConfirmed or replaced
4. FixFailing test, single fix, verifyBug resolved, suite green

Supporting References

  • references/root-cause-tracing.md — backward tracing through call stacks
  • references/defense-in-depth.md — multi-layer validation after root cause is found
  • references/condition-based-waiting.md — replace arbitrary sleeps with condition polling

Gotchas

  • Fix-first impulse — Modifying code before understanding the root cause. The constraint is absolute: investigate first.
  • Assuming the obvious — "It's probably X" leads to symptom patches. Follow evidence chains, not intuition.
  • Symptom suppression — Adding null guards around crashes instead of determining why the value is null.
  • Skipping reproduction — Attempting fixes without a reliable trigger. No reproduction means no verification.
  • Confirmation bias — Seeking only evidence that supports the first theory. Actively attempt to disprove each hypothesis.
  • Scope drift — "While I'm here, let me also..." Stay on the reported defect. File separate issues for other findings.
  • Context amnesia — In long sessions, forgetting earlier findings and re-testing refuted hypotheses. Use the file-system-as-state pattern to persist investigation state.
  • Layered patches — Applying fix #2 on top of fix #1 without reverting. Each hypothesis test should start from a clean baseline.

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.