KeiSeiKit-1.0/skills/test-gen/SKILL.md
Parfii-bot ddd13e6422 docs: SKILL.md triggers + STATUS-TRUTH footer + phase placeholders
Group G — markdown tech-debt cleanup (post-audit 2026-05-02).

- 36 SKILL.md files: added "## When to use" section. Was missing across the
  catalog; orchestrator routing by keyword could not auto-dispatch.

- 20 code-implementer agent .md files: added Output Footer block prescribing
  RULE 0.16 STATUS-TRUTH MARKER schema in agent's final report. Previously only
  code-implementer-rust.md had it; other 27 language/role variants were silent
  about the marker, breaking RULE 0.16 §3 status-truth aggregation for non-Rust
  batches.

- skills/site-create/: added phase-5-preview.md and phase-6-deploy.md skeleton
  files. SKILL.md table-of-contents referenced 7 phases; only 5 existed on disk.

- skills/{ai-animation,rag-pipeline}/skill.md: added migration banner comment
  noting they should be SKILL.md (canonical filename). Case-rename via git is a
  separate orchestrator task (macOS APFS is case-insensitive; Linux deploy needs
  explicit rename).

- 3 deprecated skills (site-builder, competitor-analysis, design-inspiration):
  added concrete removed-after dates (was vague "before v2").

- docs/CONVERGENCE-PLAN.md:129: TBD on _blocks/evidence-grading.md duplicate
  resolved (file exists, not duplicated).

- docs/DNA-INDEX.md: count edits made then overwritten by auto-encyclopedia-refresh
  hook during agent run. The .kei-registry-ignore files in test fixtures (Group F)
  are the structural fix; kei-registry walker implementation is the follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 21:41:41 +08:00

2.2 KiB

name description arguments
test-gen Use when generating tests for untested code — happy path, edge cases, error handling
name description required
target File path or function name to test true

When to use

  • Generating unit tests for a specific function or file (happy path, edge cases, error handling).
  • Writing tests first (TDD) before implementing new functionality.
  • Use /test-gen for per-function unit tests; use /test-matrix for project-wide testing strategy.

Complements /test-matrix. /test-gen owns per-function unit tests (happy / edge / error). /test-matrix owns project-wide testing strategy (fuzz / property / load / e2e / mutation) and CI wiring. Use /test-gen for a specific function, /test-matrix at project kickoff or when coverage gaps span paradigms. See skills/test-matrix/SKILL.md.

Test Generation Workflow

Step 1: Analyze Target

  • Read the target file/function completely
  • Identify: inputs, outputs, side effects, dependencies, error paths
  • Check existing test files — don't duplicate

Step 2: Detect Framework

  • Auto-detect test framework from project:
    • Python: pytest (conftest.py, pytest.ini) or unittest
    • JS/TS: jest (jest.config), vitest (vitest.config), mocha
    • Flutter: flutter_test
    • Go: built-in testing
  • Match existing test file naming: test_*.py, *.test.ts, *_test.dart, *_test.go

Step 3: Plan Test Cases

Categories (in order of priority):

  1. Happy path — normal expected usage (2-3 cases)
  2. Edge cases — boundaries, empty inputs, max values (2-3 cases)
  3. Error handling — invalid inputs, missing data, network errors (1-2 cases)
  4. Integration — only if function interacts with external services (1 case with mock)

Step 4: Write Tests

  • Follow existing test patterns in the project
  • Use descriptive test names: test_<function>_<scenario>_<expected>
  • One assertion per test (prefer)
  • Mock external dependencies, not internal logic
  • Use fixtures/factories from existing test infrastructure

Step 5: Run & Verify

  • Run new tests — all must pass
  • Run full test suite — no regressions
  • Check coverage delta if coverage tool available

Step 6: Commit

  • test: add tests for <target>