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
.cursor/rules/100-testing.mdcWhat 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.tsusing100-testingand 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.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/100-testing.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/100-testing.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/100-testing.mdManually: put the files in place
.clinerules/100-testing.mdStep 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