{"slug":"tdd-workflow","title":"tdd-workflow","summary":"Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.","platform":"ChatGPT","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-16T13:39:01.531912Z","repo":{"url":"https://github.com/sickn33/agentic-awesome-skills","stars":46883,"forks":6831,"license":"MIT","updatedAt":"2026-09-25T05:43:16Z"},"bodyHtml":"<hr>\n<h2>name: tdd-workflow\ndescription: \"Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.\"\nrisk: critical\nsource: community\ndate_added: \"2026-02-27\"</h2>\n<h1>TDD Workflow</h1>\n<blockquote>\n<p>Write tests first, code second.</p>\n</blockquote>\n<hr>\n<h2>1. The TDD Cycle</h2>\n<pre><code>\uD83D\uDD34 RED → Write failing test\n    ↓\n\uD83D\uDFE2 GREEN → Write minimal code to pass\n    ↓\n\uD83D\uDD35 REFACTOR → Improve code quality\n    ↓\n   Repeat...\n</code></pre>\n<hr>\n<h2>2. The Three Laws of TDD</h2>\n<ol>\n<li>Write production code only to make a failing test pass</li>\n<li>Write only enough test to demonstrate failure</li>\n<li>Write only enough code to make the test pass</li>\n</ol>\n<hr>\n<h2>3. RED Phase Principles</h2>\n<h3>What to Write</h3>\n<table>\n<thead>\n<tr>\n<th>Focus</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Behavior</td>\n<td>\"should add two numbers\"</td>\n</tr>\n<tr>\n<td>Edge cases</td>\n<td>\"should handle empty input\"</td>\n</tr>\n<tr>\n<td>Error states</td>\n<td>\"should throw for invalid data\"</td>\n</tr>\n</tbody>\n</table>\n<h3>RED Phase Rules</h3>\n<ul>\n<li>Test must fail first</li>\n<li>Test name describes expected behavior</li>\n<li>One assertion per test (ideally)</li>\n</ul>\n<hr>\n<h2>4. GREEN Phase Principles</h2>\n<h3>Minimum Code</h3>\n<table>\n<thead>\n<tr>\n<th>Principle</th>\n<th>Meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>YAGNI</strong></td>\n<td>You Aren't Gonna Need It</td>\n</tr>\n<tr>\n<td><strong>Simplest thing</strong></td>\n<td>Write the minimum to pass</td>\n</tr>\n<tr>\n<td><strong>No optimization</strong></td>\n<td>Just make it work</td>\n</tr>\n</tbody>\n</table>\n<h3>GREEN Phase Rules</h3>\n<ul>\n<li>Don't write unneeded code</li>\n<li>Don't optimize yet</li>\n<li>Pass the test, nothing more</li>\n</ul>\n<hr>\n<h2>5. REFACTOR Phase Principles</h2>\n<h3>What to Improve</h3>\n<table>\n<thead>\n<tr>\n<th>Area</th>\n<th>Action</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Duplication</td>\n<td>Extract common code</td>\n</tr>\n<tr>\n<td>Naming</td>\n<td>Make intent clear</td>\n</tr>\n<tr>\n<td>Structure</td>\n<td>Improve organization</td>\n</tr>\n<tr>\n<td>Complexity</td>\n<td>Simplify logic</td>\n</tr>\n</tbody>\n</table>\n<h3>REFACTOR Rules</h3>\n<ul>\n<li>All tests must stay green</li>\n<li>Small incremental changes</li>\n<li>Commit after each refactor</li>\n</ul>\n<hr>\n<h2>6. AAA Pattern</h2>\n<p>Every test follows:</p>\n<table>\n<thead>\n<tr>\n<th>Step</th>\n<th>Purpose</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>Arrange</strong></td>\n<td>Set up test data</td>\n</tr>\n<tr>\n<td><strong>Act</strong></td>\n<td>Execute code under test</td>\n</tr>\n<tr>\n<td><strong>Assert</strong></td>\n<td>Verify expected outcome</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<h2>7. When to Use TDD</h2>\n<table>\n<thead>\n<tr>\n<th>Scenario</th>\n<th>TDD Value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>New feature</td>\n<td>High</td>\n</tr>\n<tr>\n<td>Bug fix</td>\n<td>High (write test first)</td>\n</tr>\n<tr>\n<td>Complex logic</td>\n<td>High</td>\n</tr>\n<tr>\n<td>Exploratory</td>\n<td>Low (spike, then TDD)</td>\n</tr>\n<tr>\n<td>UI layout</td>\n<td>Low</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<h2>8. Test Prioritization</h2>\n<table>\n<thead>\n<tr>\n<th>Priority</th>\n<th>Test Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>Happy path</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Error cases</td>\n</tr>\n<tr>\n<td>3</td>\n<td>Edge cases</td>\n</tr>\n<tr>\n<td>4</td>\n<td>Performance</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<h2>9. Anti-Patterns</h2>\n<table>\n<thead>\n<tr>\n<th>❌ Don't</th>\n<th>✅ Do</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Skip the RED phase</td>\n<td>Watch test fail first</td>\n</tr>\n<tr>\n<td>Write tests after</td>\n<td>Write tests before</td>\n</tr>\n<tr>\n<td>Over-engineer initial</td>\n<td>Keep it simple</td>\n</tr>\n<tr>\n<td>Multiple asserts</td>\n<td>One behavior per test</td>\n</tr>\n<tr>\n<td>Test implementation</td>\n<td>Test behavior</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<h2>10. AI-Augmented TDD</h2>\n<h3>Multi-Agent Pattern</h3>\n<table>\n<thead>\n<tr>\n<th>Agent</th>\n<th>Role</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Agent A</td>\n<td>Write failing tests (RED)</td>\n</tr>\n<tr>\n<td>Agent B</td>\n<td>Implement to pass (GREEN)</td>\n</tr>\n<tr>\n<td>Agent C</td>\n<td>Optimize (REFACTOR)</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<blockquote>\n<p><strong>Remember:</strong> The test is the specification. If you can't write a test, you don't understand the requirement.</p>\n</blockquote>\n<h2>When to Use</h2>\n<p>This skill is applicable to execute the workflow or actions described in the overview.</p>\n<h2>Limitations</h2>\n<ul>\n<li>Use this skill only when the task clearly matches the scope described above.</li>\n<li>Do not treat the output as a substitute for environment-specific validation, testing, or expert review.</li>\n<li>Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":3244,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-08-16T13:46:31.609128Z","sha256":"905230B8F82DE26FB890E11820412B25FC7A919A72B9C7FC0BEF13AD6DE61B83","sizeBytes":1669},"review":null,"source":{"repositoryUrl":"https://github.com/sickn33/agentic-awesome-skills","path":"skills/tdd-workflow","license":"MIT","commit":"f2bba339de74414b0771234cbe4f6a15258e32a3","subtreeSha":"F405F122E1153920D34B987809D8983C29C0F5BAFD25368A07A8F67DF0E3805B","lastSyncedAt":"2026-09-25T06:48:39.853703Z"},"reviewedAt":"2026-08-16T13:57:22.507217Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/sickn33/agentic-awesome-skills/tree/main/skills/tdd-workflow"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install sickn33-agentic-awesome-skills@llmmart"},{"target":"git","command":"git clone https://github.com/sickn33/agentic-awesome-skills.git"}]}