test-generation
БесплатноЗапускает вложенные скриптыНе проверенGenerate comprehensive tests following project testing patterns. Use after implementing features.
Об этом скилле
Test Generation Skill
Purpose
Create consistent, comprehensive tests.
Test Patterns
Unit Test Pattern
Reference: patterns/unit-tests.md
describe('[Unit Under Test]', () => {
describe('[method/function]', () => {
it('should [expected behavior] when [condition]', () => {
// Arrange
const input = ...;
const expected = ...;
// Act
const result = functionUnderTest(input);
// Assert
expect(result).toEqual(expected);
});
it('should throw [error] when [invalid condition]', () => {
// Arrange
const invalidInput = ...;
// Act & Assert
expect(() => functionUnderTest(invalidInput))
.toThrow(ExpectedError);
});
});
});
Integration Test Pattern
Reference: patterns/integration-tests.md
E2E Test Pattern
Reference: patterns/e2e-tests.md
Coverage Targets
| Type | Lines | Functions | Branches |
|---|---|---|---|
| Unit | 80% | 80% | 70% |
| Integration | 60% | 60% | 50% |
| E2E | Critical paths | - | - |
Test Naming Convention
[should/does] [expected behavior] [when/given] [condition]
Examples:
should return user when valid ID providedshould throw NotFoundError when user does not existshould disable button when form is invalid
What to Test
- Happy path (normal operation)
- Edge cases (boundaries)
- Error cases (exceptions)
- State transitions
Test Structure
AAA Pattern
// Arrange - set up test data and conditions
const input = createTestInput();
const mockService = createMock();
// Act - execute the code under test
const result = await functionUnderTest(input);
// Assert - verify the outcome
expect(result).toEqual(expectedOutput);
expect(mockService.method).toHaveBeenCalledWith(expectedArgs);
BDD Style
describe('User Service', () => {
describe('when creating a user', () => {
it('should save the user to the database', () => { });
it('should send a welcome email', () => { });
it('should return the created user', () => { });
});
describe('when the email is invalid', () => {
it('should throw a ValidationError', () => { });
});
});
Test Template
Use: templates/test-template.ts
Best Practices
Do
- Test behavior, not implementation
- Use descriptive test names
- Keep tests independent
- Use factories for test data
- Mock external dependencies
Don't
- Test private methods directly
- Share state between tests
- Use production data in tests
- Over-mock (test should be meaningful)
- Write flaky tests
Storage Location
Save test reports to: docs/reviews/test-report-{session}.md
Установить test-generation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл test-generation?
Generate comprehensive tests following project testing patterns. Use after implementing features.
Как установить скилл test-generation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-generation запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic