一键导入
testing
Use when writing tests, designing test strategy, or verifying AI-generated code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing tests, designing test strategy, or verifying AI-generated code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Execute safe Git workflows — branching, committing, resolving conflicts, and managing PRs
Use when controlling AI spend, token budgets, model routing, or workflow efficiency before scaling usage
Use when handling incidents, outages, severe regressions, or operational emergencies before attempting broad fixes
Use when investigating latency, throughput, resource saturation, or performance regressions before changing implementation details
Use when reviewing code, preparing a PR for review, or processing review feedback
Use when diagnosing bugs, test failures, or unexpected behavior before attempting any fix
| name | testing |
| description | Use when writing tests, designing test strategy, or verifying AI-generated code |
Announce at start: "Following the testing skill for test design."
Test behavior, not implementation. Tests must survive refactoring.
Write tests in this ratio:
| Layer | Quantity | Speed | Focus |
|---|---|---|---|
| Unit | Many (1000s) | Fast (ms) | Individual functions/classes |
| Integration | Some (100s) | Medium (s) | Component interactions |
| E2E | Few (10s) | Slow (min) | Full user flows |
Every test follows AAA:
def test_order_total_includes_tax():
# Arrange
order = Order(items=[Item(price=100)])
tax = TaxCalculator(rate=0.08)
# Act
total = order.calculate_total(tax)
# Assert
assert total == 108.00
| Pattern | Example |
|---|---|
test_<unit>_<scenario> | test_login_with_invalid_password |
test_<unit>_<scenario>_<expected> | test_discount_exceeds_max_caps_at_max |
| Priority | What to Test |
|---|---|
| High | Business logic, data mutations, security/auth, payments |
| Medium | Utility functions, error handling, integration points |
| Low | Generated code, configuration, UI styling |
Critical paths (payments, auth, data mutations) always require 100% coverage.
Every bug fix must include a regression test that:
| When | Invoke |
|---|---|
| Test reveals a bug | debugging |
| Need E2E tests specifically | e2e-testing |
| Tests pass, ready to submit | pr-writing |
| Code needs review before tests | code-review |
For principles, rationale, anti-patterns, and examples:
guides/testing-strategy/testing-strategy.mdguides/testing-ai-code/testing-ai-code.md