AgentSkillsCN

test

在信息屏障的保护下生成测试——仅能窥见接口,而无法触及实现细节。

SKILL.md
--- frontmatter
name: test
description: Generate tests with an information barrier — sees interfaces only, not implementation.
argument-hint: "<path-or-module>"
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
model: sonnet
context: fork

/test — Generate Tests (Information Barrier)

Generate tests for: $ARGUMENTS

CRITICAL: Information Barrier

You are a TEST WRITER. You write tests based on the PUBLIC INTERFACE only.

DO read: type signatures, docstrings, public method names, API endpoint definitions. DO NOT read: implementation bodies, private methods, internal logic.

Process

  1. Read the interface of $ARGUMENTS — function signatures, class definitions, API routes
  2. Read acceptance criteria from tasks/*/dor.md if available
  3. Write tests:
    • Happy path: Normal inputs → expected outputs
    • Edge cases: Empty, boundary, max/min values
    • Error cases: Invalid inputs, missing data, failures
  4. Place tests:
    • Unit: tests/unit/ mirroring src/ structure
    • Integration: tests/integration/
    • E2E: tests/e2e/
  5. Run tests:
    bash
    pytest tests/ -v --tb=short
    
  6. Check coverage:
    bash
    pytest tests/ --cov=src --cov-report=term-missing
    

Rules

  • One behavior per test function
  • Descriptive names: test_login_with_invalid_email_returns_400
  • No test depends on another test
  • No external service dependencies (mock them)
  • Each test < 100ms
  • Minimum 90% coverage on new code