Skip to main content
rule CX Codex

testing · sangrokjung — Claude Code rule: what it does, how to install

testing enforces a strict TDD workflow in Claude Code with an 80% coverage floor, Playwright E2E suites, and three test tiers.

MIT ★ 880 updated 2026-09-03

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/testing.md
Open on GitHub

What testing does

The rule triggers on test files matching patterns such as **/*.test.*, **/*.spec.*, **/tests/**, and **/playwright/**. It forces Claude Code into a strict test-driven development loop: write a failing test first, provide minimal code to pass, refactor, and verify that coverage reaches at least 80%.

Every project under this rule must include three tiers of testing: unit tests for functions, integration tests for APIs and databases, and Playwright end-to-end tests for critical flows. When a suite fails, the agent must fix the application code rather than altering the test assertions.

Without Playwright installed in the repository, the required end-to-end stage will fail because the instructions mandate that specific runner.

What it helps with

  • force the assistant to write failing tests before writing feature code
  • keep codebase test coverage at or above 80%
  • automate critical user flows with Playwright end-to-end tests
  • separate unit, integration, and E2E test layers across the project

Example prompts for the agent

  • Implement the order cancellation endpoint using the mandatory TDD workflow
  • Write unit tests for the date parsing utility and ensure coverage is at least 80%
  • Use e2e-runner to add Playwright tests for the checkout flow

How to install testing

Manually: put the files in place

.claude/rules/testing.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about testing

How to install testing in Claude Code?

Save the rule file to .claude/rules/testing.md in the root of your project.

What coverage does the testing rule demand?

It mandates an 80% minimum test coverage across the codebase along with unit, integration, and E2E suites.

Which test runner is required for end-to-end suites?

The rule explicitly requires Playwright for end-to-end user flows and references the e2e-runner specialist agent.

Source text

testing.md · MIT
---
paths:
  - "**/*.test.*"
  - "**/*.spec.*"
  - "**/tests/**"
  - "**/__tests__/**"
  - "**/playwright/**"
---

# Testing Requirements

## Minimum Test Coverage: 80%

Test Types (ALL required):
1. **Unit Tests** - Individual functions, utilities, components
2. **Integration Tests** - API endpoints, database operations
3. **E2E Tests** - Critical user flows (Playwright)

## Test-Driven Development

MANDATORY workflow:
1. Write test first (RED)
2. Run test - it should FAIL
3. Write minimal implementation (GREEN)
4. Run test - it should PASS
5. Refactor (IMPROVE)
6. Verify coverage (80%+)

## Troubleshooting Test Failures

1. Use **tdd-guide** agent
2. Check test isolation
3. Verify mocks are correct
4. Fix implementation, not tests (unless tests are wrong)

## Agent Support

- **tdd-guide** - Use PROACTIVELY for new features, enforces write-tests-first
- **e2e-runner** - Playwright E2E testing specialist

© sangrokjung · MIT · sangrokjung/claude-forge

Similar IDE rules

All IDE rules for Testing and QA →

testing by other authors comes first.

testing caliber-ai-org Defines Vitest testing patterns for Caliber, enforcing colocated test suites, environment isolation, and global LLM mocks. CX Codex +1 ★ 1,319repo stars testing jarrodwatts The testing rule sets conventions for TypeScript test files and the __tests__ directory. Use it to guide checks for success cases, failures, and edge conditions. CX Codex +1 ★ 1,064repo stars testing justxor testing sets automated test standards for Claude Code: Arrange-Act-Assert structure, banned sleep calls, and strict boundaries for mocks. CX Codex +1 ★ 353repo stars testing Aaronontheweb Defines xUnit testing conventions for .NET: project configurations, test isolation, coverage thresholds, and integration test setup. CX Codex +1 ★ 138repo stars 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-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 testing-best-practices andrelandgraf testing-best-practices — a skill that teaches the agent to pick the right test type (Playwright, integration, or unit) and run it against an isolated Neon branch that auto-deletes after an hour. CX Codex +1 113installs 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 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 tester josstei tester generates unit and integration test suites, checks edge cases, and verifies execution without touching application source code. CX Codex ★ 489repo stars

From the same set44

The whole set →
test-coverage test-coverage runs your suite with coverage, lists files under the 80% mark and writes the unit, integration and E2E tests they are missing. CX Codex +1 ★ 880repo stars build-fix build-fix runs npm or pnpm builds, parses compiler errors, and fixes them incrementally. It verifies every edit with a fresh build run. CX Codex +1 ★ 880repo stars update-codemaps The update-codemaps command examines a project’s structure and refreshes architecture maps in codemaps/. Use it when code changes need matching documentation. CX Codex +1 ★ 880repo stars update-docs update-docs rebuilds docs/CONTRIB.md and docs/RUNBOOK.md from package.json and .env.example, then reports which docs have gone stale. CX Codex +1 ★ 880repo stars refactor-clean The refactor-clean command finds unused code, proposes cautious deletions, and checks the test suite around every change. CX Codex +1 ★ 880repo stars date-calculation date-calculation stops the assistant from calculating dates mentally by enforcing system tools like date and python3. Helps avoid arithmetic mistakes on leap years and intervals. CX Codex +1 ★ 880repo stars korean-character-count korean-character-count counts graphemes, lines, and UTF-8 bytes in Korean text by grapheme cluster rules, for self-intro forms with strict limits. CX Codex +1 ★ 880repo stars loop-forge loop-forge converts a single-line routine task into a reusable slash command equipped with safety gates and evaluation checks. CX Codex +1 ★ 880repo stars

Project sponsors

Companies that keep this analytics open