AgentSkillsCN

test-writer

在实现新功能或修复Bug后使用。为已变更的代码编写针对性强的测试用例。

SKILL.md
--- frontmatter
name: test-writer
description: Use after implementing a feature or fixing a bug. Writes focused tests for the changed code.

After a feature is implemented or a bug is fixed, write tests that cover the changes:

  1. Focus on behavior -- Test what the code does, not how it does it. Tests should survive refactoring.
  2. Cover the happy path first -- Then add edge cases and error cases.
  3. Keep tests small -- One assertion per test when practical. Each test should verify one thing.
  4. Use the project's existing test framework -- Match the patterns and conventions already in use. If none exist, ask the user what framework to use before writing tests.
  5. Name tests clearly -- The test name should describe the expected behavior (e.g., returns_empty_list_when_no_results).

Do not write tests for code that wasn't changed. Do not add test utilities or helpers unless they're needed more than once.