一键导入
write-tests
Defines test standards. Must use before writing any test code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Defines test standards. Must use before writing any test code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Standard workflow to implement a plan. Use only when user instructs or other skill references.
Manage interactive or persistent terminal sessions. Must use before running these sessions, like start a dev server, SSH, REPL, ...
Guidelines to help you write code smartly by using workers. Only use
Disciplined diagnosis loop for hard bugs and performance regressions. Use only when user instructs or other skill references.
Workflow to transform vague ideas into validated designs and stepped implementation plans. Use only when user instructs or other skill references.
Review a plan before implementation. Use only when user instructs or other skill references.
| name | write-tests |
| description | Defines test standards. Must use before writing any test code. |
Core principle: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. Your work: Write requested tests with respect to the styles below.
If you find the real logic has not been implemented but you are asked to write tests. Reject immediately and report back "Real implementation not found, refuse to write tests."
Integration-style: Test through real interfaces, not mocks of internal parts.
// GOOD: Tests observable behavior
test('user can checkout with valid cart', async () => {
const cart = createCart();
cart.add(product);
const result = await checkout(cart, paymentMethod);
expect(result.status).toBe('confirmed');
});
Characteristics:
test() inside test files instead of nested describe() and it().Implementation-detail tests: Coupled to internal structure.
// BAD: Tests implementation details
test('checkout calls paymentService.process', async () => {
const mockPayment = jest.mock(paymentService);
await checkout(cart, payment);
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
});
Red flags:
// BAD: Bypasses interface to verify
test('createUser saves to database', async () => {
await createUser({ name: 'Alice' });
const row = await db.query('SELECT * FROM users WHERE name = ?', ['Alice']);
expect(row).toBeDefined();
});
// GOOD: Verifies through interface
test('createUser makes user retrievable', async () => {
const user = await createUser({ name: 'Alice' });
const retrieved = await getUser(user.id);
expect(retrieved.name).toBe('Alice');
});
Mock at system boundaries only:
Don't mock: