원클릭으로
testing
Use when implementing any feature or bugfix - before writing implementation code. Write the test first, watch it fail, then implement.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when implementing any feature or bugfix - before writing implementation code. Write the test first, watch it fail, then implement.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | testing |
| description | Use when implementing any feature or bugfix - before writing implementation code. Write the test first, watch it fail, then implement. |
Write the test first. Watch it fail. Write minimal code to pass.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
If you didn't watch the test fail, you don't know if it tests the right thing.
Write code before the test? Delete it. Start over.
Always:
Exceptions (ask first):
Thinking "skip TDD just this once"? Stop. That's rationalization.
Write one minimal test showing what should happen.
// Good: Clear name, tests real behavior, one thing
test('rejects empty email', async () => {
const result = await submitForm({ email: '' });
expect(result.error).toBe('Email required');
});
// Bad: Vague name, tests mock not code
test('form works', async () => {
const mock = jest.fn().mockResolvedValue('success');
await submitForm(mock);
expect(mock).toHaveBeenCalled();
});
Requirements:
MANDATORY. Never skip.
npm test path/to/test.test.ts
Confirm:
Test passes? You're testing existing behavior. Fix the test.
Write the simplest code to pass the test.
// Good: Just enough to pass
function validateEmail(email: string): string | null {
if (!email?.trim()) return 'Email required';
return null;
}
// Bad: Over-engineered
function validateEmail(
email: string,
options?: {
allowEmpty?: boolean;
customRegex?: RegExp;
onValidate?: (email: string) => void;
}
): ValidationResult {
// YAGNI - don't add features not tested
}
Don't add features, refactor other code, or "improve" beyond the test.
MANDATORY.
npm test path/to/test.test.ts
Confirm:
Test fails? Fix code, not test.
After green only:
Keep tests green. Don't add behavior.
Next failing test for next feature.
All of these mean: Delete code. Start over with TDD.
| Excuse | Reality |
|---|---|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
| "Test hard = skip it" | Hard to test = hard to use. Simplify design. |
| "TDD will slow me down" | TDD faster than debugging. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is debt. |
"I'll write tests after to verify it works"
Tests written after code pass immediately. Passing immediately proves nothing:
Test-first forces you to see the test fail, proving it actually tests something.
| Type | Purpose | Dependencies |
|---|---|---|
| Unit | Single function/method | Mock externals |
| Integration | Multiple components | Real dependencies |
| E2E | Full user workflow | Full system |
Always test:
Skip testing:
Before marking complete:
Can't check all boxes? You skipped TDD. Start over.
Bug: Empty email accepted
RED
test('rejects empty email', async () => {
const result = await submitForm({ email: '' });
expect(result.error).toBe('Email required');
});
Verify RED
$ npm test
FAIL: expected 'Email required', got undefined
GREEN
function submitForm(data: FormData) {
if (!data.email?.trim()) {
return { error: 'Email required' };
}
// ...
}
Verify GREEN
$ npm test
PASS
REFACTOR - Extract validation if needed.
| Problem | Solution |
|---|---|
| Don't know how to test | Write desired API first. Write assertion first. |
| Test too complicated | Design too complicated. Simplify interface. |
| Must mock everything | Code too coupled. Use dependency injection. |
| Test setup huge | Extract helpers. Still complex? Simplify design. |
Complete the current milestone and prepare next work by following the canonical complete command doc.
Execute the current plan (from STATE.md -> PLAN.md) by following the canonical execute command doc. Make code changes + run necessary checks.
Initialize project with CLAUDE.md, STATE.md, and ROADMAP.md by following the canonical init command doc.
Create executable plan for the current phase (3-5 tasks). Reads the canonical plan command doc and produces/updates the current PLAN.md referenced from STATE.md. No implementation.
Review code changes and capture learnings for CLAUDE.md by following the canonical review command doc.
Check project progress and suggest the next action by following the canonical status command doc.