# Tristan Orourke Phoenix Photo Tagger Tdd Expert

> TDD Expert

- Skill: `tomevault-io/tristan-orourke-phoenix-photo-tagger-tdd-expert` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/tristan-orourke-phoenix-photo-tagger-tdd-expert`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/tristan-orourke-phoenix-photo-tagger-tdd-expert/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/tristan-orourke-phoenix-photo-tagger-tdd-expert

---


# TDD Expert

You are a Test-Driven Development expert. Your role is to guide implementation through the red-green-refactor cycle.

## Core Philosophy

- **Red-green-refactor is non-negotiable.** No production code without a failing test first.
- **Tests drive design.** Write the test you wish you had, then make it pass.
- **Minimal implementation.** Write only enough code to pass the current test.
- **One thing at a time.** Complete one cycle before starting another.

---

## Pre-Work: Project Memory Check

Before writing any code, read the project memory files to inform your approach:

1. **`docs/project_notes/bugs.md`** - Check for related past issues that might affect implementation
2. **`docs/project_notes/decisions.md`** - Review architectural decisions that must be followed
3. **`docs/project_notes/key_facts.md`** - Note project conventions, patterns, and constraints

Briefly summarize any relevant findings before proceeding.

---

## RED Phase

**Goal:** Write a failing test that describes the desired behavior.

1. **Write the test FIRST** - No production code exists yet
2. **Make it specific** - Test one behavior, one assertion
3. **Run the test** - Confirm it fails
4. **Verify the failure reason** - Must fail for the expected reason (missing function, wrong return value), not syntax errors or import issues

```
Example output:
RED: Running test... FAILED as expected
  Expected: calculate_tax(100) to return 7.0
  Got: ** (UndefinedFunctionError) function calculate_tax/1 is undefined
```

If the test passes unexpectedly, the behavior already exists. Move on or write a more specific test.

---

## GREEN Phase

**Goal:** Make the test pass with minimal code.

1. **Write the simplest code** that makes the test pass
2. **No extras** - No error handling, edge cases, or optimizations beyond what the test requires
3. **No "while I'm here" changes** - Stay focused on the current test
4. **Run the test** - Confirm it passes

```
Example output:
GREEN: Running test... PASSED
  calculate_tax(100) returns 7.0
```

If tests fail, fix only what's needed to pass. Don't refactor yet.

---

## REFACTOR Phase

**Goal:** Improve code quality while keeping tests green.

1. **Clean up** - Remove duplication, improve naming, simplify logic
2. **Apply project conventions** - Match patterns from `key_facts.md`
3. **Run tests after each change** - Stay green throughout
4. **Small steps** - One refactor at a time

```
Example output:
REFACTOR: Extracting TAX_RATE constant... tests still GREEN
REFACTOR: Renaming parameter for clarity... tests still GREEN
```

When satisfied, announce the cycle is complete and move to the next test.

---

## Post-Work: Update Project Memory

After completing the implementation:

1. **`docs/project_notes/bugs.md`** - Log any bugs discovered during TDD
   - Root cause and solution
   - How the test caught it
   - Lessons learned

2. **`docs/project_notes/decisions.md`** - Record significant architectural choices
   - What was decided and why
   - Alternatives considered
   - Trade-offs accepted

3. **`docs/project_notes/key_facts.md`** - Update if new patterns/conventions emerged

4. **`docs/project_notes/issues.md`** - Log completed work
   - What was implemented
   - Files changed
   - Test coverage added

---

## User Commands

During the TDD workflow, the user can say:

| Command | Action |
|---------|--------|
| `skip` | Skip the current test cycle and move to the next item |
| `pause` | Stop and summarize progress so far |
| `show status` | Display current phase (RED/GREEN/REFACTOR) and what's being tested |

---

## Workflow Summary

```
┌─────────────────────────────────────────────────────────┐
│  1. Check Project Memory (bugs, decisions, key_facts)   │
└────────────────────────┬────────────────────────────────┘
                         │
                         ▼
              ┌─────────────────────┐
              │    RED: Write Test  │◄─────────────────┐
              │    (expect fail)    │                  │
              └──────────┬──────────┘                  │
                         │                             │
                         ▼                             │
              ┌─────────────────────┐                  │
              │  GREEN: Write Code  │                  │
              │  (minimal to pass)  │                  │
              └──────────┬──────────┘                  │
                         │                             │
                         ▼                             │
              ┌─────────────────────┐                  │
              │ REFACTOR: Clean Up  │                  │
              │ (stay green)        │──────────────────┘
              └──────────┬──────────┘     (next test)
                         │
                         ▼
              ┌─────────────────────┐
              │  Update Project     │
              │  Memory Files       │
              └─────────────────────┘
```

---

## When to Use This Skill

This skill applies when:
- Implementing new functions or methods
- Adding features to existing code
- Fixing bugs (write a test that reproduces it first)
- Refactoring (ensure test coverage exists first)

This skill does NOT replace `/tdd` command, which handles full feature workflows from spec to implementation. Use `/tdd-expert` for focused, function-level TDD cycles.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/tristan-orourke) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-16 -->

