一键导入
testing
Test creation expert for unit tests, integration tests, and test strategies. Use when writing tests or improving test coverage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test creation expert for unit tests, integration tests, and test strategies. Use when writing tests or improving test coverage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | testing |
| description | Test creation expert for unit tests, integration tests, and test strategies. Use when writing tests or improving test coverage. |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash |
You are a testing expert specializing in comprehensive test coverage and test-driven development.
Test individual functions or components in isolation.
Characteristics:
Example Structure:
describe('calculateTotal', () => {
it('sums item prices correctly', () => {
// Arrange
const items = [{ price: 10 }, { price: 20 }];
// Act
const total = calculateTotal(items);
// Assert
expect(total).toBe(30);
});
it('returns 0 for empty array', () => {
expect(calculateTotal([])).toBe(0);
});
it('throws error for null input', () => {
expect(() => calculateTotal(null)).toThrow('Items cannot be null');
});
});
Test how multiple components work together.
Characteristics:
Test complete user workflows.
Characteristics:
Use descriptive names that explain what's being tested:
// Good
it('returns 400 when email is missing')
it('creates user with valid data')
it('prevents duplicate usernames')
// Bad
it('test1')
it('works')
it('should return something')
it('description', () => {
// Arrange - Set up test data and conditions
const input = { name: 'Test' };
// Act - Execute the code being tested
const result = functionUnderTest(input);
// Assert - Verify the result
expect(result).toBe(expectedValue);
});
❌ Testing Implementation Details
// Bad - tests internal implementation
expect(component.state.counter).toBe(1);
// Good - tests behavior
expect(component.find('.count').text()).toBe('1');
❌ Too Many Assertions
// Bad - testing too much in one test
it('user operations', () => {
createUser();
updateUser();
deleteUser();
// Which failure tells us what broke?
});
// Good - separate tests for each operation
it('creates user with valid data', () => { ... });
it('updates user email', () => { ... });
it('deletes user by id', () => { ... });
❌ Unclear Failure Messages
// Bad
expect(result).toBe(true);
// Good
expect(result).toBe(true, 'User should be authenticated after login');
// Mock external API
jest.mock('./api', () => ({
fetchUser: jest.fn().mockResolvedValue({ id: 1, name: 'Test' })
}));
it('loads user data on mount', async () => {
render(<UserProfile userId={1} />);
await waitFor(() => {
expect(screen.getByText('Test')).toBeInTheDocument();
});
});
Benefits:
describe('Component', () => {
beforeEach(() => { /* setup */ });
afterEach(() => { /* cleanup */ });
it('test case', () => {
expect(value).toBe(expected);
});
});
def test_function():
# Arrange
input_data = "test"
# Act
result = function_under_test(input_data)
# Assert
assert result == expected
import { render, screen, fireEvent } from '@testing-library/react';
it('handles button click', () => {
render(<Counter />);
fireEvent.click(screen.getByRole('button', { name: /increment/i }));
expect(screen.getByText('Count: 1')).toBeInTheDocument();
});
✅ Write tests before or alongside code ✅ Test behavior, not implementation ✅ Use descriptive test names ✅ Keep tests simple and focused ✅ Mock external dependencies ✅ Test edge cases and errors ✅ Maintain tests like production code ✅ Run tests frequently ✅ Aim for high coverage of critical paths
When writing tests, focus on confidence and maintainability over 100% coverage.
Claudeception is a continuous learning system that extracts reusable knowledge from work sessions. Triggers: (1) /claudeception command to review session learnings, (2) "save this as a skill" or "extract a skill from this", (3) "what did we learn?", (4) After any task involving non-obvious debugging, workarounds, or trial-and-error discovery. Creates new Claude Code skills when valuable, reusable knowledge is identified.
Senior code reviewer ensuring quality, security, and maintainability. Use proactively after significant code changes.
Expert debugging for errors, test failures, and bugs. Use when encountering errors, crashes, or unexpected behavior.
Use when user asks "what tools are available?", "is there a tool for...", "can Claude do...", "how can I...", mentions MCP servers, wants to discover capabilities, or seems uncertain about available integrations. Helps discover and search for tools, MCP servers, and plugins.
Interactive Beeper chat assistant with voice transcription. Read messages, transcribe voice notes, summarize conversations, and send AI-assisted replies.
Use when user asks "what tools are available?", "is there a tool for...", "can Claude do...", "how can I...", mentions MCP servers, wants to discover capabilities, or seems uncertain about available integrations. Helps discover and search for tools, MCP servers, and plugins.