ln-743-test-infrastructure
БесплатноЗапускает вложенные скриптыНе проверенCreates test infrastructure with Vitest, xUnit, and pytest
от tensology★ 17 звёзд на GitHubОб этом скилле
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.
ln-743-test-infrastructure
Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-740-quality-setup
Sets up testing frameworks, coverage tools, and sample tests for projects.
Purpose & Scope
Does:
- Detects project stack to choose appropriate test framework
- Creates test configuration files
- Sets up coverage reporting with thresholds
- Creates sample tests demonstrating patterns
- Verifies test suite runs successfully
Does NOT:
- Configure linters (ln-741 does this)
- Set up pre-commit hooks (ln-742 does this)
- Write actual application tests (developers do this)
Supported Stacks
| Technology | Test Framework | Coverage Tool | Config File |
|---|---|---|---|
| TypeScript/React | Vitest | v8/Istanbul | vitest.config.ts |
| .NET | xUnit | Coverlet | *.Tests.csproj |
| Python | pytest | pytest-cov | pytest.ini or pyproject.toml |
Phase 1: Check Existing Tests
Before creating test infrastructure, check what exists.
Files to Check:
| Stack | Test Indicators |
|---|---|
| TypeScript | vitest.config.*, jest.config.*, *.test.ts, *.spec.ts |
| .NET | *.Tests.csproj, *.IntegrationTests.csproj |
| Python | pytest.ini, conftest.py, tests/, test_*.py |
Decision Logic:
- If complete test setup exists: SKIP (inform user)
- If partial setup: ASK to extend or replace
- If no tests: CREATE from templates
Phase 2: Create Test Configuration
TypeScript/React (Vitest)
Create vitest.config.ts:
- Use v8 coverage provider (faster than Istanbul)
- Configure jsdom environment for React
- Set coverage thresholds (80% minimum)
- Create setup file for testing-library
Dependencies:
npm install -D vitest @vitest/coverage-v8 @testing-library/react @testing-library/jest-dom jsdom
.NET (xUnit)
Create test project:
dotnet new xunit -n {Project}.Tests
dotnet sln add tests/{Project}.Tests
Dependencies (in .csproj):
- Microsoft.NET.Test.Sdk
- xunit
- xunit.runner.visualstudio
- Moq
- FluentAssertions
- coverlet.collector
Python (pytest)
Add to pyproject.toml or create pytest.ini:
- Configure test discovery paths
- Set coverage thresholds (80% minimum)
- Configure coverage reporting
Dependencies:
pip install pytest pytest-cov pytest-asyncio
# OR with uv:
uv add --dev pytest pytest-cov pytest-asyncio
Phase 3: Create Test Directory Structure
TypeScript
src/
├── components/
│ ├── Button.tsx
│ └── Button.test.tsx # Co-located tests
├── test/
│ └── setup.ts # Test setup file
.NET
tests/
├── {Project}.Tests/
│ ├── Controllers/
│ │ └── SampleControllerTests.cs
│ ├── Services/
│ └── {Project}.Tests.csproj
└── {Project}.IntegrationTests/ # Optional
Python
tests/
├── __init__.py
├── conftest.py # Fixtures
├── unit/
│ └── test_sample.py
└── integration/ # Optional
Phase 4: Create Sample Tests
Create one sample test per stack demonstrating:
- AAA pattern (Arrange-Act-Assert)
- Test naming conventions
- Basic assertions
- Framework-specific patterns
TypeScript Sample Test
Shows:
- render() from testing-library
- screen queries
- Jest-dom matchers
.NET Sample Test
Shows:
- [Fact] attribute
- Moq for mocking
- FluentAssertions syntax
Python Sample Test
Shows:
- pytest fixtures
- assert statements
- parametrized tests (optional)
Phase 5: Verify Test Run
After setup, verify tests work.
TypeScript:
npm test
npm run test:coverage
Expected: Sample test passes, coverage report generated
.NET:
dotnet test
dotnet test --collect:"XPlat Code Coverage"
Expected: Sample test passes, coverage collected
Python:
pytest
pytest --cov=src --cov-report=term-missing
Expected: Sample test passes, coverage report shown
On Failure: Check test configuration, dependencies, verify sample test syntax.
Coverage Requirements
| Metric | Minimum | Target |
|---|---|---|
| Lines | 70% | 80% |
| Branches | 70% | 80% |
| Functions | 70% | 80% |
| Statements | 70% | 80% |
Configure CI to fail if coverage drops below thresholds.
Critical Rules
RULE 1: Coverage thresholds MUST be configured. No exceptions.
RULE 2: Sample tests MUST pass. Don't create broken examples.
RULE 3: Use AAA pattern (Arrange-Act-Assert) in all sample tests.
RULE 4: Co-locate unit tests with source (TypeScript) or use tests/ directory (.NET, Python).
Definition of Done
- Test framework installed and configured
- Coverage tool configured with 80% threshold
- Test directory structure created
- Sample test created and passin
Установить ln-743-test-infrastructure в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ln-743-test-infrastructure?
Creates test infrastructure with Vitest, xUnit, and pytest
Как установить скилл ln-743-test-infrastructure?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ln-743-test-infrastructure запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
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