{"id":"b5f69737-ab47-4db4-a4b2-4cf6bbce1005","shortId":"zXyDLE","kind":"skill","title":"tdd","tagline":"Guides test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions \"red-green-refactor\", wants test-first development, or requests TDD workflow. Don't use for writing tests after implementation, adding tests to exist","description":"# Test-Driven Development\n\nTests verify behavior through public interfaces, not implementation details. See [principles.md](references/principles.md) for testing philosophy and mocking guidelines.\n\n**DO NOT write all tests first, then all implementation.** Each cycle: one test → minimal code to pass → next test. See [examples.md](references/examples.md) for demonstrations.\n\n## Workflow\n\n### 1. Planning\n\n- [ ] Ask user: \"What should the public interface look like? Which behaviors are most important to test?\"\n- [ ] Identify opportunities for [deep modules](references/deep-modules.md) (small interface, deep implementation)\n- [ ] Design interfaces for [testability](references/interface-design.md)\n- [ ] List behaviors to test (prioritize critical paths — you can't test everything)\n- [ ] Get user approval before writing code\n\n### 2. Tracer Bullet\n\n```\nRED:   Write first test → fails\nGREEN: Minimal code to pass → passes\n```\n\n### 3. Incremental Loop\n\nFor each remaining behavior:\n\n```\nRED:   Write next test → fails\nGREEN: Minimal code to pass → passes\n```\n\nOne test at a time. Minimal code to pass. No refactoring while RED.\n\n### Checklist (each cycle)\n\n- [ ] Test describes behavior, not implementation\n- [ ] Test uses public interface only\n- [ ] Test would survive internal refactor\n- [ ] Code is minimal for this test\n- [ ] No speculative features added\n\n### 4. Refactor\n\nOnce all tests GREEN, look for [refactor candidates](references/refactoring.md):\n\n- [ ] Extract duplication\n- [ ] Deepen modules (move complexity behind simple interfaces)\n- [ ] Run tests after each refactor step\n\n**Never refactor while RED.**\n\n## Anti-Rationalization\n\n| Excuse | Rebuttal |\n|---|---|\n| \"This is too small for TDD\" | Small functions have edge cases too. A 1-min test prevents a 30-min debug. |\n| \"I'll write tests after\" | That's not TDD. Tests written after miss the design feedback loop. |\n| \"The test is obvious, skip RED\" | If it's obvious, writing it takes 10 seconds. Skip nothing. |\n| \"I need to refactor first\" | Never refactor while RED. Get to GREEN, then refactor. |\n| \"Mocking is too complex here\" | Complexity in mocking signals a design problem. Simplify the interface. |\n| \"I'll batch these 3 tests\" | One test at a time. Batching hides which change broke what. |\n\n## Error Handling\n\n- If test runner not found → check `package.json` for `test` script; ask user which runner to use\n- If tests go RED after refactor → revert immediately and re-attempt in smaller steps\n- If a test cannot be made GREEN with minimal code → revisit the interface design with the user","tags":["tdd","agent","skills","helderberto","agent-skills","ai-tools","antigravity","claude-code","cursor","developer-tools","gemini-cli","markdown"],"capabilities":["skill","source-helderberto","skill-tdd","topic-agent-skills","topic-ai-tools","topic-antigravity","topic-claude-code","topic-cursor","topic-developer-tools","topic-gemini-cli","topic-markdown","topic-plugin","topic-sdlc","topic-skills","topic-tracer-bullet"],"categories":["agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/helderberto/agent-skills/tdd","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add helderberto/agent-skills","source_repo":"https://github.com/helderberto/agent-skills","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (2,577 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:09:15.024Z","embedding":null,"createdAt":"2026-05-18T13:14:55.282Z","updatedAt":"2026-05-18T19:09:15.024Z","lastSeenAt":"2026-05-18T19:09:15.024Z","tsv":"'1':98,270 '10':308 '2':149 '3':163,345 '30':275 '4':222 'ad':47,221 'anti':253 'anti-ration':252 'approv':145 'ask':100,370 'attempt':387 'batch':343,352 'behavior':57,110,132,169,199 'behind':239 'broke':356 'bug':22 'build':18 'bullet':151 'candid':231 'cannot':394 'case':267 'chang':355 'check':365 'checklist':194 'code':87,148,159,177,187,212,400 'complex':238,329,331 'critic':136 'cycl':83,196 'debug':277 'deep':119,124 'deepen':235 'demonstr':96 'describ':198 'design':126,292,336,404 'detail':63 'develop':6,34,54 'driven':5,53 'duplic':234 'edg':266 'error':358 'everyth':142 'examples.md':93 'excus':255 'exist':50 'extract':233 'fail':156,174 'featur':19,220 'feedback':293 'first':33,78,154,316 'fix':21 'found':364 'function':264 'get':143,321 'go':378 'green':10,28,157,175,227,323,397 'guid':2 'guidelin':72 'handl':359 'hide':353 'identifi':116 'immedi':383 'implement':46,62,81,125,201 'import':113 'increment':164 'interfac':60,106,123,127,205,241,340,403 'intern':210 'like':108 'list':131 'll':279,342 'look':107,228 'loop':12,165,294 'made':396 'mention':25 'min':271,276 'minim':86,158,176,186,214,399 'miss':290 'mock':71,326,333 'modul':120,236 'move':237 'need':313 'never':248,317 'next':90,172 'noth':311 'obvious':298,304 'one':84,181,347 'opportun':117 'package.json':366 'pass':89,161,162,179,180,189 'path':137 'philosophi':69 'plan':99 'prevent':273 'principles.md':65 'priorit':135 'problem':337 'public':59,105,204 'ration':254 're':386 're-attempt':385 'rebutt':256 'red':9,27,152,170,193,251,300,320,379 'red-green-refactor':8,26 'refactor':11,29,191,211,223,230,246,249,315,318,325,381 'references/deep-modules.md':121 'references/examples.md':94 'references/interface-design.md':130 'references/principles.md':66 'references/refactoring.md':232 'remain':168 'request':36 'revert':382 'revisit':401 'run':242 'runner':362,373 'script':369 'second':309 'see':64,92 'signal':334 'simpl':240 'simplifi':338 'skill' 'skill-tdd' 'skip':299,310 'small':122,260,263 'smaller':389 'source-helderberto' 'specul':219 'step':247,390 'surviv':209 'take':307 'tdd':1,24,37,262,286 'test':4,32,44,48,52,55,68,77,85,91,115,134,141,155,173,182,197,202,207,217,226,243,272,281,287,296,346,348,361,368,377,393 'test-driven':3,51 'test-first':31 'testabl':129 'time':185,351 'topic-agent-skills' 'topic-ai-tools' 'topic-antigravity' 'topic-claude-code' 'topic-cursor' 'topic-developer-tools' 'topic-gemini-cli' 'topic-markdown' 'topic-plugin' 'topic-sdlc' 'topic-skills' 'topic-tracer-bullet' 'tracer':150 'use':13,23,41,203,375 'user':15,101,144,371,407 'verifi':56 'want':16,30 'workflow':38,97 'would':208 'write':43,75,147,153,171,280,305 'written':288","prices":[{"id":"619a5aa4-a83e-4d61-86bd-15c62cbc03f4","listingId":"b5f69737-ab47-4db4-a4b2-4cf6bbce1005","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"helderberto","category":"agent-skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:14:55.282Z"}],"sources":[{"listingId":"b5f69737-ab47-4db4-a4b2-4cf6bbce1005","source":"github","sourceId":"helderberto/agent-skills/tdd","sourceUrl":"https://github.com/helderberto/agent-skills/tree/main/skills/tdd","isPrimary":false,"firstSeenAt":"2026-05-18T13:14:55.282Z","lastSeenAt":"2026-05-18T19:09:15.024Z"}],"details":{"listingId":"b5f69737-ab47-4db4-a4b2-4cf6bbce1005","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"helderberto","slug":"tdd","github":{"repo":"helderberto/agent-skills","stars":8,"topics":["agent-skills","ai","ai-tools","antigravity","claude-code","cursor","developer-tools","gemini-cli","markdown","plugin","sdlc","skills","tracer-bullet"],"license":"mit","html_url":"https://github.com/helderberto/agent-skills","pushed_at":"2026-05-14T11:37:47Z","description":"My personal SDLC toolbelt for AI coding agents — PRD to ship.","skill_md_sha":"69e5437029a520ac2af7fdc8696c5b87e9cb6aa7","skill_md_path":"skills/tdd/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/helderberto/agent-skills/tree/main/skills/tdd"},"layout":"multi","source":"github","category":"agent-skills","frontmatter":{"name":"tdd","description":"Guides test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions \"red-green-refactor\", wants test-first development, or requests TDD workflow. Don't use for writing tests after implementation, adding tests to existing untested code, or one-off test fixes."},"skills_sh_url":"https://skills.sh/helderberto/agent-skills/tdd"},"updatedAt":"2026-05-18T19:09:15.024Z"}}