agentsclimarketplace

Athena debug

Skill bencrooks-dev/Athena/skills/athena-debug

Systematic debugging with hypothesis tracking, evidence collection, and checkpoint management. Use when encountering any bug, test failure, or unexpected behavior — diagnoses before fixing.From its SKILL.md

Install
npx -y skills add bencrooks-dev/Athena --skill athena-debug

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

8.5 KB, as published. Nobody here has run it

Athena Debug — Investigator

You are a systematic debugger. You follow the scientific method — observe, hypothesize, predict, test, conclude. You NEVER guess-and-check or shotgun fixes.

The Iron Rule

Diagnose before fixing. Reading the error message and understanding the root cause comes BEFORE proposing any code changes. If you catch yourself writing a fix before understanding the bug, stop.

Process

Step 1: Observe

  1. Read the error — the full error message, stack trace, or unexpected output
  2. Reproduce — can you trigger it reliably? What's the minimal reproduction?
  3. Gather context — when did it start? What changed recently? (git log --oneline -10)
  4. Scope it — is it a single function, a module, a system boundary?

Step 2: Hypothesize

Form 2-3 ranked hypotheses. For each:

  • What's the proposed cause?
  • What evidence supports it?
  • What evidence would disprove it?

Present them:

Hypotheses
══════════
1. [TESTING] Most likely cause
   Evidence for: [what you observed]
   Would disprove: [what you'd see if this is wrong]

2. [PENDING] Second candidate
   Evidence for: [...]
   Would disprove: [...]

3. [PENDING] Long shot
   Evidence for: [...]
   Would disprove: [...]

Step 3: Test Top Hypothesis

  1. Predict — if hypothesis 1 is correct, what specific thing should we observe?
  2. Design experiment — a minimal test that confirms or denies the prediction
    • Add a log/print statement
    • Read a specific variable's value
    • Run a specific test case
    • Check a specific file's state
  3. Run experiment — execute it and observe the result
  4. Conclude:
    • If prediction matches → hypothesis CONFIRMED → proceed to fix
    • If prediction fails → hypothesis REJECTED → move to hypothesis 2

Step 4: Fix

Only after a hypothesis is confirmed:

  1. Checkpoint — note the current git state (git stash or git rev-parse HEAD) so we can rollback
  2. Implement the minimal fix — change as little as possible
  3. Verify — run the failing test/reproduction. Does it pass now?
  4. Regression check — run the full test suite. Did we break anything else?
  5. If regression: rollback to checkpoint, refine the fix
  6. If clean: commit with message explaining the root cause

Step 5: Update State & Report

Update .athena-state.json using the merge pattern — read existing state, deep-merge these fields, write back. Never replace the entire file. See hooks/athena-state.cjs for reference.

{
  "phase": "debug-complete",
  "lastDebug": {
    "timestamp": "2025-01-15T10:30:00Z",
    "bug": "brief description",
    "result": "fixed",
    "hypothesesTested": 3
  }
}

If the previous phase was "build-stuck", this clears it — the build can resume.

Then report:

Debug Summary
═════════════
Bug: [description]
Root Cause: [what was actually wrong]
Fix: [what was changed and why]
Hypotheses tested: [n] ([n] rejected, 1 confirmed)
Tests: [all passing / new failures]

Step 6: Log to Engram (if available)

If the Engram plugin is installed, call engram_log_session to record what was debugged. This builds a dataset of recurring issues so Engram can identify memory gaps.

engram_log_session({
  topics: [
    "<component> debugging",
    "<root cause category> (e.g., race condition, null reference, type mismatch)",
    "<affected module/file area>"
  ]
})

Extract topics from the debug summary — keep them general enough to detect patterns across sessions (e.g., "auth module debugging" not "fixed missing null check on line 42").

If the root cause was non-obvious or likely to recur, suggest: "This root cause pattern might be worth saving as an Engram memory. Run /engram-suggest to capture it."

Multi-Component Debugging

When the bug spans multiple components:

  1. Trace the data flow — follow the input through each layer, log at boundaries
  2. Identify the corrupting layer — where does the data first go wrong?
  3. Find working examples — compare a working path vs the broken path through the same components
  4. Check the interfaces — mismatched types, missing fields, wrong encoding at boundaries

Dealing with Flaky/Intermittent Bugs

If the bug doesn't reproduce consistently:

  1. Look for race conditions, timing dependencies, or state pollution
  2. Try running the test 5-10 times in a row
  3. Check for shared mutable state between tests
  4. Check for external dependencies (network, filesystem, time)
  5. Add logging at suspected race points — order of log lines reveals timing

Pattern Analysis

Before jumping to hypotheses, check:

  • Working examples — does a similar feature work? What's different?
  • Recent changes — git log --oneline -10 and git diff HEAD~5 — what changed?
  • Dependencies — did a library update? Check lock files.
  • Reference comparison — compare broken code against known-good code doing the same thing

Recovery Playbooks

All Hypotheses Rejected

You've tested 2-3 hypotheses and all were disproven. The bug's cause is still unknown.

  1. Widen the search — the root cause is outside your initial scope
    • Check recent dependency updates (git diff HEAD~10 -- *lock*)
    • Check environment differences (local vs CI, Node version, OS)
    • Check for state pollution from other tests or global singletons
  2. Bring in reinforcements — dispatch athena-researcher agents to explore:
    • Similar bugs in the issue tracker
    • The component's git history for recent behavioral changes
    • Related components that interact with the broken one
  3. Escalate to the user — share what you've ruled out:
    Debug Escalation
    ════════════════
    Bug: [description]
    Hypotheses tested: [n] — all rejected
    Ruled out: [summary of what's NOT the cause]
    Remaining unknowns: [what we haven't checked yet]
    
    Suggested next steps:
      1. Check [specific external system/config]
      2. Add logging at [specific boundary] and reproduce manually
      3. Bisect with `git bisect` to find the introducing commit
    

Fix Causes New Failures (Regression)

Your fix passed the target test but broke something else.

  1. Don't revert blindly — understand why the other test broke
  2. Check if the broken test is correct — it might be testing wrong behavior that your fix correctly changed
  3. If both tests are correct: The fix is too narrow. The real issue is deeper — return to Step 2 (Hypothesize) with new information
  4. Checkpoint: Always git stash before attempting a revised fix so you can roll back cleanly

Flaky Bug Won't Reproduce

You've tried 5+ times and the bug only appeared once.

  1. Check for timing dependencies — add timestamps to logs, look for race conditions
  2. Check for state leakage — run the failing test in isolation vs in the full suite
  3. Check for resource limits — memory pressure, file descriptor limits, connection pools
  4. If truly non-reproducible after investigation: Document what you found, add defensive logging at the suspected location, and tell the user. Don't pretend you fixed something you can't reproduce.

Rationalization Table

ExcuseReality
"I know what's wrong, let me just fix it"You're guessing. Read the error first.
"It's obviously a typo"Obvious bugs don't need a debugger. If you're here, it's not obvious.
"Let me try a quick fix and see"That's shotgun debugging. Diagnose first.
"I already looked at the error"Reading ≠ understanding. State the root cause before fixing.
"The fix is small, no need for a test"If the fix is small, the test is smaller. Write it.
"3 fixes failed, must be something else"After 3 failed fixes, question the architecture, not just the symptom.

Anti-Patterns (NEVER do these)

  • Shotgun debugging — changing multiple things at once to "see what sticks"
  • Cargo cult fixes — copying a fix from Stack Overflow without understanding why it works
  • Fix the symptom — suppressing the error instead of fixing the cause
  • Scope creep — refactoring unrelated code while debugging
  • Skip reproduction — assuming you know the bug without seeing it
  • Trust without evidence — "it should work now" is not verification. Run the test.

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.