Skip to main content
rule

100-testing — Claude Code rule: what it does, how to install

The 100-testing rule sets conventions for test files, including AAA structure, coverage targets, test boundaries, and mocking. It applies to common test paths.

MIT ★ 97 updated 2026-06-11

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/100-testing.mdc
Open on GitHub

What 100-testing does

The rule targets *.test.* and *.spec.* files along with __tests__, test, and tests directories. It asks for Arrange-Act-Assert structure, a single assertion concept in each test, and names that describe the expected behavior and condition. Coverage targets are 80% for critical paths, 90% for security code, and 95% for utility functions.

It separates unit, integration, and E2E testing. Unit tests should stay isolated and avoid external dependencies, while E2E tests are reserved for critical user journeys. External services should be mocked rather than internal logic, dependency injection should support testability, and mocks should be reset between tests. The rule also rejects test coupling, hardcoded data, implementation-detail checks, and sleep-based waiting. Security-related code below 90% coverage fails its stated standard.

What it helps with

  • structure tests with Arrange-Act-Assert
  • set coverage targets for critical paths
  • separate unit, integration, and E2E tests
  • replace hardcoded data with factories or fixtures
  • remove test coupling and sleep-based waits

Example prompts for the agent

  • Review src/auth.test.ts using 100-testing and bring its structure in line with the rule.
  • Add tests for the critical user journey while meeting the 80% coverage target.
  • Refactor the tests in tests/ so they check behavior rather than implementation details and run independently.

How to install 100-testing

Manually: put the files in place

.cursor/rules/100-testing.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about 100-testing

How do I install 100-testing in Claude Code?

Place the rule file at .claude/rules/100-testing.md.

What does the 100-testing rule do?

It defines test-file conventions for structure, naming, coverage, test categories, mocking, and patterns to avoid.

What coverage targets does 100-testing set?

Critical paths require at least 80% coverage, security-related code 90%, and utility functions 95%.

Source text

100-testing.mdc · MIT
---
description: Testing standards and patterns for test files
globs: ["**/*.test.*", "**/*.spec.*", "**/__tests__/**", "**/test/**", "**/tests/**"]
alwaysApply: false
---

# Testing Standards

## Test Structure
- Use Arrange-Act-Assert (AAA) pattern
- One assertion concept per test
- Descriptive test names: "should [expected behavior] when [condition]"

## Coverage Requirements
- Critical paths: minimum 80% coverage
- Security-related code: minimum 90% coverage
- Utility functions: minimum 95% coverage

## Test Types
- Unit tests: isolated, fast, no external dependencies
- Integration tests: test component interactions
- E2E tests: critical user journeys only

## Mocking
- Mock external dependencies, not internal logic
- Use dependency injection for testability
- Reset mocks between tests

## Anti-Patterns to Avoid
- No test interdependencies
- No hardcoded test data (use factories/fixtures)
- No testing implementation details (test behavior)
- No sleeping/waiting (use proper async patterns)

© obviousworks · MIT · obviousworks/vibe-coding-ai-rules

Similar IDE rules

All IDE rules for Testing and QA →

From the same set7

Project sponsors

Companies that keep this analytics open