spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

[Feature]: Add Test-Driven Development (TDD) Support to the Framework

Open atpaawej opened this issue 6 months ago • 4 comments

Problem Statement

The framework currently lacks built-in support for Test-Driven Development (TDD). Developers who want to follow TDD practices are frustrated by the absence of structured test scaffolding, spec-first workflows, and testing utilities natively integrated into the framework lifecycle.

Proposed Solution

Integrate TDD support natively into spec-kit by providing:

  • A spec-first scaffolding command (e.g. spec-kit tdd init) that generates failing test stubs before implementation
  • A built-in test runner hook that enforces the Red-Green-Refactor cycle
  • Auto-generation of test skeletons from spec definitions
  • Watch mode support for continuous TDD feedback loops
  • Clear documentation and examples for TDD workflows within the framework

Alternatives Considered

Using third-party TDD libraries (e.g. Jest, RSpec) independently — but these lack integration with spec-kit's spec lifecycle and require additional configuration overhead.

Component

Specify CLI (initialization, commands)

AI Agent (if applicable)

None

Use Cases

  1. When a developer wants to write a failing test before implementing a feature spec
  2. During spec review to validate each spec has a corresponding failing test
  3. When integrating with CI/CD pipelines that enforce TDD coverage gates

Acceptance Criteria

  • [ ] spec-kit tdd init command is available and generates failing test stubs from specs
  • [ ] Red-Green-Refactor cycle is enforced by the framework's test runner
  • [ ] Watch mode runs tests automatically on file save
  • [ ] TDD workflow is documented with examples in the official docs
  • [ ] Existing specs remain unaffected (backwards compatible)

Additional Context

No response

atpaawej avatar May 19 '26 12:05 atpaawej

Please see https://github.com/github/spec-kit/blob/main/templates/tasks-template.md for how it approaches testing.

"Tests: The examples below include test tasks. Tests are OPTIONAL - only include them if explicitly requested in the feature specification."

So asking for tests is already supported you just have to request it

Is that sufficient?

mnriem avatar May 21 '26 02:05 mnriem

You can also use the superpowers (Claude Code Anthropic marketplace) and include the superpowers bridge. That works GREAT!! for me!

Pewejekubam avatar May 23 '26 15:05 Pewejekubam

https://github.com/d0whc3r/spec-kit-tdd

d0whc3r avatar Aug 04 '26 09:08 d0whc3r

Closing as there are multiple identified ways that you can use

mnriem avatar Aug 04 '26 12:08 mnriem