Skip to main content
skill CX Codex

testing · rsmdt — Claude Code skill: write tests, debug failures, manage flaky

testing — a skill for writing effective tests: layer-specific mocking rules, failure debugging, flaky test management.

MIT ★ 587 updated 2026-10-26

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add rsmdt/the-startup
/plugin install team@the-startup
Open on GitHub

What testing does

The skill teaches the agent to write tests at the right pyramid layer. Units (60–70%) verify business logic, validation, edge cases — only external boundaries mocked: database, APIs, filesystem, time. Integration tests (20–30%) run with real database and cache, mocks only for third-party services. E2E (5–10%) have no mocking at all — critical paths like payments and auth flows.

Inside are debugging rules by failure type, a flaky test protocol (quarantine, fix in a week or delete), and a list of anti-patterns — over-mocking, testing implementation details, shared state between tests. Structure is Arrange-Act-Assert, each test verifies one observable behavior. Edge cases are mandatory: null, empty values, negative numbers, timeouts, network errors.

What it helps with

  • write unit tests for validation and transformation logic
  • debug integration test failure with database state
  • eliminate flaky E2E tests on critical paths
  • verify edge case and error coverage
  • choose the right pyramid layer for new functionality

Example prompts for the agent

  • Write unit tests for the discount calculation function, cover edge cases
  • Debug the rejects order when inventory insufficient test failure
  • Check that payment tests run without mocks, add missing timeout checks

How to install testing

1Plugin marketplace

/plugin marketplace add rsmdt/the-startup
/plugin install team@the-startup

This installs the whole team plugin with all its skills

2Skills CLI (Vercel)

npx skills add rsmdt/the-startup --skill testing -a claude-code

3Manually: put the files in place

~/.claude/skills/testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/testing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about testing

How to install testing in Claude Code?

Run /plugin marketplace add rsmdt/the-startup, then /plugin install team@the-startup. Or via npx skills add rsmdt/the-startup --skill testing -a claude-code, the skill will be in ~/.claude/skills/testing/SKILL.md.

What does the testing skill do?

Teaches the agent to write tests at the right pyramid layer, mock only boundaries, debug failures, and manage flaky tests. Units have no I/O, integration tests use real databases, E2E has no mocking at all.

How does the skill determine what to mock?

Units mock database, APIs, files, time; internal classes are real. Integration tests use real database and cache, mocks only for third-party services. E2E has no mocking, everything in sandbox mode.

Source text

SKILL.md · MIT
---
name: testing
description: Writing effective tests and running them successfully. Covers layer-specific mocking rules, test design principles, debugging failures, and flaky test management. Use when writing tests, reviewing test quality, or debugging test failures.
---

## Persona

Act as a testing specialist who writes effective tests, applies layer-appropriate mocking strategies, and debugs failures systematically. You enforce test quality standards and ensure the right behavior is tested at the right layer.

**Test Context**: $ARGUMENTS

## Interface

TestDecision {
  layer: Unit | Integration | E2E
  mockingStrategy: string
  target: string
  pattern: ArrangeActAssert | GivenWhenThen
}

DebugResult {
  failure: string
  rootCause: string
  fix: string
}

State {
  context = $ARGUMENTS
  scope = null
  layer = null
  tests = []
  failures = []
}

## Constraints

**Always:**
- Test behavior, not implementation — assert on observable outcomes.
- One behavior per test — multiple assertions OK if verifying same logical outcome.
- Use descriptive test names that state the expected behavior.
- Follow Arrange-Act-Assert structure in every test.
- Mock at boundaries only — databases, APIs, file system, time.
- Use real internal collaborators — never mock application code.
- Keep tests independent — no shared mutable state between tests.
- Handle flaky tests aggressively — quarantine, fix within one week, or delete.
- Focus on business-critical paths (payments, auth, core domain logic).
- Prefer quality over quantity — 80% meaningful coverage beats 100% trivial coverage.

**Never:**
- Mock internal methods or classes — that tests the mock, not the code.
- Test implementation details — tests should survive refactoring.
- Skip edge case testing — boundaries, null, empty, negative values.
- Leave flaky tests in the main suite — they erode trust.

## Reference Materials

- [examples/test-pyramid.md](examples/test-pyramid.md) — layer-specific code examples and mocking patterns

## Workflow

### 1. Assess Scope

Identify what needs testing:

match (context) {
  new feature code  => write tests for new behavior
  bug fix           => write regression test first, then fix
  refactoring       => verify existing tests pass, add coverage gaps
  test review       => evaluate test quality and coverage
}

Determine layer distribution target:
- Unit (60-70%) — isolated business logic
- Integration (20-30%) — components with real dependencies
- E2E (5-10%) — critical user journeys

### 2. Select Layer

match (scope) {
  business logic | validation | transformation | edge cases
    => Unit: mock at boundaries only, <100ms, no I/O, deterministic

  database queries | API contracts | service communication | caching
    => Integration: real deps, mock external services only, <5s, clean state between tests

  signup | checkout | auth flows | smoke tests
    => E2E: no mocking, real services in sandbox mode, <30s, critical paths only
}

Mocking rules by layer:
- Unit — mock external boundaries (DB, APIs, filesystem, time)
- Integration — real databases, real caches, mock only third-party services
- E2E — no mocking at all

### 3. Write Tests

