testing-patterns
TDD patterns, Jest testing conventions, and test quality standards. Use when writing any tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
TDD patterns, Jest testing conventions, and test quality standards. Use when writing any tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Code review standards for automated and manual reviews. Use when reviewing code changes.
Ensure documentation stays in sync with code changes. Trigger when modifying CLI commands, config options, directory structure, or public APIs.
Git branch naming, commit conventions, and PR workflow. Use for all git operations.
Two-layer feature planning (business + technical). Use when planning any feature before implementation starts.
Comprehensive security vulnerability scanning and OWASP Top 10 compliance checking. Use when reviewing code for security issues, validating authentication/authorization, or ensuring security best practices.
Comprehensive patterns for writing robust non-brittle tests including eliminating waitForTimeout, mocking time properly, and generating unique test data. Use when writing any tests to ensure fast reliable maintainable test suites.
| name | testing-patterns |
| description | TDD patterns, Jest testing conventions, and test quality standards. Use when writing any tests. |
| auto_load | true |
| priority | high |
When writing tests or implementing features that need tests.
describe('ModuleName', () => {
describe('functionName', () => {
it('should do expected behavior when given input', () => {
// Arrange
const input = createTestInput();
// Act
const result = functionName(input);
// Assert
expect(result).toEqual(expectedOutput);
});
it('should throw when given invalid input', () => {
expect(() => functionName(null)).toThrow();
});
});
});
should return 404 when user not foundtest getUserByIdbeforeEach for setup, not beforeAll for mutable statejest.mock() at module level, jest.spyOn() for specific methodsjest.restoreAllMocks() in afterEachwaitForTimeout() or sleep() in testsany type assertions to make tests pass