UNPKG

tdd-guard

Version:

Automated Test-Driven Development enforcement for Claude Code

2 lines 1.94 kB
export declare const WRITE = "## Analyzing Write Operations\n\nThis section shows the new file being created. Analyze the content to determine if it follows TDD principles for new file creation.\n\n### Your Task\nYou are reviewing a Write operation where a new file is being created. Determine if this violates TDD principles.\n\n**FIRST**: Check the file path to identify if this is a test file (`.test.`, `.spec.`, or `test/`) or implementation file.\n\n### Write Operation Rules\n\n1. **Creating a test file:**\n - Usually the first step in TDD (Red phase)\n - Should contain only ONE test initially\n - Multiple tests in new test file = Violation\n - Exception: Test utilities or setup files\n\n2. **Creating an implementation file:**\n - Must have evidence of a failing test\n - Check test output for justification\n - Implementation must match test failure type\n - No test output = Likely violation\n\n3. **Special considerations:**\n - Configuration files: Generally allowed\n - Test helpers/utilities: Allowed if supporting TDD\n - Empty stubs: Allowed if addressing test failure\n\n### Common Write Scenarios\n\n**Scenario 1**: Writing first test file\n- Allowed: File with one test\n- Violation: File with multiple tests\n- Reason: TDD requires one test at a time\n\n**Scenario 2**: Writing implementation without test\n- Check for test output\n- No output = \"Premature implementation\"\n- With output = Verify it matches implementation\n\n**Scenario 3**: Writing full implementation\n- Test shows \"not defined\"\n- Writing complete class with methods = Violation\n- Should write minimal stub first\n\n### Key Questions for Write Operations\n\n1. Is this creating a test or implementation file?\n2. If test: Does it contain only one test?\n3. If implementation: Is there a failing test?\n4. Does the implementation match the test failure?\n\n## Changes to Review\n"; //# sourceMappingURL=write.d.ts.map