Repository navigation
Add TDD enforcement to DEVELOP prompt #68
Description
Context
definitions.py:185 says "Write tests for every new or changed behavior" but doesn't enforce test-first methodology. The agent is free to write implementation first and backfill tests (or skip them).
Proposal
Replace the single "Write tests for every new or changed behavior" line in the DEVELOP prompt (askcc/definitions.py) with red/green TDD guidance, per the refined suggestion in the comment below.
Acceptance Criteria
-
askcc/definitions.pyDEVELOP prompt replaces the existingWrite tests for every new or changed behaviorbullet with aTesting methodology — red/green TDD (non-negotiable):block covering RED (write failing test, confirm failure), GREEN (minimum code to pass), and REFACTOR (only on clear duplication/naming), plus rules requiring behavioral assertions and committing tests with implementation. - Prompt includes an explicit phase gate: do NOT proceed from RED to GREEN without a confirmed failing test run.
- The DEVELOP prompt's anti-rationalization list gains one new entry rejecting "I'll write the test after, it's faster" (tests-after verify code, not requirement).
- Existing
Write tests for every new or changed behaviorline is removed (no duplication of testing guidance in the DEVELOP prompt). - Tests covering the DEVELOP prompt content assert that the new TDD block and anti-rationalization entry are present (red/green TDD discipline applied to this change itself).
-
uv run pytest,uv run ruff check, anduv run pyrightall pass. - No changes to other prompts (PLAN, PREPARE, VALIDATE, etc.) in this PR.
Dependencies
None.
Rationale
Research shows TDD enforcement significantly improves code quality in agent-driven development. See the updated suggestion comment for findings from Simon Willison's agentic patterns, alexop.dev's forced-TDD workflow, Superpowers, and agent-skills. Test-first catches requirement misunderstandings before implementation begins, rather than discovering them after the code is written.
Activity
monkut commentedon Apr 13, 2026
Updated suggestion (TDD best-practices review)
Reviewed current guidance from Simon Willison's agentic patterns, alexop.dev's forced-TDD workflow, the Superpowers/agent-skills skills, and recent Medium coverage (Shubham Sharma, Rupeshit Patekar). Key findings that sharpened the original proposal:
Proposed replacement for `definitions.py:184`
```
Testing methodology — red/green TDD (non-negotiable):
for the right reason. Paste the failing output into your working notes.
abstractions, no "while I'm here" changes.
implementation's own logic to compute the expected value.
```
Add to the anti-rationalization list
```
code, not the requirement. Always RED before GREEN.
```
Sources
✨ Enforce red/green TDD in DEVELOP prompt
monkut commentedon Apr 13, 2026
Implemented in #76.
Changes
askcc/definitions.py: Replaced theWrite tests for every new or changed behaviorbullet inDEVELOP_AGENT_PROMPTwith aTesting methodology — red/green TDD (non-negotiable):block covering RED (failing test + confirmed failure output), GREEN (minimum code), REFACTOR (only on duplication/naming), behavioral-assertion rule, the explicit phase gateDo NOT proceed from RED to GREEN without a confirmed failing run., and aCommit tests and implementation together.rule.askcc/definitions.py: Added the"I'll write the test after, it's faster"anti-rationalization entry.tests/test_askcc.py: AddedTestDevelopPromptTddContent(9 assertions) covering each new requirement plus removal of the legacy line.TDD applied to this change
TestDevelopPromptTddContenttests first.uv run pytest tests/test_askcc.py::TestDevelopPromptTddContent— confirmed RED (first failing test on the missing TDD block).DEVELOP_AGENT_PROMPTminimally to satisfy the assertions — confirmed GREEN.Verification
uv run pytest— 123 passeduv run ruff check— All checks passeduv run pyright— 0 errorsNo other prompts were touched.
:tokens-used: model: N/A, input: 36, output: 7350
Merge pull request #76 from monkut/feature/68-tdd-enforcement-develop…