docs(test-driven-development): add guidance for modifying behavior with existing tests#2023
Open
wrcapitalcorp wants to merge 1 commit into
Open
docs(test-driven-development): add guidance for modifying behavior with existing tests#2023wrcapitalcorp wants to merge 1 commit into
wrcapitalcorp wants to merge 1 commit into
Conversation
…th existing tests The red-green-refactor cycle documents writing new behavior from an empty test file and gives little guidance for changing behavior that is already covered by tests. The only note on that case, "Other tests fail? Fix now," can be read as making a failing test pass without first determining whether the code, rather than the test, is at fault. This adds a "Modifying Existing Behavior" section covering three points: inventory the existing tests before changing code; update the existing test to the new contract first, in the same commit; and, for each additional failing test, decide whether it is a genuine regression (fix the code) or an intended behavior change (update the test). The "Other tests fail?" line under Verify GREEN is updated to state this decision inline and link to the new section. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
wrcapitalcorp
force-pushed
the
tdd-modifying-existing-behavior
branch
from
July 23, 2026 12:02
2e16642 to
3896a3e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a "Modifying Existing Behavior" section to the
test-driven-developmentskill and clarifies the existing "Other tests fail?" note under Verify GREEN. Documentation only, one file.Motivation
The red-green-refactor cycle in this skill is written for new behavior, beginning from an empty test file. It offers little guidance for changing behavior that is already covered by tests, which is a common and time-consuming case in practice. The only sentence that addresses it is:
Taken literally, "fix now" can be read as license to make a failing test pass without first determining whether the code, rather than the test, is at fault. That inverts the purpose of the test: a test that fails on an unintended change is doing its job, and editing it to pass removes that signal.
Change
Adds a focused section covering the modification case:
It also notes a brittleness signal: a refactor that changes no observable behavior yet breaks many tests indicates tests coupled to implementation rather than behavior.
The "Other tests fail?" line under Verify GREEN is updated to state this decision inline and link to the new section.
Notes
The change is intentionally scoped to a single section so it continues the existing red-green narrative rather than introducing a separate skill. If the maintainers would prefer a standalone companion skill to match the library's composition style, I would be glad to restructure it accordingly.