agentleFS
MicrosoftKnown publishermicrosoft/haste/.github/skills/debug-test-failures/SKILL.md

debug-test-failures

Skill110 starsChanged 3 months agoMITView on GitHub

Systematic debugging workflow for test failures. Use when tests are failing, a CI build is red, or when asked to debug test issues.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the failing test in isolation:

    line 33
  2. Distinctive:

    Run it 2-3 times. If intermittent, it's likely flaky.

    line 41
  3. Distinctive:

    Read the error message and stack trace carefully

    line 44
  4. Distinctive:

    Check if the failure is in the test or the code under test

    line 46
  5. Distinctive:

    Read the test code to understand what it's testing

    line 49
  6. Distinctive:

    Read the production code being tested

    line 50
  7. Distinctive:

    Check recent changes to both

    line 51
  8. Distinctive:

    If the test is wrong (testing outdated behavior), update the test

    line 61
  9. Distinctive:

    If the code is wrong, fix the code

    line 62
  10. Very specific:

    Run the full test suite: cd hastelib && hatch run test:pytest

    line 63

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

Debug Test Failures

Overview

A systematic process for diagnosing and fixing test failures. Use this skill when tests fail, CI is red, or someone reports a broken build. The key principle: find the root cause, not just the symptom.

Key Concepts

Failure Categories

  • Deterministic failure: Same result every time. Usually a code bug or outdated test.
  • Flaky failure: Intermittent. Usually caused by timing, ordering, shared state, or external dependencies.
  • Environment failure: Works locally, fails in CI. Usually paths, permissions, or missing dependencies.

Patterns & Techniques

Systematic Debugging Process

Step 1: Reproduce Run the failing test in isolation:

# Python tests
cd hastelib && hatch run test:pytest

# UI lint
cd ui && npm run lint

Run it 2-3 times. If intermittent, it's likely flaky.

Step 2: Analyze

  • Read the error message and stack trace carefully
  • Identify the assertion that failed: expected vs actual values
  • Check if the failure is in the test or the code under test

Step 3: Investigate

  • Read the test code to understand what it's testing
  • Read the production code being tested
  • Check recent changes to both
  • Common root causes:
    • Changed function signatures or return types
    • Modified data structures
    • New dependencies not mocked
    • Environment differences (paths, timezones, locale)
    • Race conditions in async code

Step 4: Fix

  • Fix the root cause, not just the symptom
  • If the test is wrong (testing outdated behavior), update the test
  • If the code is wrong, fix the code
  • Run the full test suite: cd hastelib && hatch run test:pytest

Step 5: Report Summarize: root cause, fix applied, verification that all tests pass.

Decision Framework

SymptomLikely CauseAction
Test always failsCode bug or outdated testRead both, fix the wrong one
Test passes locally, fails in CIEnvironment differenceCheck paths, deps, permissions
Test fails intermittentlyTiming, shared state, or orderingAdd isolation, remove shared state
Many tests fail at onceBreaking change in shared codeFind the common dependency

Common Pitfalls

  • Fixing the test to match broken code — Verify the code is correct before changing the test
  • Adding sleep() to fix flaky tests — Fix the root cause (usually missing await or shared state)
  • Only running the fixed test — Always run the full suite to check for regressions

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.