test-fixer
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.
What this skill does
# Test Fixer Skill
## Purpose
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.
## When to Use This Skill
Use this skill when:
- `test-executor` has generated a failure report (test-failures.md)
- Tests are failing and need fixes
- Need systematic approach to debugging test failures
- Want to iterate on fixes until tests pass
- Need to understand and resolve test failure patterns
## Fixing Workflow
### Phase 1: Read and Understand Failures
1. **Read Failure Report**
- Locate test-failures.md
- Review summary statistics
- Identify number and types of failures
- Prioritize fixes (critical → non-critical)
2. **Analyze Failure Patterns**
- Are failures related? (common root cause)
- Are failures independent?
- Which failure to fix first?
3. **Categorize by Type**
- Timeout errors
- Assertion failures
- Connection errors
- Authentication errors
- Data errors
- Environment issues
### Phase 2: Diagnose Root Cause
For each failing test:
1. **Read Error Message Carefully**
- Extract key information
- Identify line numbers and files
- Understand what was expected vs actual
2. **Locate Relevant Code**
- Find test file
- Find implementation code being tested
- Read both test and implementation
3. **Reproduce Locally (if possible)**
- Run single failing test
- Observe behavior
- Add debug logging if needed
4. **Identify Root Cause**
- Is test correct and implementation wrong?
- Is test incorrect and implementation right?
- Is environment/setup the issue?
- Is test flaky/timing-dependent?
### Phase 3: Implement Fix
1. **Choose Fix Strategy**
- Fix implementation code
- Fix test code
- Fix environment/configuration
- Fix test data/fixtures
2. **Implement Fix**
- Make minimal change to fix issue
- Don't over-engineer
- Maintain code style consistency
- Add comments if fix is non-obvious
3. **Local Verification**
- Run fixed test locally
- Verify it passes consistently
- Check no regressions in related tests
### Phase 4: Verify and Iterate
1. **Re-run Test**
- Use `test-executor` to re-run
- Or run test command directly
- Capture results
2. **If Test Passes:**
- Mark test as fixed
- Update test-failures.md or create test-fixes.md
- Move to next failing test
3. **If Test Still Fails:**
- Analyze new error (may be different)
- Refine diagnosis
- Implement additional fix
- Iterate
4. **Once All Tests Pass:**
- Update implementation plan
- Document any significant changes
- Ready for next phase or completion
## Debugging Strategies by Failure Type
### 1. Timeout Errors
**Symptom:**
```
Error: Timeout waiting for element to appear
Error: Request timeout after 30000ms
```
**Common Causes:**
- Service not running
- Service too slow
- Incorrect wait condition
- Element never appears (wrong selector)
**Diagnostic Steps:**
1. Verify all services are running
2. Manually test the operation (browser, curl, etc.)
3. Check response times in service logs
4. Verify selectors/conditions are correct
**Fix Strategies:**
- Start missing services
- Optimize slow queries/operations
- Increase timeout (if legitimately slow)
- Fix incorrect wait conditions
- Use better selectors (E2E tests)
**Example Fix:**
```typescript
// Before: Too short timeout
await page.waitForSelector('.success-message', { timeout: 1000 });
// After: Reasonable timeout
await page.waitForSelector('.success-message', { timeout: 5000 });
```
### 2. Assertion Failures
**Symptom:**
```
Expected: 200
Received: 404
AssertionError: expected 'success' to equal 'error'
```
**Common Causes:**
- Logic error in implementation
- Incorrect test expectations
- Data fixtures incorrect
- API contract mismatch
**Diagnostic Steps:**
1. Understand what test expects
2. Understand what implementation returns
3. Determine which is correct
4. Check data flowing through system
**Fix Strategies:**
- Fix implementation logic (if test is correct)
- Fix test expectations (if implementation is correct)
- Fix data fixtures
- Align API contract
**Example Fix (Implementation Error):**
```csharp
// Before: Wrong status code
return NotFound(); // 404
// After: Correct status code
return Ok(result); // 200
```
**Example Fix (Test Error):**
```typescript
// Before: Wrong expectation
expect(response.status).toBe(404);
// After: Correct expectation
expect(response.status).toBe(200);
```
### 3. Connection Errors
**Symptom:**
```
Error: connect ECONNREFUSED 127.0.0.1:5001
Error: getaddrinfo ENOTFOUND localhost
```
**Common Causes:**
- Service not running
- Wrong port or URL
- Firewall blocking connection
- Service crashed
**Diagnostic Steps:**
1. Check if service process is running
2. Verify port matches configuration
3. Test connection manually (curl, browser)
4. Check service logs for crashes
**Fix Strategies:**
- Start the service
- Fix port/URL in configuration
- Restart crashed service
- Check firewall rules
**Example Fix:**
```typescript
// Before: Wrong port
const API_URL = 'http://localhost:3000';
// After: Correct port
const API_URL = 'http://localhost:5001';
```
### 4. Authentication Errors
**Symptom:**
```
Error: 401 Unauthorized
Error: 403 Forbidden
Error: Invalid token
```
**Common Causes:**
- Missing authentication header
- Expired token
- Wrong credentials
- Incorrect auth flow
**Diagnostic Steps:**
1. Check if token is being sent
2. Verify token is valid
3. Check token hasn't expired
4. Verify auth flow is correct
**Fix Strategies:**
- Add authentication header
- Refresh/regenerate token
- Use correct credentials
- Fix auth flow logic
**Example Fix:**
```typescript
// Before: Missing auth header
const response = await fetch('/api/forms');
// After: Include auth header
const response = await fetch('/api/forms', {
headers: {
'Authorization': `Bearer ${token}`
}
});
```
### 5. Data Errors
**Symptom:**
```
TypeError: Cannot read property 'name' of undefined
NullReferenceException: Object reference not set
```
**Common Causes:**
- Missing data in response
- Null/undefined values
- Wrong data shape
- Database empty/wrong state
**Diagnostic Steps:**
1. Log actual data being received
2. Check database state
3. Verify API response structure
4. Check data fixtures
**Fix Strategies:**
- Add null checks
- Fix data fixtures
- Ensure database has required data
- Fix API to return correct shape
**Example Fix:**
```typescript
// Before: No null check
const userName = user.name.toUpperCase();
// After: Safe null check
const userName = user?.name?.toUpperCase() ?? 'Unknown';
```
### 6. Environment / Configuration Issues
**Symptom:**
```
Error: Missing environment variable
Error: Configuration not found
Error: Module not found
```
**Common Causes:**
- Missing .env file
- Missing dependencies
- Wrong configuration
- Environment variables not set
**Diagnostic Steps:**
1. Check .env file exists
2. Verify dependencies installed
3. Check configuration files
4. Verify environment variables
**Fix Strategies:**
- Create .env file
- Install dependencies
- Fix configuration
- Set environment variables
**Example Fix:**
```bash
# Create missing .env file
cp .env.example .env
# Install missing dependencies
npm install
# Set environment variable
export DATABASE_URL="postgresql://localhost:5432/db"
```
## Systematic Debugging Approach
### The 5 Whys Technique
Ask "why" repeatedly to find root cause:
**Example:**
1. **Why did test fail?** → API returned 500
2. **Why did API return 500?** → Database query failed
3. **Why did query fail?** → Connection string wrong
4. **Why is connection string wrong?** → .env file missing
5. **Why is .env file missing?** → Not in .gitignore, not documented
**Root cause:** Missing .env file
**Fix:** Create .env file Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.