一键导入
test
Write tests for existing code or new features. Use when asked to add tests, improve test coverage, or write tests for a specific function or module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write tests for existing code or new features. Use when asked to add tests, improve test coverage, or write tests for a specific function or module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Review code changes for bugs, security vulnerabilities, performance issues, and maintainability. Use when asked to review code, a PR, a diff, or recent changes.
Systematically diagnose and fix bugs, unexpected behavior, or failing tests. Use when something is broken and the cause is not immediately obvious.
Explore a codebase and produce a detailed implementation plan before writing any code. Use when asked to plan a feature, think through an approach, or figure out how to implement something.
Safely restructure code to improve clarity, reduce duplication, or simplify design without changing observable behavior. Use when asked to clean up, simplify, or restructure code.
Write a technical specification for a feature, API, or system component. Use when asked to spec out, design, or document a feature before it is built.
| name | test |
| description | Write tests for existing code or new features. Use when asked to add tests, improve test coverage, or write tests for a specific function or module. |
Tests verify behavior, not implementation. A test that breaks when you rename a variable is a bad test.
Before writing any test:
For every function or behavior, enumerate:
Happy path The normal input that produces the expected output.
Boundary cases
Error cases
Edge cases specific to the logic Think about what could go wrong given how the code works.
Follow the existing test framework and style in the codebase. Do not introduce a new testing library.
Structure each test as:
it("returns null when the token is expired", () => {
// Arrange
const token = createToken({ expiresAt: new Date("2000-01-01") });
// Act
const result = validateToken(token);
// Assert
expect(result).toBeNull();
});
Rules:
Tests written
path/to/file.test.ts — what behaviors are now coveredCases covered List the scenarios now tested.
Cases not covered Any gaps you identified but did not write tests for, and why (e.g. requires integration setup, out of scope).