Agent skill
test-fixing
Automatically diagnose and fix failing tests by analyzing errors, updating assertions, and refactoring test code
Install this agent skill to your Project
npx add-skill https://github.com/ljchg12-hue/dotfiles/tree/main/skills/test-fixing
SKILL.md
Test Fixing Skill
Diagnose and fix failing tests automatically using error analysis and intelligent refactoring.
When to Use
- Failing test suite
- Flaky tests
- Test maintenance
- CI/CD pipeline failures
Core Capabilities
- Error analysis and root cause identification
- Assertion updates
- Mock/stub fixing
- Timeout adjustments
- Race condition detection
- Test data refresh
- Dependency updates
Common Fixes
// Fix 1: Update assertion
- expect(result).toBe(5);
+ expect(result).toBe(6); // Updated expected value
// Fix 2: Add async/await
- it('should fetch data', () => {
- const data = fetchData();
+ it('should fetch data', async () => {
+ const data = await fetchData();
// Fix 3: Fix mock
- jest.mock('./api');
+ jest.mock('./api', () => ({
+ fetchUser: jest.fn().mockResolvedValue({ id: 1 })
+ }));
// Fix 4: Increase timeout
- it('slow test', () => {
+ it('slow test', () => {
+ jest.setTimeout(10000);
Best Practices
- Analyze error messages first
- Check for environmental issues
- Update test data regularly
- Fix flaky tests immediately
- Run tests in isolation
Resources
- Jest: https://jestjs.io/
- Testing Library: https://testing-library.com/
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
random-selection
Randomly select items from lists using various algorithms for fair and unbiased selection
threat-hunting
Proactive threat detection using Sigma rules, IOCs, and behavioral analytics
auth-implementation-patterns
Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
debugging-strategies
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
sql-optimization-patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
monorepo-management
Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management. Use when setting up monorepos, optimizing builds, or managing shared dependencies.
Didn't find tool you were looking for?