Skip to content

Commit db6848f

Browse files
author
Harald Kirschner
committed
Update TDD agents and documentation
1 parent ab7398e commit db6848f

5 files changed

Lines changed: 19 additions & 26 deletions

File tree

.copilotignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
workshop
1+
# workshop

.github/agents/tdd-green.agent.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ description: TDD phase for writing MINIMAL implementation to pass tests
44
tools: ['search', 'read', 'edit', 'execute/runTests']
55
disable-model-invocation: true
66
user-invocable: false
7-
hooks:
8-
Stop:
9-
- type: command
10-
command: ".github/hooks/tdd-green-stop.sh"
11-
windows: "powershell -File .github/hooks/tdd-green-stop.ps1"
127
---
138

149
You are TDD Green, the code-implementer. Given a failing test case and context (existing codebase or module), write the minimal code change needed so that the test passes — no extra features.

.github/agents/tdd-red.agent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
name: TDD Red
33
description: TDD phase for writing FAILING tests
4-
tools: ['read', 'edit', 'search']
4+
tools: ['read', 'edit', 'search', 'execute/runTests']
55
disable-model-invocation: true
66
user-invocable: false
77
---
88
You are TDD Red, the test-writer: for a given task, generate complete tests that asserts the expected behavior, which must fail when run against the current codebase. Use the project’s style/conventions.
99

10-
ONLY write tests, no implementation.
10+
ONLY write tests, no implementation. You DO NOT RUN tests or verify they fail.

src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface BingoSquareData {
88
}
99

1010
export interface BingoLine {
11-
type: 'row' | 'column' | 'diagonal';
11+
type: 'row' | 'column' | 'diagonal' | 'corners';
1212
index: number;
1313
squares: number[];
1414
}

workshop/04-multi-agent.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,32 @@
44

55
---
66

7-
## Task 1: Agent Hooks — Test Gate for TDD Green
7+
## Task 1: Agent Hooks — Test Gate
88

9-
[Agent hooks](https://code.visualstudio.com/docs/copilot/customization/hooks) execute shell commands at key lifecycle points during agent sessions. We'll add a **Stop hook** to TDD Green so it can't stop until all tests pass.
9+
[Agent hooks](https://code.visualstudio.com/docs/copilot/customization/hooks) execute shell commands at key lifecycle points during agent sessions. We'll add a workspace-scoped **Stop hook** that gates *every* agent — no agent can finish until all tests pass.
1010

1111
**Steps:**
1212

13-
1. Open `.github/agents/tdd-green.agent.md`
14-
2. Prompt `Add a agent-scoped stop hook to tdd-green that checks if tests all passed`
15-
3. In `.github/agents/tdd-green.agent.md` the hook should be defined in the YAML frontmatter.
13+
1. Open the `.github/hooks/` folder
14+
2. Prompt: *Add an agent hook that runs the tests and blocks the agent from finishing if any test fails*
15+
3. The hook should be a JSON file in `.github/hooks/` (e.g. `stop-test-gate.json`), not inside any single agent file.
1616

17-
**Result:** TDD Green now has a safety net — it will keep working until all tests pass before handing back control.
17+
**Result:** Every agent now has a safety net — it will keep working until all tests pass before handing back control.
1818

1919
---
2020

2121
## Task 2: New Bingo Pattern (TDD-Driven)
2222

23-
Use the TDD to add a "Four Corners" bingo pattern. The hooks you set up will enforce TDD discipline on both sides — Red must produce failing tests, Green must make them pass.
23+
Use the TDD agent to add a "Four Corners" bingo pattern. The workspace stop hook you set up will enforce test discipline — every agent must leave tests passing before it hands back control.
2424

2525
**Steps:**
2626

27-
1. First, add a stop hook to TDD Red — open `.github/agents/tdd-red.agent.md` and prompt:
28-
*Add a stop hook that runs the tests and verifies at least one test is failing — TDD Red isn't done until it has written a genuinely failing test*
29-
2. New chat with agent: `TDD`
30-
3. *Add a "Four Corners" bingo win pattern — all four corner squares (top-left, top-right, bottom-left, bottom-right) must be marked*
31-
4. Watch TDD orchestrate:
32-
- **TDD Red** writes failing tests for Four Corners detection — hook fires on stop, keeps it going if tests aren't actually failing
27+
1. New chat with agent: `TDD`
28+
2. *Add a "Four Corners" bingo win pattern — all four corner squares (top-left, top-right, bottom-left, bottom-right) must be marked*
29+
3. Watch TDD orchestrate:
30+
- **TDD Red** writes failing tests for Four Corners detection
3331
- Review the new tests in VS Code's test runner
34-
- **TDD Green** implements the minimal code to pass — hook fires on stop, keeps it going if tests fail
32+
- **TDD Green** implements the minimal code to pass — stop hook fires, keeps it going if tests fail
3533
- **TDD Refactor** cleans up the implementation
3634
- Click on any sub-agent while it runs to see its context and instructions
3735
4. Review the summary of changes
@@ -48,11 +46,11 @@ Inspect what happened under the hood — did the hook fire? How did agents commu
4846

4947
1. Verify the hook loads: open the **GitHub Copilot Chat Hooks** output channel (Output panel → channel dropdown)
5048
2. Open Agent Debug Logs: gear icon (⚙️) in Chat view → **Show Agent Debug Logs**
51-
3. **Logs view:** filter for hook execution events during TDD Green
49+
3. **Logs view:** filter for hook execution events during the TDD cycle
5250
4. **Agent Flow Chart:** visualize the TDD → Red → Green → Refactor orchestration
5351
5. **Summary view:** review total tool calls and token usage
5452

55-
**Bonus:** Click the ✨ sparkle icon to attach debug events to a new chat, then ask: `/troubleshoot did the Stop hook fire during TDD Green?`
53+
**Bonus:** Click the ✨ sparkle icon to attach debug events to a new chat, then ask: `/troubleshoot did the Stop hook fire during the TDD cycle?`
5654

5755
**Result:** Full observability into multi-agent orchestration and hook execution.
5856

@@ -104,7 +102,7 @@ Combine MCP, custom workflows, and subagent isolation in an agent for powerful w
104102
## ✅ Part 4 Complete!
105103

106104
You've learned how to:
107-
- Add agent hooks to enforce quality gates (Stop hook on TDD Green)
105+
- Add workspace-scoped agent hooks to enforce quality gates (Stop hook on all agents)
108106
- Use TDD to orchestrate Red → Green → Refactor automatically
109107
- Inspect agent behavior with Agent Debug Logs and Flow Charts
110108
- Use design-first agents for UI-driven development

0 commit comments

Comments
 (0)