Tdd logo

Tdd

Organization
codewithmukesh
tdd

Guided test-driven development workflow for .NET 10 using xUnit v3, WebApplicationFactory, Testcontainers, and Verify snapshots. Follows the strict red-green-refactor cycle. Use when: "TDD", "test-driven", "let's TDD this", "red green refactor", "write the test first", or when building a feature with clear acceptance criteria.

Overview

Publishercodewithmukesh
Repositorydotnet-claude-kit
Skill nametdd
Stars
721
Forks
170
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by codewithmukesh on GitHub. Read the source before you install it.

Installation

Install the Tdd AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/codewithmukesh/dotnet-claude-kit.git /tmp/dotnet-claude-kit
mkdir -p .claude/skills
cp -r /tmp/dotnet-claude-kit/skills/tdd .claude/skills/tdd
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Tdd in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Tdd on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Tdd is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

/tdd -- Red-Green-Refactor for .NET

What

Guides a strict test-driven development cycle for .NET features. Instead of writing implementation first and bolting on tests after, this command flips the order: write a failing test that defines the desired behavior, implement the minimum code to make it pass, then refactor with confidence.

Every cycle uses the .NET testing stack:

  • xUnit v3 -- Test framework with [Fact] and [Theory]
  • WebApplicationFactory -- Integration tests against the real HTTP pipeline
  • Testcontainers -- Real databases (PostgreSQL, SQL Server) in tests
  • Verify -- Snapshot testing for complex response structures
  • FakeTimeProvider -- Deterministic time in tests

When

  • User says "TDD", "test-driven", "let's TDD this", "write the test first"
  • Building a new feature with clear acceptance criteria
  • Fixing a bug (write a test that reproduces the bug first, then fix)
  • Adding behavior to an existing feature (test the new behavior first)
  • Any time the user wants proof that code works before it ships

Skip TDD for: Trivial config changes, scaffolding without logic, documentation.

How

Cycle: Red -> Green -> Refactor

Each feature goes through one or more TDD cycles. A cycle covers one discrete behavior.

Step 1: Red -- Write the Failing Test

Write a test that describes the desired behavior. The test MUST fail because the implementation does not exist yet.

csharp
[Fact]
public async Task CreateOrder_WithValidItems_Returns201WithOrderId()
{
    // Arrange
    var client = _factory.CreateClient();
    var request = new CreateOrderRequest([
        new OrderItemRequest("SKU-001", 2, 29.99m)
    ]);

    // Act
    var response = await client.PostAsJsonAsync("/api/orders", request);

    // Assert — plain xUnit Assert (FluentAssertions v8+ requires a commercial license)
    Assert.Equal(HttpStatusCode.Created, response.StatusCode);
    var result = await response.Content.ReadFromJsonAsync<CreateOrderResponse>();
    Assert.NotNull(result);
    Assert.NotEqual(Guid.Empty, result.OrderId);
}

Run the test and confirm it fails:

bash
dotnet test --filter "CreateOrder_WithValidItems_Returns201WithOrderId"

If the test passes without implementation, the test is not testing what you think. Rewrite it.

Step 2: Green -- Minimal Implementation

Write the minimum code to make the test pass. Do not add features, optimizations, or edge case handling. The goal is a green test, nothing more.

  • Create the endpoint, handler, request/response types, and EF config as needed
  • Use the simplest logic that satisfies the test assertion
  • Do not refactor yet -- ugly passing code is fine at this stage

Run the test and confirm it passes:

bash
dotnet test --filter "CreateOrder_WithValidItems_Returns201WithOrderId"
Step 3: Refactor -- Clean Up with Confidence

Now that the test is green, refactor freely:

  • Extract methods, rename variables, improve structure
  • Apply modern C# patterns (primary constructors, records, collection expressions)
  • Add validation, error handling, and edge cases (with new tests for each)
  • Run the full test suite after each refactor step to catch regressions
bash
dotnet test

If any test goes red during refactoring, undo the last change and try a smaller step.

Multi-Cycle Features

Most features require multiple TDD cycles. Plan the cycles upfront:

Feature: Order Management

Cycle 1: Create order with valid items -> 201
Cycle 2: Create order with empty items -> 400 validation error
Cycle 3: Create order with invalid SKU -> 400 with specific error
Cycle 4: Get order by ID -> 200 with full order details
Cycle 5: Get order that does not exist -> 404

Each cycle adds one behavior. Never combine multiple behaviors in a single cycle.

Test Infrastructure Setup

If the project lacks test infrastructure, set it up before the first cycle:

  1. Create test project with xUnit v3 and required packages
  2. Configure WebApplicationFactory with Testcontainers for the real database
  3. Add a shared fixture to avoid spinning up containers per test class
  4. Verify the infrastructure with a simple health-check test

Example

User: /tdd Let's TDD a product search endpoint

Claude: I'll plan the TDD cycles for product search:

Cycle 1: Search with matching term returns matching products
Cycle 2: Search with no matches returns empty list
Cycle 3: Search with pagination returns correct page
Cycle 4: Search with filters narrows results

Starting Cycle 1: Red phase
Writing a failing integration test for basic product search...

[writes test, runs it, confirms failure]

Cycle 1: Green phase
Implementing the minimum to make the search test pass...

[implements, runs test, confirms pass]

Cycle 1: Refactor phase
The implementation works but the query could use a projection
instead of loading full entities. Refactoring...

[refactors, runs full suite, all green]

Cycle 1 complete. Moving to Cycle 2...

Related

  • /verify -- Run full verification after completing all TDD cycles
  • /scaffold -- Generate initial feature structure that tests will drive

Frequently asked questions

What does the Tdd AI skill do?

Guided test-driven development workflow for .NET 10 using xUnit v3, WebApplicationFactory, Testcontainers, and Verify snapshots. Follows the strict red-green-refactor cycle. Use when: "TDD", "test-driven", "let's TDD this", "red green refactor", "write the test first", or when building a feature with clear acceptance criteria.

Why use Tdd on TypingMind?

Because you install it once and use it with any model. Tdd is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Tdd in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/codewithmukesh/dotnet-claude-kit/tree/main/skills/tdd. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Tdd?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Tdd?

As many as you like. As long as a model supports skills, you can use Tdd with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Tdd AI skill free?

Yes. It is published on GitHub by codewithmukesh under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