# Testing Anti Patterns

Reviews test code to identify and fix common testing anti-patterns including flaky...

- Repository: https://github.com/rohitg00/skillkit (1568 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-06-02
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add rohitg00/skillkit --skill testing-anti-patterns -g -a claude-code -y`
Codex: `npx skills add rohitg00/skillkit --skill testing-anti-patterns -g -a codex -y`
Cursor: `npx skills add rohitg00/skillkit --skill testing-anti-patterns -g -a cursor -y`
Gemini CLI: `npx skills add rohitg00/skillkit --skill testing-anti-patterns -g -a gemini-cli -y`

## Description

Reviews test code to identify and fix common testing anti-patterns including flaky tests, over-mocking, brittle assertions, test interdependency, and hidden test logic. Flags bad patterns, explains the specific defect, and provides corrected implementations. Use when reviewing test code, debugging intermittent or unreliable test failures, or when the user mentions flaky tests, test smells, brittle tests, test isolation issues, mock overuse, slow tests, or test maintenance problems.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Testing Anti-Patterns

You are identifying and avoiding common testing anti-patterns.

## Review Workflow

Follow these steps when reviewing test code:

1. **Run tests in isolation**, Verify each test passes independently (no shared state, no ordering dependency).
2. **Check for patterns below**, Scan for each anti-pattern in the checklist; flag every match with the specific defect.
3. **Apply refactoring strategy**, Use the refactoring strategies section to select and apply the appropriate fix.
4. **Verify the test still fails when code breaks**, After fixing, confirm the corrected test catches real regressions (remove or stub the implementation to confirm a failure occurs).

## Critical Anti-Patterns

### 1. The Liar - Tests That Always Pass

**Problem:** Test passes even when the code is broken.

```typescript
// BAD - Always passes because it tests nothing meaningful
it('should process data', () => {
  const result = processData(input);
  expect(result).toBeDefined(); // Too weak
});

// GOOD - Actually verifies behavior
it('should transform input to uppercase', () => {
  const result = processData({ text: 'hello' });
  expect(result.text).toBe('HELLO');
});
```

**Detection:** Remove or break the implementation - test should fail.

### 2. The Giant - Tests Too Large

**Problem:** Single test covers too many behaviors.

```typescript
// BAD - Tests multiple things
it('should handle user registration', async () => {
  const user = await register(userData);
  expect(user.id).toBeDefined();
  expect(user.email).toBe(userData.email);
  expect(user.password).toBeUndefined();
  expect(sendEmail).toHaveBeenCalled();
  expect(createProfile).toHaveBeenCalled();
  // ... 20 more assertions
});

// GOOD - Focused tests
it('should create user with provided email', async () => {
  const user = await register(userData);
  expect(user.email).toBe(userData.email);
});

The rest: https://github.com/rohitg00/skillkit/blob/HEAD/packages/core/src/methodology/packs/testing/anti-patterns/SKILL.md
