Skip to content

Fix plan generation skipping TDD for config/tooling tasks#855

Open
chuanghiduoc wants to merge 2 commits intoobra:mainfrom
chuanghiduoc:fix/853-tdd-enforcement-in-plans
Open

Fix plan generation skipping TDD for config/tooling tasks#855
chuanghiduoc wants to merge 2 commits intoobra:mainfrom
chuanghiduoc:fix/853-tdd-enforcement-in-plans

Conversation

@chuanghiduoc
Copy link
Copy Markdown

@chuanghiduoc chuanghiduoc commented Mar 20, 2026

Summary

Fixes #853 — Plans generated by writing-plans did not enforce TDD structure, especially when early tasks involved configuration or tooling. The plan reviewer also lacked TDD criteria, allowing non-TDD plans to pass review.

Root cause

Two gaps in the planning pipeline:

  1. writing-plans/SKILL.md mentioned TDD only in passing ("DRY. YAGNI. TDD.") without enforcement. No <HARD-GATE>, no anti-rationalization guidance. When early tasks were config/tooling, the planner skipped TDD for those — and the habit carried to subsequent tasks.

  2. plan-document-reviewer-prompt.md checked Completeness, Spec Alignment, Task Decomposition, and Buildability — but had no TDD criteria. Non-TDD plans were approved without question.

Changes

skills/writing-plans/SKILL.md:

  • Added <HARD-GATE> requiring RED-GREEN-REFACTOR for every code-producing task
  • Added concrete guidance for tasks that feel "untestable": config (smoke test), build pipeline (output check), scaffolding (startup check)
  • Added anti-pattern section: "Tests at the end" — plans that defer all tests to a final task are explicitly flagged as NOT TDD

skills/writing-plans/plan-document-reviewer-prompt.md:

  • Added "TDD Structure" category to the reviewer checklist
  • Reviewer now checks: test before implementation in every task, no deferred test tasks

Test plan

  • Brainstorm a project with config/tooling first steps → verify plan uses RED-GREEN per task
  • Verify plan reviewer flags plans with implementation-before-test ordering
  • Verify plan reviewer flags plans with a single "Add tests" task at the end

writing-plans mentioned TDD only in passing ("DRY. YAGNI. TDD.") without
enforcement. When early tasks involved configuration or tooling, the
planner rationalized skipping TDD and the reviewer had no criteria to
catch it.

Changes:
- Add HARD-GATE requiring RED-GREEN-REFACTOR for every code-producing task
- Add guidance for "untestable" tasks (config, build pipeline, scaffolding)
- Add anti-pattern section for "tests at the end" plans
- Add TDD Structure category to plan reviewer checklist
Copilot AI review requested due to automatic review settings March 20, 2026 17:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the “writing-plans” skill and its plan reviewer prompt to explicitly enforce TDD (RED/GREEN/REFACTOR) per task, especially preventing plans from deferring tests to the end when early tasks are configuration/tooling.

Changes:

  • Added a <HARD-GATE> section to skills/writing-plans/SKILL.md requiring TDD structure for code-producing tasks, including guidance for “untestable” seeming tasks.
  • Added an explicit anti-pattern warning against “tests at the end” plans.
  • Updated skills/writing-plans/plan-document-reviewer-prompt.md to include “TDD Structure” in the reviewer checklist.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
skills/writing-plans/SKILL.md Introduces mandatory TDD gating and guidance to prevent plans skipping tests during config/tooling tasks.
skills/writing-plans/plan-document-reviewer-prompt.md Adds reviewer criteria to catch non-TDD task ordering and deferred-test plans.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- HARD-GATE: add explicit refactor step to match RED-GREEN-REFACTOR name
- Narrow scope from "produces or modifies code" to "introduces or changes
  behavior" — refactor-only tasks rely on existing tests instead
- Reviewer prompt: align with SKILL.md wording (RED-GREEN-REFACTOR + commit)
@chuanghiduoc
Copy link
Copy Markdown
Author

Thanks for the review! All 3 comments addressed in c44a6d6:

  1. HARD-GATE now includes explicit refactor step: write failing test → verify it fails → write minimal implementation → verify it passes → refactor → commit

  2. Narrowed scope: Changed from "produces or modifies code" to "introduces or changes behavior". Refactor-only tasks now explicitly rely on existing test suite rather than requiring a new failing test.

  3. Reviewer prompt aligned: Now matches SKILL.md wording — RED-GREEN-REFACTOR with commit, and notes refactor-only tasks may use existing tests.

@obra obra added bug Something isn't working claude-code Claude Code (Anthropic CLI) issues plans Planning workflow (writing-plans, executing-plans) tdd Test-driven development workflow pr-template-rules-ignored PR filed after template was added but didn't use it labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working claude-code Claude Code (Anthropic CLI) issues plans Planning workflow (writing-plans, executing-plans) pr-template-rules-ignored PR filed after template was added but didn't use it tdd Test-driven development workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan did not use TDD requirements

3 participants