testcontainers — Claude Code skill for .NET integration tests
A skill for .NET integration tests: spins up real databases, Redis and message brokers in Docker instead of mocks.
npx skills add wshaddix/dotnet-skills --skill testcontainers -a claude-codeWhat testcontainers does
This skill lays out Testcontainers patterns for .NET integration tests. Your tests talk to actual SQL Server, PostgreSQL, MySQL, Redis, RabbitMQ or Kafka instances, each in its own container. Containers get random ports, so parallel runs don't collide, and Testcontainers handles the lifecycle for you.
Inside are C# examples: a test class implements IAsyncLifetime, InitializeAsync starts the container and opens a connection, DisposeAsync tears everything down. It also covers the NuGet packages you need (Testcontainers, xunit, database drivers), readiness checks with WaitStrategy, migrations, and clearing data between tests. Reference files go deeper on database containers, message brokers, and advanced setups like networks and volumes.
Docker is required. No running daemon means containers never start and your tests fail during setup — worth checking before you wire this into CI. The sample connection strings and passwords sit right in the code, so move them to configuration for a real project.
What it helps with
- verify SQL queries and constraints against a real database instead of mocks
- spin up RabbitMQ or Kafka in a test and confirm messages arrive
- run migrations and schema changes before a deploy
- isolate tests from each other with separate containers
- check Redis caching behavior without hand-building an environment
Example prompts for the agent
- write an integration test for the orders repository using Testcontainers and PostgreSQL
- add IAsyncLifetime to the test class and start a SQL Server container
- check that migrations apply cleanly to a fresh database in a container
How to install testcontainers
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill testcontainers -a claude-code2Manually: put the files in place
~/.claude/skills/testcontainers/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/testcontainers/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill testcontainers -a codex2Manually: put the files in place
.agents/skills/testcontainers/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill testcontainers -a cursor2Manually: put the files in place
.cursor/skills/testcontainers/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills testcontainers2Manually: put the files in place
.github/skills/testcontainers/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill testcontainers -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/testcontainersManually: put the files in place
.devin/skills/testcontainers/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill testcontainers -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about testcontainers
How do I install testcontainers in Claude?
Run npx skills add wshaddix/dotnet-skills --skill testcontainers -a claude-code. The skill lands at ~/.claude/skills/testcontainers/SKILL.md.
What does the testcontainers skill do?
It documents Testcontainers patterns for .NET integration tests: running real databases, Redis and message brokers in Docker containers instead of mocks.
What do I need for the skill to work?
Docker with a reachable daemon, plus NuGet packages: Testcontainers, xunit and the driver for your database or broker.