Fix failing tests based on failure reports, verify fixes, and iterate until all tests pass. This skill should be used after test-executor generates failure reports, providing systematic debugging and fixing strategies that work with any framework or language.
Ships in feature-workflow-suite. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Systematically fix failing tests by analyzing failure reports, diagnosing root causes, implementing fixes, and verifying corrections. Works universally with any testing framework, language, or project structure through generic debugging strategies.
Use this skill when:
test-executor has generated a failure report (test-failures.md)Read Failure Report
Analyze Failure Patterns
Categorize by Type
For each failing test:
Read Error Message Carefully
Locate Relevant Code
Reproduce Locally (if possible)
Identify Root Cause
Choose Fix Strategy
Implement Fix
Local Verification
Re-run Test
test-executor to re-runIf Test Passes:
If Test Still Fails:
Once All Tests Pass:
Symptom:
Error: Timeout waiting for element to appear
Error: Request timeout after 30000ms
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix:
// Before: Too short timeout
await page.waitForSelector('.success-message', { timeout: 1000 });
// After: Reasonable timeout
await page.waitForSelector('.success-message', { timeout: 5000 });
Symptom:
Expected: 200
Received: 404
AssertionError: expected 'success' to equal 'error'
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix (Implementation Error):
// Before: Wrong status code
return NotFound(); // 404
// After: Correct status code
return Ok(result); // 200
Example Fix (Test Error):
// Before: Wrong expectation
expect(response.status).toBe(404);
// After: Correct expectation
expect(response.status).toBe(200);
Symptom:
Error: connect ECONNREFUSED 127.0.0.1:5001
Error: getaddrinfo ENOTFOUND localhost
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix:
// Before: Wrong port
const API_URL = 'http://localhost:3000';
// After: Correct port
const API_URL = 'http://localhost:5001';
Symptom:
Error: 401 Unauthorized
Error: 403 Forbidden
Error: Invalid token
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix:
// Before: Missing auth header
const response = await fetch('/api/forms');
// After: Include auth header
const response = await fetch('/api/forms', {
headers: {
'Authorization': `Bearer ${token}`
}
});
Symptom:
TypeError: Cannot read property 'name' of undefined
NullReferenceException: Object reference not set
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix:
// Before: No null check
const userName = user.name.toUpperCase();
// After: Safe null check
const userName = user?.name?.toUpperCase() ?? 'Unknown';
Symptom:
Error: Missing environment variable
Error: Configuration not found
Error: Module not found
Common Causes:
Diagnostic Steps:
Fix Strategies:
Example Fix:
# Create missing .env file
cp .env.example .env
# Install missing dependencies
npm install
# Set environment variable
export DATABASE_URL="postgresql://localhost:5432/db"
Ask "why" repeatedly to find root cause:
Example:
Root cause: Missing .env file Fix: Create .env file and document in README
Explain the failure out loud (or in comments):
# What should happen:
# 1. User clicks submit
# 2. Form data is sent to API
# 3. API validates and saves to DB
# 4. API returns 200 with submission ID
# 5. UI shows success message
# What actually happens:
# 1-2: OK
# 3: API validation fails ← Problem here!
# 4-5: Never reached
# Why does validation fail?
# - Required field "email" is missing
# - Frontend not sending email field ← Root cause!
For complex failures, narrow down:
Compare working vs failing:
If multiple tests fail similarly:
Example:
Test A: Expected 200, got 500
Test B: Expected 200, got 500
Test C: Expected 200, got 500
Pattern: All tests hitting same endpoint fail Root cause: Likely in shared code (endpoint implementation) Fix: Fix endpoint once, all tests should pass
Fix failures in dependency order:
Example:
Test A: Create user (fails)
Test B: Login as user (fails - depends on A)
Test C: User updates profile (fails - depends on A, B)
Fix order: A → B → C
For independent failures:
# Run only the fixed test
npm test -- specific-test.spec.ts
dotnet test --filter TestName
pytest tests/test_specific.py::test_function
After fixing, ensure no new failures:
# Run full test suite
npm test
dotnet test
pytest
If test seems flaky:
# Run multiple times to verify stability
for i in {1..5}; do npm test; done
If still flaky, fix the flakiness (timing issues, race conditions, etc.)
For non-obvious fixes:
// Fix: Added timeout to wait for async operation to complete
// Issue: Test was checking result before operation finished
await new Promise(resolve => setTimeout(resolve, 100));
Create report of fixes:
# Test Fixes Report
**Date:** [Date]
## Fixed Tests
### Test: User can submit form
**Issue:** Timeout waiting for success message
**Root Cause:** Service startup slow in CI environment
**Fix:** Increased timeout from 1s to 5s
**File:** `tests/e2e/form-submission.spec.ts:42`
### Test: API validates SIRET
**Issue:** Validation always failed
**Root Cause:** Wrong validation logic (bug in implementation)
**Fix:** Corrected Luhn algorithm in ValidationService
**File:** `src/services/ValidationService.cs:67`
Update plan with any significant changes:
- [x] Phase 4: Testing (100%)
**Note:** Fixed timeout issues in E2E tests, fixed SIRET validation bug
1. test-executor runs tests → test-failures.md
2. test-fixer fixes failures
3. test-executor re-runs tests
→ If all pass: Done!
→ If still failures: Go to step 2
Track progress across iterations:
# Test Failure Report - Iteration 1
- Failed: 10/15 tests
# Test Failure Report - Iteration 2
- Failed: 3/15 tests (7 fixed!)
# Test Failure Report - Iteration 3
- Failed: 0/15 tests (All passing! ✅)
❌ Changing Tests to Match Bugs: Fix implementation, not tests ❌ Adding Arbitrary Delays: Understand why timing is an issue ❌ Ignoring Flaky Tests: Fix flakiness, don't just retry ❌ Skipping Verification: Always re-run test after fix ❌ Fixing Symptoms: Find and fix root cause ❌ Over-Complicating: Simple fixes are usually best
references/debugging-strategies.md - Universal debugging strategiesreferences/common-test-failures.md - Common failures and solutionsAskUserQuestion -> request_user_inputTask tool with subagent_type -> spawn_agent with agent_typeGlob/Grep/Read instructions -> use shell tooling (rg, Get-Content, Get-ChildItem)When fixing UI test or visual verification failures:
UX_DOCS_ROOT/09-Debt/Visual_Debt.md when a debt item is resolved or deferred;ux-visual-verification after the fix.Do not change tests to accept a visual regression unless the product/design decision is documented.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/feature-workflow-suite:test-fixerfrom feature-workflow-suite
npx claudepluginhub laizyio/workflowskills --plugin feature-workflow-suite26 skills in this plugin
/feature-implementerImplement feature steps using git worktrees, build and test adaptively, update implementation plan, and generate test plans. This skill should be used when ready to implement one or more steps from an implementation plan, automatically adapting to any framework, language, or project structure./feature-researchGuide interactive research and POC creation to understand features deeply. This skill should be used when planning to implement a new feature and needing to research design patterns, understand integration points in the codebase, consult documentation via MCP Deep Wiki, or create minimal POCs to validate concepts. Can receive CDC.md from feature-specification as input for clear requirements./feature-specificationGuide iterative specification and CDC (Cahier Des Charges) creation through deep questioning, context analysis, and proactive proposals. Use this skill BEFORE feature-research to clarify requirements, identify prerequisites, define scope, and document complete specifications. Triggers when starting a new feature, task, bug fix, or refactoring and requirements need clarification./feature-workflowOrchestrate complete or partial feature implementation workflow with configurable phases. This skill should be used to run the full workflow (specification → research → plan → implement → test → fix) or specific phases, coordinating between all feature-implementation skills automatically./git-workflow-managerManage git worktrees with GitFlow conventions for parallel development. This skill should be used when creating, managing, or cleaning up git worktrees, following standard GitFlow branch naming (feature/, fix/, hotfix/). 100% generic and reusable across all projects./implementation-plannerGenerate comprehensive implementation plans with checkboxes, dependencies, and parallelization details. This skill should be used after feature research is complete to create structured, step-by-step implementation plans that track progress, identify dependencies between tasks, and enable multiple developers to work in parallel.