~/ai_assets_directory_
Copilot Agent verified · tested by us 38.7k stars · whole github/awesome-copilot repo
tdd-red.agent.md

TDD Red Phase Agent

First stage of a three-agent TDD workflow: writes one focused failing test at a time from GitHub issue requirements, and verifies it fails for the right reason before any implementation exists.

Overview

This is the first of a three-agent TDD workflow (Red, then Green, then Refactor). Its only job is to write a failing test, one at a time, before any production code exists.

How it works

  1. It extracts the issue number from the branch name, fetches the linked GitHub issue and reads its requirements, comments and linked PRs for edge cases.
  2. It writes the simplest failing test for a single behavior, never several tests in one pass, and confirms the plan with you before writing anything.
  3. It runs the test to confirm it fails because the implementation is missing, not because of a syntax error.
  4. It uses Jest/Vitest for JS/TS, pytest for Python, JUnit 5 with AssertJ for Java/Kotlin, or xUnit/NUnit for .NET, with the Arrange-Act-Assert structure throughout.
  5. It names the test after the behavior and issue number, so it's clear which requirement it covers.

Examples

"Write the first failing test for issue #142: reject signups with
an invalid email format."

Installation

You need VS Code with the GitHub Copilot extension. Consider installing TDD Green and TDD Refactor alongside it, they're meant to be used together.

  1. Create the agents folder and download the file into your repo:
    mkdir -p .github/agents
    curl -o .github/agents/tdd-red.agent.md \
      https://raw.githubusercontent.com/github/awesome-copilot/main/agents/tdd-red.agent.md
    
  2. Reload VS Code, or open a new Copilot Chat; custom agents under .github/agents/ are picked up automatically.
  3. Pick this agent from the mode picker in Copilot Chat, point it at a GitHub issue, and confirm it writes exactly one failing test.

Related assets