Skip to content

feat(skills): add forge-tdd test-driven development skill #18

Description

@mgratzer

Summary

Add a TDD skill to the forge pipeline — currently the biggest functional gap compared to peer skill collections.

Problem / Motivation

Forge has no skill for test-driven development workflows. When implementing features, forge-implement-issue says "test as you go" but doesn't enforce TDD discipline (red-green-refactor cycles, behavior-driven test design, or strategic mocking).

Inspired by mattpocock/skills TDD skill, which includes deep reference materials on testing philosophy and practical patterns.

Proposed Solution

Create forge-tdd with these core concepts:

Red-Green-Refactor with Vertical Slices

  • One test at a time, then minimal code to pass — never write all tests first (horizontal slicing anti-pattern)
  • Each RED-GREEN cycle is a thin vertical slice
  • Only refactor when all tests are GREEN

Behavior-Based Testing

  • Tests describe observable behavior through public interfaces, not implementation details
  • A good test reads like a specification: "user can checkout with valid cart"
  • Tests should survive internal refactors without changes

Mock at System Boundaries Only

  • Mock: external APIs, databases, time/randomness, file system
  • Don't mock: your own classes, internal collaborators
  • Prefer SDK-style interfaces (specific functions per operation) over generic fetchers

Deep Modules (John Ousterhout)

  • Small interface + deep implementation = good module design
  • Design interfaces for testability: accept dependencies, return results
  • Fewer methods = fewer tests = better design signal

Reference Files

Consider 5 supporting reference files:

  • references/tests.md — what makes a good test, behavior vs implementation
  • references/deep-modules.md — module depth concept and evaluation
  • references/interface-design.md — designing for testability
  • references/mocking.md — when and how to mock
  • references/refactoring.md — candidates and patterns for the refactor phase

Pipeline Fit

Sits after forge-create-issue as an alternative to forge-implement-issue for test-first workflows. Could also be invoked as a companion alongside implement-issue.

Acceptance Criteria

  • SKILL.md follows forge skill structure (frontmatter, Input, Process, Output Format, Guidelines, Related Skills, Example Usage)
  • Red-green-refactor cycle is enforced step-by-step, not just recommended
  • Reference files cover mocking strategy and refactoring patterns
  • Cross-skill consistency table updated in coding-guidelines.md
  • Pipeline linkage: create-issue → tdd and/or implement-issue → tdd

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions