test-driven-development
Use when implementing or changing code behavior, before writing production code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing or changing code behavior, before writing production code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Guide for creating new skills, improving existing skills, and evaluating skill quality. Use this whenever the user wants to turn a workflow into a skill, revise a skill, improve triggering behavior, or add evals and benchmarks for a skill.
Use when reviewing a diff, PR, or patch for bugs, regressions, missing tests, architecture risk, security risk, or reviewability concerns before merge.
Use when starting a repo-grounded task, switching subsystems, or when output quality drops and the agent needs tighter project context from rules, specs, relevant files, examples, and current errors.
Use when implementing or reviewing framework-specific code that should be verified against current official docs, versioned guidance, or source-cited examples rather than memory.
Use when the user explicitly asks Guardian to launch or check an external coding assistant such as Codex, Claude Code, Gemini CLI, or Aider.
Use when the request is about a repo, codebase, implementation, bugfix, or backend-owned coding session that should stay anchored to the active workspace.
| name | test-driven-development |
| description | Use when implementing or changing code behavior, before writing production code. |
Write the failing test first. Watch it fail for the right reason. Then write the smallest production change that makes it pass.
Persona Injection: Adopt the perspective of a QA Specialist. Your primary goal is to prove the code works through verifiable tests, not just to write code. You treat tests as the actual proof of correctness. No production code is valid without a failing test first.
| Rationalization | Reality |
|---|---|
| "I'll write the code first and the tests later." | Post-hoc testing is often biased to pass the code written. Tests must define the requirement first. |
| "The existing test suite is too broad, I'll just write a small unit test to pass quickly." | Do not invent a narrower test just to avoid the real proof surface. |
| "I know this works, I don't need a test for this bug fix." | If it broke once, it needs a regression test to ensure it never breaks again. |
Stop and restart if:
Read references/testing-anti-patterns.md before adding complex mocks, harness helpers, or test-only abstractions.