一键导入
testing-rules
Use when writing, reviewing, or validating tests — including unit tests, integration tests, BATS tests, and visual verification tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing, reviewing, or validating tests — including unit tests, integration tests, BATS tests, and visual verification tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | testing-rules |
| description | Use when writing, reviewing, or validating tests — including unit tests, integration tests, BATS tests, and visual verification tasks. |
This is the canonical home of the "tests for behaviour, not phrasing" rule.
Do not assert that a markdown file contains a specific word. Do not test that a file exists when the next operation would fail loudly if missing. Do not write 20 tests for a README section. Match test depth to change risk: new modules need real coverage; trivial edits need none.
Every test must exercise one of:
| Change type | Required coverage |
|---|---|
| New file or module | happy path + edge cases + error states — FAIL if missing |
| Bug fix | regression test that proves the bug is fixed — WARN if absent, do NOT REJECT |
| Small edit / refactor | coverage gaps are WARNINGs, not blockers |
| Trivial one-liner | no test required |
Always run the full test suite — never scope to changed files only. The goal is to catch regressions across the entire codebase.
BATS command: .claude-agent-flow/tests/lib/bats-core/bin/bats --jobs 8 .claude-agent-flow/tests/*.bats
When a test fails, diagnose the root cause first:
Never blindly update a test to make it pass — a green suite built on weakened assertions is worse than a red one.
After any HTML/CSS change, run visual-check.sh at mobile (375px) and desktop viewports. Report pass/fail as part of test results. See playwright-cli-helpers skill.
testing-rules is cross-cutting. It applies to all test writing and review regardless of domain. Domain skills (frontend-rules, backend-rules) do not override testing rules.
Use this explicit rubric when editing or reviewing tests:
DELETE
[[ -f path ]] with no behavioral follow-up.CONSOLIDATE
N near-identical file checks).test_helper.bash over duplicate loop logic across files.KEEP
grep -q 'literal phrase' README.md.resolve-task.sh, verifies exit code, and checks parsed output fields.Use when updating documentation, README sections, CHANGELOG entries, docstrings, or CLAUDE.md conventions after a feature is complete.
Use when the task involves server-side API routes, middleware, business logic, authentication, database queries, or infrastructure configuration.
Task and document management with Backlog.md. Use this skill whenever working with tasks, tracking work, creating subtasks, searching or viewing existing tasks, or any time work should be preserved across sessions or handed off. Triggers include: "create a task", "track this", "add to backlog", "what tasks do I have", "mark as done", "continue on task", "break this into tasks", or any request where the outcome has a concrete deliverable worth tracking. Always use this skill when a project includes a Backlog.md setup and work needs to be logged. Prefer CLI commands unless MCP tools are confirmed working in the current environment.
Use when adversarial code review is needed — actively constructing failure scenarios, edge cases, and security violations to break the implementation.
Run code review via an external LLM API using external-review.sh. Outputs structured JSON with verdict, summary, and per-file concerns.
Use when the task involves UI components, HTML, CSS, styling, React, Vue, Svelte, client-side state, accessibility, or browser APIs.