test-generator
БесплатноЗапускает вложенные скриптыНе проверенGenerate comprehensive test boilerplate following project TDD conventions. Use when creating new tests for modules, classes, or functions. Automatically…
от aiskillstore★ 509 звёзд на GitHubОб этом скилле
Test Boilerplate Generator
⚠️ MANDATORY: Read Project Documentation First
BEFORE generating tests, you MUST read and understand the following project documentation:
Core Project Documentation
- README.md - Project overview, features, and getting started
- AI_DOCS/project-context.md - Tech stack, architecture, development workflow
- AI_DOCS/code-conventions.md - Code style, formatting, best practices (especially for tests)
- AI_DOCS/tdd-workflow.md - TDD process, testing standards, coverage requirements (CRITICAL)
Session Context (if available)
- .ai-context/ACTIVE_TASKS.md - Current tasks and priorities
- .ai-context/CONVENTIONS.md - Project-specific conventions
- .ai-context/RECENT_DECISIONS.md - Recent architectural decisions
- .ai-context/LAST_SESSION_SUMMARY.md - Previous session summary
Additional AI Documentation
- AI_DOCS/ai-tools.md - Session management workflow
- AI_DOCS/ai-skills.md - Other specialized skills/agents available
Why This Matters
- Testing Standards: Follow project-specific test structure and conventions
- TDD Patterns: Use AAA pattern, proper fixtures, and parametrization
- Code Quality: Generate tests with type hints, docstrings, proper imports
- Mock Guidelines: Understand when to mock vs. use real code
- Coverage Goals: Generate tests that help reach 80%+ coverage
After reading these files, proceed with your test generation task below.
Overview
Automatically generate comprehensive test boilerplate that follows this project's strict TDD and quality standards.
When to Use
- Creating tests for a new module, class, or function
- Starting TDD workflow (write tests FIRST!)
- Need test templates with proper structure
- Want parametrized test examples
- Creating test fixtures
What This Skill Generates
✅ Test files with proper imports and structure ✅ Test classes organized by functionality ✅ Parametrized test templates ✅ AAA pattern (Arrange-Act-Assert) structure ✅ Complete type hints ✅ Google-style docstrings ✅ Fixture templates (when needed)
Usage Examples
Generate Tests for a Module
# User provides source file
generate tests for src/python_modern_template/validators.py
Output: Creates tests/test_validators.py with:
- Test class for each function/class
- Parametrized test cases
- Edge case test templates
- Proper imports and structure
Generate Tests for a Specific Function
# User describes the function
generate tests for validate_email function that checks email format
Output: Creates test class with:
- Basic functionality tests
- Edge cases (empty, invalid format, special characters)
- Parametrized test cases
- Error handling tests
Generate Fixture Template
# User needs test fixtures
generate pytest fixture for database connection
Output: Creates conftest.py entry with proper fixture structure
Step-by-Step Process
Step 1: Analyze Source Code
If source file provided:
- Read the source file
- Identify all public functions and classes
- Analyze function signatures (parameters, return types)
- Identify error cases (raises clauses)
If described by user:
- Extract function/class name
- Understand parameters and return type
- Identify test scenarios from description
Step 2: Choose Template
Select appropriate template from templates/:
test_function.py- Simple function teststest_class.py- Class with methods teststest_parametrized.py- Data-driven teststest_async.py- Async function teststest_exception.py- Error handling testsconftest_fixture.py- Pytest fixtures
Step 3: Generate Test Code
Use templates from .claude/skills/test-generator/templates/ directory.
Template Variables:
{module_name}- Source module name{class_name}- Class being tested{function_name}- Function being tested{test_class_name}- Generated test class name{import_path}- Full import path{param_names}- Function parameters{return_type}- Function return type
Step 4: Add Test Cases
Generate test cases for:
- Happy path - Normal successful execution
- Edge cases - Boundary values, empty inputs, None values
- Error cases - Invalid inputs, exceptions
- Parametrized cases - Multiple input combinations
Step 5: Format and Save
- Apply proper formatting (Black, isort)
- Ensure type hints and docstrings
- Save to appropriate test file
- Display summary of generated tests
Templates Reference
Template: Simple Function Test
File: templates/test_function.py
"""Tests for {module_name}.{function_name}."""
from __future__ import annotations
import pytest
from {import_path} import {function_name}
class Test{FunctionNameCamelCase}:
"""Test cases for {function_name}."""
def test_{function_name}_basic(self) -> None:
"""Test basic functionality of {function_
Установить test-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл test-generator?
Generate comprehensive test boilerplate following project TDD conventions. Use when creating new tests for modules, classes, or functions. Automatically creates tests with proper structure, type hints, docstrings, and AAA pattern.
Как установить скилл test-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-generator запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
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