
ln-743-test-infrastructure
Sets up test infrastructure with Vitest, xUnit, and pytest. Use when adding testing frameworks and sample tests to a project.
- Installs
- 378
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-743-test-infrastructure- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads ln-743-test-infrastructure automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Paths: File paths (
references/,../ln-*) are relative to this skill directory.
ln-743-test-infrastructure
Type: L3 Worker Category: 7XX Project Bootstrap
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/
├── conftest.py # Shared fixtures (from conftest_template.py)
├── unit/
│ └── test_sample.py
└── integration/ # Optional
For FastAPI/async projects, generate conftest.py from conftest_template.py with shared async HTTP client fixture. Adapt the app import path to match the project.
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).
Monitor (2.1.98+): When test verification after scaffold expected >30s, use Monitor. Fallback: Bash(run_in_background=true).
Definition of Done
- Test framework installed and configured
- Coverage tool configured with 80% threshold
- Test directory structure created
- Sample test created and passing
-
npm test/dotnet test/pytestruns successfully - Coverage report generates
- User informed of:
- How to run tests
- Where to add new tests
- Coverage requirements
Reference Files
| File | Purpose |
|---|---|
| vitest_template.ts | Vitest config template |
| vitest_setup_template.ts | Test setup file |
| react_test_template.tsx | React component test |
| xunit_csproj_template.xml | .NET test project |
| xunit_test_template.cs | xUnit test example |
| pytest_config_template.toml | pytest config |
| pytest_test_template.py | pytest test example |
| conftest_template.py | Shared async fixtures (FastAPI) |
| testing_guide.md | Testing best practices |
Error Handling
| Error | Cause | Resolution |
|---|---|---|
| Vitest not found | Not installed | npm install -D vitest |
| jsdom errors | Missing dependency | npm install -D jsdom |
| xUnit discovery fails | SDK version mismatch | Update Microsoft.NET.Test.Sdk |
| pytest not found | Not in PATH | pip install pytest |
| Coverage 0% | Wrong source path | Check coverage.include config |
Version: 3.0.0 Last Updated: 2026-03-18
FAQ
What does the ln-743-test-infrastructure skill do?
Sets up test infrastructure with Vitest, xUnit, and pytest. Use when adding testing frameworks and sample tests to a project.
How do I install ln-743-test-infrastructure?
Run npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-743-test-infrastructure in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ln-743-test-infrastructure/ (personal) or .claude/skills/ln-743-test-infrastructure/ (project).
Which AI agents can use ln-743-test-infrastructure?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is ln-743-test-infrastructure safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains ln-743-test-infrastructure?
It is published by levnikolaevich in levnikolaevich/claude-code-skills. It has 378 recorded installs.
More from levnikolaevich/claude-code-skills
ln-100-documents-pipeline
levnikolaevich/claude-code-skills
Creates complete project documentation system (project docs, reference, tasks, tests). Use when bootstrapping docs from scratch or regenerating all.
ln-620-codebase-auditor
levnikolaevich/claude-code-skills
Use when auditing the codebase through the evaluation platform with mandatory research, coordinated domain audit workers, and structured summaries.
ln-775-api-docs-generator
levnikolaevich/claude-code-skills
Configures Swagger/OpenAPI documentation for backend APIs. Use when adding interactive API docs to a project.
ln-624-code-quality-auditor
levnikolaevich/claude-code-skills
Checks cyclomatic complexity, nesting, long methods, god classes, O(n2), N+1 queries, constants management. Use when auditing code quality.
ln-782-test-runner
levnikolaevich/claude-code-skills
Executes all test suites and reports results with coverage. Use when verifying that test infrastructure works after bootstrap.
ln-634-test-coverage-auditor
levnikolaevich/claude-code-skills
Open the skill to read its SKILL.md instructions.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work