Skip to content

Commit 10a1bfd

Browse files
cadamsdotcomclaude
andcommitted
docs: Add CSS/layout changes as behavioral in TDD skip-red guidance
CSS class/property changes (overflow, flex, position, layout) alter rendered output and are not refactoring. Document that these require full Red-Green TDD with component tests asserting expected classes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 323c359 commit 10a1bfd

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ uv run python -m scripts.tdd_log --log tdd-abc.log green --skip-red --reason=add
232232

233233
The `--reason=refactoring` flag means "tests continue to pass without modification." If existing tests would FAIL after your change, you need the full Red-Green cycle -- not `--skip-red`. This applies even when the change feels minor (updating constants, changing timeouts, adjusting limits). If a test documents the current behavior and your change alters that behavior, update the test first, watch it fail, then implement the change.
234234

235+
**CSS/layout changes are behavioral changes.** Changing CSS classes or properties (overflow, flex, position, min-height, z-index, etc.) alters how the page renders and is NOT refactoring. Write component tests asserting the expected CSS classes or inline styles are present, watch them fail, then implement the change. Even though jsdom cannot validate visual behavior (sticky, scroll, overflow), asserting the correct classes/properties are rendered catches regressions and enforces the Red-Green cycle.
236+
235237
**Discovering the TDD Log File Name:**
236238

237239
The TDD log file name and full usage examples are provided automatically at session start via the `SessionStart` hook. Look for the message at the top of your session that says `Your TDD log file is: tdd-<id>.log` followed by copy-pasteable Red, Green, and skip-red commands with the correct `--log` value already filled in. Use those examples as templates for all `tdd_log` commands.

scripts/plan_exit_hook.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ def get_nested_claude_review(plan_content: str) -> str:
5555
- Does the plan say "no test needed" or rationalize skipping tests for any changed file?
5656
If so, flag it - if it's worth implementing, it's worth testing.
5757
- If the plan modifies UI rendering (new elements, conditional display, disabled states,
58-
event handlers), does it require component-level tests? Hook tests and backend tests
58+
event handlers, CSS class/property changes like overflow, flex, position, layout),
59+
does it require component-level tests? Hook tests and backend tests
5960
do NOT substitute for component tests that verify rendering and interaction.
61+
CSS/layout changes are behavioral - assert expected classes/properties in component tests.
6062
6163
Provide brief, actionable feedback. Be critical. Keep response under 200 words.
6264
@@ -134,8 +136,10 @@ def main() -> None:
134136
- Are role-based access checks present?
135137
- If the plan adds or updates queries or handles user data, are the updatable fields restricted to only those needed?
136138
11. If the plan modifies UI rendering (new elements, conditional display, disabled states,
137-
event handlers), component tests are required - not optional. Hook tests verify data flow,
139+
event handlers, CSS class/property changes like overflow, flex, position, layout),
140+
component tests are required - not optional. Hook tests verify data flow,
138141
backend tests verify the API, but neither verifies that elements render or wire events correctly.
142+
CSS/layout changes are behavioral - assert expected classes/properties in component tests.
139143
12. Reject any plan section that says "no test needed" - if it's worth implementing, it's worth testing.
140144
13. Add a CLEANUP step at the end of your plan that addresses:
141145
- Remove "absence tests" used during TDD to verify removal of features/routes/UI

0 commit comments

Comments
 (0)