Skip to content
Agentmart
Submit a tool

tdd-workflow

Detailed TDD workflow with examples, rationales, and anti-patterns.

Skill by pedromsmoreira

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/pedromsmoreira-tdd-workflow

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Detailed TDD workflow with examples, rationales, and anti-patterns. Use when following Red-Green-Refactor cycle.

Use cases: testing, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/tdd-workflow

Tools it pre-approves 6

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read,
  • Write,
  • Edit,
  • Glob,
  • Grep,
  • Bash

What's inside

Skill name
tdd-workflow
Description
Detailed TDD workflow with examples, rationales, and anti-patterns. Use when following Red-Green-Refactor cycle.
License
MIT
Allowed tools
Read,, Write,, Edit,, Glob,, Grep,, Bash
Instructions
323 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves any shell command

Files (1)

  • SKILL.md

SKILL.md (first lines)

# TDD Workflow

Detailed workflow for Test-Driven Development. For core principles, see `../../rules/test-driven-development.mdc`.

---

## The Cycle

```
RED (failing test) → GREEN (minimal code) → REFACTOR (clean up) → Repeat
```

---

## RED Phase - Write Failing Test

Write one minimal test showing what should happen.

### Good Example

```go
func TestRetryOperation_WithFailingOperation_RetriesThreeTimes(t *testing.T) {
    t.Run("retries until success", func(t *testing.T) {
        attempts := 0
        operation := func() (string, error) {
            attempts++
            if attempts < 3 {
                return "", errors.New("fail")
            }
            return "success", nil
        }

        result, err := RetryOperation(operation)

        assert.NoError(t, err)
        assert.Equal(t, "success", result)
        assert.Equal(t, 3, attempts)
    })
}
```
Clear name, tests real behavior, one thing.

### Bad Example

```go
func TestRetry(t *testing.T) {
    t.Run("works", func(t *testing.T) {
        mockFn := new(mocks.MockOperation)
        mockFn.On("Execute").Return("", errors.New("fail")).Twice()
        mockFn.On("Execute").Return("success", nil).Once()

        RetryOperation(mockFn.Execute)

        mockFn.AssertNumberOfCalls(t, "Execute", 3)
    })
}
```
Vague name, tests mock not code.

**Do not use string-based expectations like `On("MethodName", ...)`.** For Go, use gomock with generated mocks and `EXPECT().MethodName(...)` so refactoring method names causes compile errors. See go-testing-practices.mdc.

### RED Phase Requirements

- One behavior per test
- Clear, descriptive name
- Real code (no mocks unless unavoidable)

---

## Verify RED - Watch It Fail

**MANDATORY. Never skip.**

```bash
go test -v ./path/to/package -run TestRetryOperation
```

Confirm:
- Test fails (not errors)
- Failure message is expected
- Fails because feature missing (not typos)

**Test passes?** You're testing existing behavior. Fix test.

**Test errors?** Fix error, re-run until it fails correctly.

---

## GREEN Phase - Minimal Code

Write simplest code to pass the test.

### Good Example

```go
func RetryOperation(fn func() (string, error)) (string, error) {
    for i := 0; i < 3; i++ {
        result, err := fn()
        if err == nil {
            return result, nil
        }
        if i == 2 {
            return "", err
        }
    }
    return "", errors.New("unreachable")
}
```
Just enough to pass.

### Bad Example

```go
func RetryOperation(
    fn func() (string, error),
    opts ...RetryOption,
) (string, error) {
    config := &RetryConfig{
        MaxRetries: 3,

From pedromsmoreira/ai-configs, MIT.

More from pedromsmoreira/ai-configs

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
May 9, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from pedromsmoreira

Cite this page

tdd-workflow skill. Agent Mart. https://agentmart.dev/skills/pedromsmoreira-tdd-workflow (last updated 2026-10-24)