test-and-fix-workflow
Automated workflow for running tests and fixing failures systematically. Use when implementing the mandatory test workflow or fixing code quality issues. Keywords - testing, debugging, workflow, failures, systematic fixes.
Best use case
test-and-fix-workflow is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Automated workflow for running tests and fixing failures systematically. Use when implementing the mandatory test workflow or fixing code quality issues. Keywords - testing, debugging, workflow, failures, systematic fixes.
Teams using test-and-fix-workflow should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/test-and-fix-workflow/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How test-and-fix-workflow Compares
| Feature / Agent | test-and-fix-workflow | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Automated workflow for running tests and fixing failures systematically. Use when implementing the mandatory test workflow or fixing code quality issues. Keywords - testing, debugging, workflow, failures, systematic fixes.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# Test and Fix Workflow
## Overview
Systematic workflow for running tests and fixing failures. This is the implementation of the mandatory code quality workflow.
## Workflow Steps
### 1. Run Test Suite
Execute all tests in the project:
```powershell
cd embedded-components
yarn test
```
This runs:
- Type checking (TypeScript)
- Format checking (Prettier)
- Linting (ESLint)
- Unit tests (Vitest)
### 2. Analyze Failures
Categorize failures by type:
**TypeScript Errors:**
- Type mismatches
- Missing type definitions
- Import errors
- Interface violations
**Formatting Errors:**
- Indentation issues
- Quote style violations
- Line break problems
- Trailing comma issues
**Linting Errors:**
- Unused variables
- Missing dependencies
- Code style violations
- Best practice violations
**Test Failures:**
- Assertion failures
- Mock issues
- Timeout errors
- Component rendering failures
### 3. Prioritize Fixes
Fix in this order:
1. **TypeScript errors** - Must be fixed first (blocking)
2. **Formatting errors** - Auto-fixable
3. **Linting errors** - Most auto-fixable
4. **Test failures** - Requires analysis
### 4. Fix Issues Systematically
**For TypeScript Errors:**
```powershell
# Check types
cd embedded-components
yarn typecheck
# Fix type issues in code
# Then re-check
yarn typecheck
```
**For Formatting Errors:**
```powershell
# Auto-fix all formatting
cd embedded-components
yarn format
# Verify
yarn format:check
```
**For Linting Errors:**
```powershell
# Auto-fix linting
cd embedded-components
yarn lint:fix
# Verify
yarn lint
```
**For Test Failures:**
```powershell
# Run specific test file
cd embedded-components
yarn test ComponentName.test.tsx
# Run in watch mode for debugging
yarn test:watch ComponentName.test.tsx
# Fix test or implementation
# Re-run tests
yarn test
```
### 5. Verify All Fixes
Re-run complete test suite:
```powershell
cd embedded-components
yarn test
```
### 6. Iterate Until Green
Repeat steps 3-5 until all tests pass.
## Common Failure Patterns
### TypeScript: Missing Type
```typescript
// ❌ Error: Parameter 'value' implicitly has an 'any' type
const formatValue = (value) => value.toString();
// ✅ Fix: Add type annotation
const formatValue = (value: number): string => value.toString();
```
### TypeScript: Type Mismatch
```typescript
// ❌ Error: Type 'string' is not assignable to type 'number'
const age: number = "25";
// ✅ Fix: Use correct type or convert
const age: number = 25;
// or
const age: number = parseInt("25", 10);
```
### Formatting: Inconsistent Quotes
```typescript
// ❌ Error: Replace `"` with `'`
const name = "John";
// ✅ Fix: Auto-fixed by yarn format
const name = 'John';
```
### Linting: Unused Variable
```typescript
// ❌ Error: 'unused' is assigned but never used
const unused = "value";
const used = "other";
// ✅ Fix: Remove or use it
const used = "other";
// or
const unused = "value";
console.log(unused);
```
### Linting: Missing useEffect Dependencies
```typescript
// ❌ Error: React Hook useEffect has a missing dependency: 'userId'
useEffect(() => {
fetchUser(userId);
}, []);
// ✅ Fix: Add dependency
useEffect(() => {
fetchUser(userId);
}, [userId]);
```
### Test: Assertion Failure
```typescript
// ❌ Failure: expected 5 to equal 4
test("adds numbers", () => {
expect(add(2, 2)).toBe(5);
});
// ✅ Fix: Correct assertion or implementation
test("adds numbers", () => {
expect(add(2, 2)).toBe(4);
});
```
### Test: Async Timeout
```typescript
// ❌ Error: Timeout - Async callback was not invoked within timeout
test("loads data", () => {
renderComponent();
expect(screen.getByText("Data")).toBeInTheDocument();
});
// ✅ Fix: Use waitFor for async operations
test("loads data", async () => {
renderComponent();
await waitFor(() => {
expect(screen.getByText("Data")).toBeInTheDocument();
});
});
```
### Test: Mock Not Reset
```typescript
// ❌ Error: Mock from previous test affecting current test
test("test 1", () => {
server.use(http.get("/api/data", () => HttpResponse.json({ id: 1 })));
// test assertions
});
test("test 2", () => {
// Still using mock from test 1
// test assertions
});
// ✅ Fix: Reset handlers in renderComponent or beforeEach
beforeEach(() => {
server.resetHandlers();
});
```
## Debugging Strategies
### Isolate the Issue
```powershell
# Run single test file
cd embedded-components
yarn test ComponentName.test.tsx
# Run single test
yarn test ComponentName.test.tsx -t "specific test name"
# Run type check only
yarn typecheck
# Run linter only
yarn lint
```
### Use Watch Mode
```powershell
# Watch mode for rapid iteration
cd embedded-components
yarn test:watch ComponentName.test.tsx
```
### Verbose Output
```powershell
# More detailed output
cd embedded-components
yarn test --verbose
```
### Coverage Report
```powershell
# Generate coverage report
cd embedded-components
yarn test:coverage
# View report
start coverage/index.html
```
## Quick Fix Script
Create a PowerShell script to automate fixes:
```powershell
# fix-issues.ps1
cd embedded-components
Write-Host "Fixing formatting..." -ForegroundColor Yellow
yarn format
Write-Host "Fixing linting..." -ForegroundColor Yellow
yarn lint:fix
Write-Host "Running tests..." -ForegroundColor Yellow
yarn test
if ($LASTEXITCODE -eq 0) {
Write-Host "All tests passed!" -ForegroundColor Green
} else {
Write-Host "Some tests failed. Review output above." -ForegroundColor Red
}
```
## Best Practices
1. **Fix one issue at a time** - Don't batch unrelated fixes
2. **Verify each fix** - Run tests after each fix
3. **Commit working code** - Commit after all tests pass
4. **Don't skip failures** - Address all issues before committing
5. **Use auto-fix first** - Let tools fix what they can
6. **Document complex fixes** - Add comments for non-obvious fixes
7. **Update tests if needed** - Ensure tests reflect requirements
## Time-Saving Tips
```powershell
# Chain auto-fixes
cd embedded-components
yarn format; yarn lint:fix
# Check specific file quickly
yarn typecheck src/components/ComponentName.tsx
# Run related tests only
yarn test ComponentName
# Keep tests running in watch mode
yarn test:watch
```
## Integration with Git
```powershell
# Complete workflow before commit
cd embedded-components
yarn format; yarn lint:fix; yarn test
# If all pass, commit
cd ..
git add embedded-components
git commit -m "fix: resolve test failures"
git push
```
## Troubleshooting
### Cache Issues
```powershell
cd embedded-components
yarn cache clean
Remove-Item -Recurse -Force node_modules
yarn install
```
### Port Conflicts
```powershell
# Find process using port
netstat -ano | findstr :3000
# Kill process
taskkill /PID <PID> /F
```
### Memory Issues
```powershell
$env:NODE_OPTIONS="--max-old-space-size=4096"
cd embedded-components
yarn test
```
## References
- See `.github/copilot/skills/code-quality-workflow/` for quality gates
- See `.github/copilot/skills/component-testing/` for testing patterns
- See `.github/copilot/prompts/run-tests-and-fix.md` for detailed promptRelated Skills
transformation-workflow
Practical application guide for HUMMBL's 6 transformations (Perspective, Inversion, Composition, Decomposition, Recursion, Meta-Systems). Includes when to use each transformation, combination patterns, analysis templates, output formats, real-world examples, and common pitfalls. Essential for applying mental models effectively in problem-solving and analysis.
testing-tauri-apps
Guides developers through testing Tauri applications including unit testing with mock runtime, mocking Tauri APIs, WebDriver end-to-end testing with Selenium and WebdriverIO, and CI integration with GitHub Actions.
testing-strategy-python
Python/FastAPI/Django testing conventions. pytest, fixtures, httpx, TestClient, factory_boy. Use when writing or reviewing Python tests.
testing-strategy-builder
Use this skill when creating comprehensive testing strategies for applications. Provides test planning templates, coverage targets, test case structures, and guidance for unit, integration, E2E, and performance testing. Ensures robust quality assurance across the development lifecycle.
testing-skills-activation
Use when creating or refining Claude Code skills to validate that skill descriptions trigger correctly - provides systematic testing methodology for skill activation patterns using test cases and automated evaluation
Testing Skill
Automatiza pruebas y diagnósticos del sistema SmartK et sin perder tiempo
testing-qa
Comprehensive testing and QA workflow covering unit testing, integration testing, E2E testing, browser automation, and quality assurance.
testing-principles
Language-agnostic testing principles including TDD, test quality, coverage standards, and test design patterns. Use when writing tests, designing test strategies, or reviewing test quality.
testing-patterns
TDD and unit testing guidance for Crispy CRM. Use when writing tests, implementing TDD, debugging test failures, or setting up test infrastructure. Covers Vitest patterns, React Admin component testing, Zod schema validation testing, Supabase mocking, E2E with Playwright, and manual E2E testing with Claude Chrome. Integrates with verification-before-completion for test verification.
testing-builder
Automatically generates comprehensive test suites (unit, integration, E2E) based on code and past testing patterns. Use when user says "write tests", "test this", "add coverage", or after fixing bugs to create regression tests. Eliminates testing friction for ADHD users.
Testing Anti-Patterns
This skill should be used when encountering "flaky tests", "test maintenance issues", "slow test suites", "brittle tests", "test code smells", "test debugging problems", or when tests are hard to understand, maintain, or debug.
testcontainers-integration-tests
Use when integration tests require real infrastructure (database, message queue, cache) or when mocking infrastructure is insufficient. Defines container lifecycle, test isolation, and performance optimization for Testcontainers-based testing.