Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/gaebalai/cursor-def-a-rule/testing_rulesgit clone --depth 1 https://github.com/gaebalai/Cursor-DEF-A-RuleWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01891 | $0.01891 |
| Opus 5 | $0.00945 | $0.00945 |
| Sonnet 5 | $0.00378 | $0.00378 |
| Haiku 4.5 | $0.00189 | $0.00189 |
Grade A, and why
testing_rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Copyright (c) 2025 Jaewoo Kim
MIT License - https://opensource.org/licenses/MIT
[TESTING] 테스트 주도 개발 및 품질 보증 가이드라인
TDD (테스트 주도 개발) - Kent Beck의 사상
Red-Green-Refactor 사이클
- Red: 실패하는 테스트 작성 (기대하는 동작을 명확히 함)
- Green: 테스트를 통과시키는 최소한의 코드 작성 (동작하는 코드)
- Refactor: 코드를 정리해 가독성과 유지보수성 향상
실천적 관점
- 안전망으로서의 테스트: 테스트는 개발의 ‘세이프티넷’ 역할
- 단계적 구현: 작은 단계로 안정적으로 진행
- 자신감 고양: 동작하는 코드가 개발자의 자신감을 높임
TDD 적용 규칙
[TDD 적용] Red-Green-Refactor 사이클을 적용해 테스트 우선 개발을 실천합니다.
- 테스트 선행: 구현 전에 테스트 작성
- 최소 구현: 테스트를 통과시키는 최소한의 코드
- 지속적 리팩터링: 동작하는 코드를 깔끔하게 정리
BDD (행위 주도 개발) - Dan North의 사상
Given-When-Then 형식
Given [전제 조건]
When [행동]
Then [기대 결과]
비즈니스 가치 중시
- 행위 정의: 비즈니스에 가치 있는 행위를 개발의 출발점으로 정의
- 공통 언어: 개발자와 비개발자 간의 공통된 이해를 구축
- 가치의 가시화: 기능이 가져오는 비즈니스 가치를 명확히 함
BDD 적용 규칙
[BDD 적용] Given-When-Then 형식으로 비즈니스 가치를 명확히 하고, 공통 언어 기반의 개발을 실천합니다.
- 비즈니스 가치: 기능이 가져올 가치 최우선
- 공통 언어: 개발자·비개발자 간 이해 촉진
- 행위 정의: 기대하는 동작을 명확히 기술
TDD/BDD 적용 판단 프레임워크
적용 판단 기준
TDD 적용 권장 사례:
- ✅ 복잡한 비즈니스 로직 구현
- ✅ 기존 기능의 수정·확장
- ✅ 팀 개발에서 품질 보증이 필요한 경우
- ✅ 장기적인 유지보수가 중요한 기능
- ✅ 기술적 부채를 줄여야 하는 경우
TDD 적용 비권장 사례:
- ❌ 프로토타입·실험적 구현
- ❌ 긴급한 버그 수정
- ❌ 기존 테스트가 충분히 마련된 경우
- ❌ 단순한 UI 조정·스타일 변경
- ❌ 학습·조사 목적의 코드
BDD 적용 권장 사례:
- ✅ 신규 기능 개발 시 비즈니스 요구사항이 복잡한 경우
- ✅ 이해관계자와의 요구사항 확인이 필요한 경우
- ✅ 여러 팀 간의 연계 개발
- ✅ 비즈니스 가치의 명확화가 중요한 경우
- ✅ 인수 테스트 자동화가 필요한 경우
BDD 적용 비권장 사례:
- ❌ 기술적 내부 구현에 국한된 경우
- ❌ 기존 기능의 내부 개선
- ❌ 단순한 버그 수정
- ❌ 개인 개발의 학습 목적
- ❌ 긴급 대응이 필요한 경우
적용 판단 로그
[TDD/BDD 판단] 다음 기준에 따라 적용 여부를 결정합니다:
- 개발 상황: [신규 기능 / 수정 / 실험 / 긴급 대응]
- 복잡도: [높음 / 중간 / 낮음]
- 팀 규모: [개인 / 소규모 / 대규모]
- 시간적 제약: [긴급 / 일반 / 여유 있음]
- 품질 요구: [높음 / 중간 / 낮음]
→ 판단 결과: [TDD 적용 / BDD 적용 / 둘 다 적용 / 적용 안 함]
테스트 전략 및 종류
유닛 테스트
- 대상: 개별 함수, 메서드, 클래스
- 도구: Jest、Vitest、pytest、JUnit
- 커버리지: 80% 이상 목표
- 목(mock): 외부 의존성을 적절히 모킹(mocking)
통합 테스트
- 대상: 여러 컴포넌트 간의 연동
- API 테스트: 엔드포인트 동작 검증
- 데이터베이스 테스트: 데이터 액세스 계층 검증
- 외부 서비스: 외부 API와의 연계 테스트
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 194 lines · 1,891 tokens per session scan A df80735f68e2
testing_rules is a cursor rule published in the GitHub repository gaebalai/Cursor-DEF-A-Rule (12 stars, last pushed 1y ago), licensed MIT. It adds 1,891 tokens to every session, about $0.0095 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
unit-tests-tdd
TDD required for behavior changes; ≥80% package coverage on touched packages; unit-test conventions.
elite-developer
Principal Full-Stack Engineer for surgical implementation, strict TDD, complex debugging, and UI construction. Enforces the Agentic Company pipeline and high-rigor engineering standards. This agent contains the full knowledge of TDD, Systematic Debugging, Build Error Resolution, and Refactoring.
mcpnuke-tests
Test conventions for mcpnuke — enforces TDD workflow.
test_first_workflow
Enforce test-first or test-alongside development. Load when implementing new features, APIs, or UI components.
android_unit_testing_bdd
Unit testing best practices with BDD style.
03-testing
Testing requirements — test-before-commit policy, coverage expectations, and test quality standards.