AgentSkillsCN

sb-review-tests

对测试的完整性、实用性、隔离性与可读性进行审查。适用于被要求审查测试、检验测试质量、审计测试覆盖率,或验证测试文件时。

SKILL.md
--- frontmatter
name: sb-review-tests
description: Review tests for completeness, usefulness, isolation, and readability. Use when asked to review tests, check test quality, audit test coverage, or validate test files.

Tests Review

Review tests in the specified path for quality issues.

[!IMPORTANT] Consult REFERENCE.md in this skill directory for the expected output format and level of detail.

User Input

text
$ARGUMENTS

You MUST consider the user input before proceeding (if not empty).

Argument Parsing

Parse $ARGUMENTS for:

  • Path: Required path to review (file or directory containing tests)
  • --create-beads: Create beads for findings (default: report only)

Workflow

  1. Find and read test files in the specified path
  2. Evaluate against quality criteria
  3. Check for existing beads: bd list --status=open
  4. For each issue found, skip if a bead already exists with matching file/issue
  5. Create beads only for new issues

Deduplication

Before creating a bead, check if one already exists:

  • Run bd list --status=open to see all open issues
  • Compare your findings against existing bead titles and descriptions
  • Skip creating beads for issues that already have matching open beads
  • When in doubt, show the user the potential duplicate rather than creating

Quality Criteria

Completeness

  • Edge cases covered
  • Error paths tested
  • Boundary conditions checked
  • Happy path and failure scenarios both present

Usefulness

  • Tests catch real bugs, not just chase coverage
  • Tests would fail if code broke
  • Tests validate behavior, not implementation details

Output Validation

  • Assertions check actual results
  • Not just "no error thrown"
  • Expected values are meaningful, not arbitrary

Isolation

  • No shared mutable state between tests
  • Tests can run in any order
  • Tests can run in parallel
  • External dependencies mocked/stubbed appropriately

Readability

  • Clear, descriptive test names
  • Obvious arrange-act-assert structure
  • Test intent immediately clear
  • Setup/teardown not hiding important context

Integration Test Specifics

  • Proper cleanup of test data
  • Appropriate use of test fixtures
  • Reasonable timeouts configured
  • Clear distinction from unit tests

Severity

  • P1: Shared mutable state, tests that never fail, tests masking real bugs
  • P2: Missing assertions on return values, unclear test names, no isolation
  • P3: Missing edge cases, minor readability issues

Output

You MUST produce a report following the exact structure shown in REFERENCE.md.

--create-beads mode: Create beads for P1/P2 issues:

bash
bd create --type=bug --priority=<1-3> --title="Test: <issue>" --description="<file and explanation>"