Apply Arrange-Act-Assert pattern. Name tests descriptively: "rejects order when inventory insufficient"

Always test edge cases:
- Boundaries — min-1, min, min+1, max-1, max, max+1, zero, one, many
- Special values — null, empty, negative, MAX_INT, NaN, unicode, leap years, timezones
- Errors — network failures, timeouts, invalid input, unauthorized

Read examples/test-pyramid.md for layer-specific code examples.

### 4. Run Tests

Execute in order (fastest feedback first):
1. Lint/typecheck
2. Unit tests
3. Integration tests
4. E2E tests

### 5. Debug Failures

match (layer) {
  Unit => {
    1. Read the assertion message carefully
    2. Check test setup (Arrange section)
    3. Run in isolation to rule out state leakage
    4. Add logging to trace execution path
  }
  Integration => {
    1. Check database state before/after
    2. Verify mocks configured correctly
    3. Look for race conditions or timing issues
    4. Check transaction/rollback behavior
  }
  E2E => {
    1. Check screenshots/videos
    2. Verify selectors still match the UI
    3. Add explicit waits for async operations
    4. Run locally with visible browser
    5. Compare CI environment to local
  }
}

Flaky test protocol:
1. Quarantine — move to separate suite immediately
2. Fix within 1 week — or delete
3. Common causes: shared state, time-dependent logic, race conditions, non-deterministic ordering

Anti-patterns to flag:
- Over-mocking — testing mocks instead of code
- Implementation test — breaks on refactoring
- Shared state — test order affects results
- Test duplication — use parameterized tests instead

© Rudolf S. · MIT · rsmdt/the-startup

Similar skills

All skills for Testing and QA →

testing by other authors comes first.

testing tursodatabase testing is a Claude Code skill for writing SQL and Rust tests, with guidance on choosing .sqltest, TCL, or integration tests and commands to run them. CX Codex +1 1,300installs testing codewithmukesh Lays out a testing strategy for .NET 10 apps: integration tests via WebApplicationFactory, real databases in Testcontainers, Verify snapshots. CX Codex +1 4,000installs testing grafana testing sets up uptime probes, k6 load tests, and frontend observability through Grafana Cloud. Use it before a release or when investigating failures. CX Codex +1 4,600installs testing rshankras testing — a set of TDD workflows and test infrastructure for Apple platform apps. Useful when an agent writes the code and you want tests around it. CX Codex +1 500installs testing Mindrally Defines software testing guidelines for AI agents, covering test isolation, table-driven checks, and mock boundaries. CX Codex +1 888installs testing-expert PCL Team testing-expert — a skill that gives the agent rules for writing tests: AAA structure, isolated cases, doubles and edge cases. TDD and BDD theory sits in a reference file the agent opens only when needed. CX Codex +1 206installs testing-craft jssblck testing-craft organizes automated checks along a strict hierarchy from static types to end-to-end runs. Useful when reviewing test suites or choosing verification levels for new code. CX Codex +1 1,200installs test-architect CloudAI-X test-architect — a Claude Code subagent for test planning, test writing, coverage checks, and flaky-test analysis. Use it when changing features or fixing bugs. CX Codex ★ 1,424repo stars vitest-testing existential-birds vitest-testing — a skill that hands your coding agent a Vitest reference: assertions, mocks, async matchers, config. Useful when the project already runs on Vitest. CX Codex +1 473installs project-testing aiskillstore project-testing — a skill with ready-made patterns and fixtures for unit, integration, and E2E tests. Speeds up isolated test writing by one standard, prevents hardcoded data and flaky tests. CX Codex +1 1installs testing-principles shinpr testing-principles — a skill for Claude Code enforces language-agnostic guidelines for test selection, mock boundaries, and assertion design. Triggers when writing new tests, planning test scope, or reviewing test suites. CX Codex +1 ★ 720repo stars

From the same set50

The whole set →
specify-meta specify-meta is a Claude Code skill that creates specification folders and tracks requirements, solution, and plan stages. It records approvals and decisions for a task. CX Codex +1 ★ 587repo stars design-interaction design-interaction is a Claude Code subagent that designs navigation, user flows, and information architecture. Activates for onboarding redesigns and complex content organization. CX Codex ★ 587repo stars analyze analyze conducts deep research into a codebase or topic, validates every claim with adversarial verifiers, and delivers cited reports. CX Codex +1 ★ 587repo stars test-strategy The test-strategy subagent for Claude Code plans and runs risk-prioritized functional and performance checks, assessing coverage, bottlenecks, and release readiness. CX Codex ★ 587repo stars brainstorm brainstorm guides interactive feature planning before touching code. Asks single questions, outlines implementation approaches with trade-offs, and documents design decisions. CX Codex +1 ★ 587repo stars architecture-selection architecture-selection is a Claude Code skill that compares architecture patterns against project needs and documents a recommendation. It supports system planning, scalability reviews, and technology choices. CX Codex +1 ★ 587repo stars security-assessment security-assessment — a Claude skill that runs a security audit: STRIDE threat modelling, OWASP-based code review, and findings ranked by severity with fixes. CX Codex +1 ★ 587repo stars technical-writing technical-writing drafts architecture decision records, system architecture overviews, API references, and operations runbooks directly in your codebase. CX Codex +1 ★ 587repo stars

Project sponsors

Companies that keep this analytics open