agentleFS
MicrosoftKnown publishermicrosoft/vscode-python-environments/.github/skills/debug-failing-test/SKILL.md

debug-failing-test

Skill146 starsChanged 9 months agoMITView on GitHub

Debug a failing test using an iterative logging approach, then clean up and document the learning.

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 14 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use console.log('[DEBUG]', ...) with descriptive labels

    line 22
  2. Distinctive:

    Add timestamps if timing might be relevant

    line 25
  3. Distinctive:

    If root cause is clear → proceed to fix

    line 35
  4. Distinctive:

    If more information needed → add more targeted logging and repeat

    line 36
  5. Very specific:

    Delete all console.log('[DEBUG]', ...) statements added

    line 47
  6. Distinctive:

    Remove any temporary variables or code added for debugging

    line 48
  7. Distinctive:

    Ensure the code is in a clean, production-ready state

    line 49
  8. Distinctive:

    Verify the test still passes: after cleanup

    line 51
  9. Distinctive:

    Add it to the "Learnings" section of the most relevant instruction file

    line 61
  10. Distinctive:

    If a similar learning already exists, increment its counter instead

    line 62
  11. Distinctive:

    When adding debug logging, use this format for easy identification and removal:

    line 66
  12. Distinctive:

    Prefer targeted logging over flooding the output

    line 85
  13. Distinctive:

    Start with the failing assertion and work backwards

    line 86
  14. Distinctive:

    Consider async timing issues, race conditions, and mock setup problems

    line 87
  15. Distinctive:

    Check that mocks are returning expected values

    line 88
  16. Distinctive:

    Verify test setup/teardown is correct

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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 a failing unit test by iteratively adding verbose logging, running the test, and analyzing the output until the root cause is found and fixed.

Workflow

Phase 1: Initial Assessment

  1. Run the failing test to capture the current error message and stack trace
  2. Read the test file to understand what is being tested
  3. Read the source file being tested to understand the expected behavior
  4. Identify the assertion that fails and what values are involved

Phase 2: Iterative Debugging Loop

Repeat until the root cause is understood:

  1. Add verbose logging around the suspicious code:
    • Use console.log('[DEBUG]', ...) with descriptive labels
    • Log input values, intermediate states, and return values
    • Log before/after key operations
    • Add timestamps if timing might be relevant
  2. Run the test and capture output
  3. Assess the logging output:
    • What values are unexpected?
    • Where does the behavior diverge from expectations?
    • What additional logging would help narrow down the issue?
  4. Decide next action:
    • If root cause is clear → proceed to fix
    • If more information needed → add more targeted logging and repeat

Phase 3: Fix and Verify

  1. Implement the fix based on findings
  2. Run the test to verify it passes
  3. Run related tests to ensure no regressions

Phase 4: Clean Up

  1. Remove ALL debugging artifacts:
    • Delete all console.log('[DEBUG]', ...) statements added
    • Remove any temporary variables or code added for debugging
    • Ensure the code is in a clean, production-ready state
  2. Verify the test still passes after cleanup

Phase 5: Document and Learn

  1. Provide a summary to the user (1-3 sentences):
    • What was the bug?
    • What was the fix?
  2. Record the learning by following the learning instructions (if you have them):
    • Extract a single, clear learning from this debugging session
    • Add it to the "Learnings" section of the most relevant instruction file
    • If a similar learning already exists, increment its counter instead

Logging Conventions

When adding debug logging, use this format for easy identification and removal:

console.log('[DEBUG] <location>:', <value>);
console.log('[DEBUG] before <operation>:', { input, state });
console.log('[DEBUG] after <operation>:', { result, state });

Example Debug Session

// Added logging example:
console.log('[DEBUG] getEnvironments input:', { workspaceFolder });
const envs = await manager.getEnvironments(workspaceFolder);
console.log('[DEBUG] getEnvironments result:', { count: envs.length, envs });

Notes

  • Prefer targeted logging over flooding the output
  • Start with the failing assertion and work backwards
  • Consider async timing issues, race conditions, and mock setup problems
  • Check that mocks are returning expected values
  • Verify test setup/teardown is correct

Download now (ZIP)

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. qazando/skills-qas★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.