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.
npx skills add mahmoud20138/Tradecraft --skill debug-failing-testgit clone --depth 1 https://github.com/mahmoud20138/TradecraftWrote 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.
[](https://agentmods.dev/skills/mahmoud20138/tradecraft/debug-failing-test)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
- Run the failing test to capture the current error message and stack trace
- Read the test file to understand what is being tested
- Read the source file being tested to understand the expected behavior
- Identify the assertion that fails and what values are involved
Phase 2: Iterative Debugging Loop
Repeat until the root cause is understood:
-
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
- Use
-
Run the test and capture output
-
Assess the logging output:
- What values are unexpected?
- Where does the behavior diverge from expectations?
- What additional logging would help narrow down the issue?
-
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
- Implement the fix based on findings
- Run the test to verify it passes
- Run related tests to ensure no regressions
Phase 4: Clean Up
-
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
- Delete all
-
Verify the test still passes after cleanup
Phase 5: Document and Learn
-
Provide a summary to the user (1-3 sentences):
- What was the bug?
- What was the fix?
-
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
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.
- 11d ago First seen · 95 lines · 23 tokens per session scan A c2d1aa237622
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.
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"…
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…
fix
Structured bug fix — reproduce (failing test), diagnose, fix (minimal change), verify, commit. Enforces test-first. Use when a bug needs a methodical fix.
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.
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.
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…