agentleFS
SwastikPandey1024SwastikPandey1024/agentic-engineering-os/.agents/skills/debugging/SKILL.md

debugging

Skill1 starsChanged 3 months agoMITView on GitHub

Systematic 7-step root-cause debugging methodology, error trace diagnosis, environment vs application bug isolation, and regression test authoring.

  • Reads credentials

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

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

  • 0

    Common

    Most of the 104 edited versions we read keep these.

  • 6

    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:

    Use this skill when:

    line 10
  2. Distinctive:

    Never apply speculative patches or guess solutions without first isolating the root cause.

    line 15
  3. Distinctive:

    Look for the *first* failure in a cascading error stack.

    line 23
  4. Distinctive:

    Run git diff or git log -n 5 to inspect what modified right before the failure began.

    line 28
  5. Distinctive:

    NEVER modify multiple unrelated files during debugging: Keep debugging diffs isolated to the specific bug surface.

    line 111
  6. Distinctive:

    NEVER declare a bug fixed without a passing test: If you can't prove it failed before and passes now, it's not fixed.

    line 113

“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 Skill

1. When Should I Use This?

Use this skill when:

  • Diagnosing any runtime error, failing test, unhandled exception, 500 server crash, or unexpected behavior.
  • Investigating memory leaks, race conditions, or performance degradation.
  • Troubleshooting dependency, environment, or configuration mismatches.

Never apply speculative patches or guess solutions without first isolating the root cause.


2. What Should I Inspect First?

  1. Exact Error Traceback & Logs:
    • Inspect the full stack trace: file path, line number, exception type, and error message.
    • Look for the first failure in a cascading error stack.
  2. Environment & Context:
    • What was the exact input or state when the error occurred?
    • Does it fail locally, inside Docker, or only in CI?
  3. Recent Changes:
    • Run git diff or git log -n 5 to inspect what modified right before the failure began.

3. What Workflow Should I Follow?

1. REPRODUCE: Create a minimal, deterministic reproduction script or test case.
      ↓
2. OBSERVE: Capture exact inputs, outputs, log statements, and stack traces.
      ↓
3. CLASSIFY: Is it an Environment, Configuration, Data, or Logic bug?
      ↓
4. ROOT CAUSE: Trace the data flow backward to find where the bad state originated.
      ↓
5. MINIMAL FIX: Apply the smallest, surgically precise fix addressing the root cause.
      ↓
6. REGRESSION TEST: Turn the reproduction into a permanent test case.
      ↓
7. VERIFY: Run the entire test suite and verify no secondary regressions exist.

Bug Classification Guide

┌─────────────────┬───────────────────────────────────┬────────────────────────────────────┐
│ Bug Class       │ Common Symptoms                   │ Diagnostic Action                  │
├─────────────────┼───────────────────────────────────┼────────────────────────────────────┤
│ Environment     │ ModuleNotFoundError, CUDA out of  │ Check .venv, lockfiles, CUDA       │
│                 │ memory, missing shared C library  │ drivers, node_modules.             │
├─────────────────┼───────────────────────────────────┼────────────────────────────────────┤
│ Configuration   │ KeyError in settings, NoneType in │ Check .env, .env.example, Pydantic │
│                 │ DB URL, CORS blocked by origin    │ Settings schema defaults.          │
├─────────────────┼───────────────────────────────────┼────────────────────────────────────┤
│ Data Contract   │ ValidationError, schema mismatch, │ Check Pydantic/Zod schemas, null   │
│                 │ NaN in features, unparsed JSON    │ handling, API response types.      │
├─────────────────┼───────────────────────────────────┼────────────────────────────────────┤
│ Logic / State   │ AssertionError, off-by-one, race  │ Step through logic with debugger   │
│                 │ condition, stale cache hits       │ or inspect intermediate state.     │
└─────────────────┴───────────────────────────────────┴────────────────────────────────────┘

Python Debugging Techniques

# 1. Surgical Logging (Temporary Debugging)
import logging
logger = logging.getLogger("debug")
logger.setLevel(logging.DEBUG)

def process_data(records: list[dict]):
    logger.debug(f"Processing {len(records)} records. First record: {records[0] if records else None}")
    for idx, rec in enumerate(records):
        if "amount" not in rec or rec["amount"] is None:
            logger.error(f"Malformed record at index {idx}: {rec}")
            raise ValueError(f"Record at index {idx} missing 'amount'")
# 2. Permanent Regression Test
def test_regression_issue_42_null_amount_handled(client):
    """Ensure API returns 422 with meaningful error when amount is null."""
    payload = {"sender": "u1", "amount": None}
    response = client.post("/api/v1/transactions", json=payload)
    assert response.status_code == 422
    assert "amount" in response.text

4. What Decisions Should I Make?

Debugging ScenarioDecision Rule
Repeated Command FailureIf a command fails twice, STOP. Do not run it a 3rd time without altering the diagnosis or inputs.
Symptom vs CauseNever just wrap a broken line in a bare try...except: pass or if obj is not None. Find why obj was None in the first place.
Flaky / Non-deterministic FailuresCheck for unseeded random state, time-dependent logic (datetime.now() without mocking), race conditions in async tasks, or shared mutable global state.

5. What Should I Avoid?

  • NEVER suppress errors silently: Bare except: or discarding stack traces hides bugs and corrupts data downstream.
  • NEVER modify multiple unrelated files during debugging: Keep debugging diffs isolated to the specific bug surface.
  • NEVER leave temporary debug prints or hardcoded test values in production code: Clean up all print statements before committing.
  • NEVER declare a bug fixed without a passing test: If you can't prove it failed before and passes now, it's not fixed.

6. How Should I Verify Success?

# 1. Run the new regression test specifically
pytest tests/unit/test_regression.py -k "test_regression_issue" -v

# 2. Run the entire test suite to guarantee zero side-effects
pytest -v

# 3. Check git diff to ensure minimal, clean changes
git diff

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.