mahmoud20138/tradecraft/debug-failing-test
Claude Code and agent skill by mahmoud20138/tradecraft
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Debug a failing test using an iterative logging approach, then clean up and document the learning.
Install
npx vskill@latest install mahmoud20138/tradecraft/debug-failing-testSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as mahmoud20138/tradecraft/debug-failing-test.
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
- 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
- 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
Logging Conventions
When adding debug logging, use this format for easy identification and removal:
Example Debug Session
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
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/tradecraft/skills/debug-failing-test/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mahmoud20138/tradecraft/debug-failing-test)