debug-failing-test

debug-failing-test is a skill for Claude Code from mahmoud20138/Tradecraft. It costs 23 tokens per session (750 once invoked), scanned A, original, MIT.

A step-by-step method for finding why an automated test fails by adding targeted logs, rerunning the test, and examining the results.

In plain words
What is it for?
It helps inspect the failing test and the code it checks, trace inputs and intermediate results, identify the failing assertion, and fix the cause.
Why use it?
It turns an unclear test failure into a series of observable values and program states, making the underlying cause easier to locate.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the tradecraft plugin — 58 skills shipped together

Good fit It helps inspect the failing test and the code it checks, trace inputs and intermediate results, identify the failing assertion, and fix the cause.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mahmoud20138/tradecraft/debug-failing-test
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mahmoud20138/Tradecraft --skill debug-failing-test
Clone the repo
git clone --depth 1 https://github.com/mahmoud20138/Tradecraft

Made for: Claude Code.

Or install tradecraft, the plugin that ships this one along with the rest of its 58 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for debug-failing-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/debug-failing-test/github.svg)](https://agentmods.dev/skills/mahmoud20138/tradecraft/debug-failing-test)
Your own site
<a href="https://agentmods.dev/skills/mahmoud20138/tradecraft/debug-failing-test"><img src="https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/debug-failing-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debug-failing-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/mahmoud20138/tradecraft/debug-failing-test"><img src="https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/debug-failing-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 750 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.00750
Opus 5 $0.00012 $0.00375
Sonnet 5 $0.00005 $0.00150
Haiku 4.5 $0.00002 $0.00075

Measured 11d ago against content hash c2d1aa237622, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

debug-failing-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/tradecraft/skills/debug-failing-test/SKILL.md · 95 lines

How it starts

The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 95 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 95 lines · 23 tokens per session scan A c2d1aa237622

Subscribe to this mod's changes

debug-failing-test is a skill published in the GitHub repository mahmoud20138/Tradecraft (15 stars, last pushed 4mo ago), licensed MIT. It adds 23 tokens to every session and 750 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

run-checks

Run the project's full verification gate: every check the project defines as a pass/fail condition, built from its CI config, check scripts, and configured tools, or from a formatter-linter-test baseline when it declares none. Use when the user asks to "run checks", "run the verification gate", "run lint and tests"…

tobihagemann/turbo · 96 tokens

test-first-bugfix

Test-driven bug fixing — reproduce before you fix. Use this skill whenever the user reports a bug, describes unexpected behavior, says something is broken, mentions a regression, or asks you to fix an error. This includes phrases like "this is broken", "X doesn't work", "there's a bug in", "getting an error when", "it…

The-Artificer-of-Ciphers-LLC/skills-from-the-artificer · 138 tokens

fix

Structured bug fix — reproduce (failing test), diagnose, fix (minimal change), verify, commit. Enforces test-first. Use when a bug needs a methodical fix.

martineserios/thebrana · 38 tokens

cige-product-defect-escalation

Use when cige-failure-classification identifies a Product Defect -- execution reached a healthy system with current steps, but the outcome contradicts Intent. Fetches specRef and buildRef to file a defect or, only with human approval, propose an Intent update.

vivekkrishna/agentic-validation-skills · 62 tokens

cige-stale-execution-repair

Use when cige-failure-classification identifies Outdated Test Logic (repair Execution steps, Mode A) or a confirmed False Positive (add a stricter Guardrail, Mode B). Human approval required before committing either kind of repair.

vivekkrishna/agentic-validation-skills · 56 tokens

debugging-failures

Diagnose a failing Ginkgo suite as an agent — always run with --json-report into a predictable temp/gitignored location, read the terminal verdict line, then use jq to extract structured failure details (name, message, file:line, panic value, captured logs). Covers the panicked-vs-failed trap, panic locations pointing…

onsi/ginkgo · 122 tokens