{"id":"24b6a402-d358-4cfc-b83a-2dfb692c7e6c","shortId":"X5K6QZ","kind":"skill","title":"tdd","tagline":"Test-driven development — write a failing test before writing production code. Use when implementing new functionality, adding behavior, or fixing bugs during active development.","description":"# TDD\n\nRed. Green. Refactor. In that order, every time.\n\n## Hard Rules\n\n- No production code without a failing test first.\n- If production code was written before its test, delete it and start over with a failing test.\n- Never skip the red step. A test that has never failed proves nothing.\n\n## Cycle\n\nFor each unit of behavior:\n\n1. **Red** — Write a test for the next behavior. Run it. It must fail. Read the failure message — it should describe the missing behavior.\n2. **Green** — Write the minimum production code to make the test pass. Nothing more. Run the test. Apply the `verify` skill.\n3. **Refactor** — Clean up both test and production code. Run the test again. Still green? Done. Apply the `verify` skill.\n\nThen pick the next behavior and repeat.\n\n## Rules for Each Step\n\n**Red:**\n- Test one behavior, not one function. Name the test after what the system should do, not what the function is called.\n- The test must fail for the right reason — a missing method, wrong return value, unmet condition. Not a syntax error or import failure.\n- If the test passes immediately, it's not testing new behavior. Delete it or pick a different behavior.\n\n**Green:**\n- Write the simplest code that passes. Hardcode if needed — the next test will force generalization.\n- Do not add code \"while you're in there.\" If it's not required by a failing test, it doesn't exist yet.\n- Do not refactor during green. Pass first, clean second.\n\n**Refactor:**\n- Remove duplication between test and production code.\n- Extract only when you see real duplication, not predicted duplication.\n- Tests must still pass after every refactor move. Run them after each change.\n\n## Anti-Patterns\n\n| Pattern | Problem | Fix |\n|---|---|---|\n| Test-after | Code shapes the test instead of the other way around | Delete the code, write the test first |\n| Testing internals | Tests break on refactor, not on behavior change | Test public behavior only |\n| Giant red step | Multiple behaviors in one test | One assertion per behavior |\n| Gold-plating green | Adding code no test requires | Remove untested code |\n| Skipping refactor | Tech debt accumulates immediately | Refactor before the next red |\n| Mock-heavy tests | Tests pass but real code fails | Prefer real dependencies, mock at boundaries only |\n\n## Red Flags and Rationalizations\n\n| Rationalization | Why It's Wrong | Do Instead |\n|---|---|---|\n| \"This is too simple to test first\" | Simple code still needs a spec | Write the test — it'll be fast |\n| \"I'll add the test right after\" | You won't, and the code will shape the test | Test first, always |\n| \"I need to see the design first\" | The test IS the design | Let the test drive the interface |\n| \"Mocking is too hard for this\" | Difficulty mocking signals tight coupling | Fix the design, then test |\n| \"The test would be identical to the implementation\" | Then you're testing internals | Test the behavior from the outside |\n\n## Memory Integration\n\nAfter completing a TDD session, store reusable test patterns (setup, assertions, fixtures): `npx ai-devkit@latest memory store --title \"<pattern>\" --content \"<details>\" --tags \"tdd,testing\"`","tags":["tdd","devkit","codeaholicguy","agent-skills","ai-assisted-development","antigravity","claude-code","codex","cursor","development","engineering","engineering-enablement"],"capabilities":["skill","source-codeaholicguy","skill-tdd","topic-agent-skills","topic-ai-assisted-development","topic-antigravity","topic-claude-code","topic-codex","topic-cursor","topic-development","topic-engineering","topic-engineering-enablement","topic-engineering-experience","topic-prd"],"categories":["ai-devkit"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/codeaholicguy/ai-devkit/tdd","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add codeaholicguy/ai-devkit","source_repo":"https://github.com/codeaholicguy/ai-devkit","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 1174 github stars · SKILL.md body (3,127 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-03T00:52:57.338Z","embedding":null,"createdAt":"2026-04-18T21:55:32.571Z","updatedAt":"2026-05-03T00:52:57.338Z","lastSeenAt":"2026-05-03T00:52:57.338Z","tsv":"'1':82 '2':106 '3':127 'accumul':368 'activ':25 'ad':19,356 'add':239,425 'ai':512 'ai-devkit':511 'alway':442 'anti':301 'anti-pattern':300 'appli':123,143 'around':318 'assert':349,508 'behavior':20,81,90,105,151,161,213,220,334,338,344,351,492 'boundari':390 'break':329 'bug':23 'call':179 'chang':299,335 'clean':129,267 'code':13,40,48,112,135,225,240,276,309,321,357,363,383,411,435 'complet':499 'condit':195 'content':518 'coupl':471 'cycl':76 'debt':367 'delet':54,214,319 'depend':387 'describ':102 'design':448,454,474 'develop':5,26 'devkit':513 'differ':219 'difficulti':467 'doesn':256 'done':142 'drive':458 'driven':4 'duplic':271,283,286 'error':199 'everi':34,292 'exist':258 'extract':277 'fail':8,43,61,73,95,183,253,384 'failur':98,202 'fast':422 'first':45,266,325,409,441,449 'fix':22,305,472 'fixtur':509 'flag':393 'forc':235 'function':18,164,177 'general':236 'giant':340 'gold':353 'gold-plat':352 'green':29,107,141,221,264,355 'hard':36,464 'hardcod':228 'heavi':377 'ident':481 'immedi':207,369 'implement':16,484 'import':201 'instead':313,402 'integr':497 'interfac':460 'intern':327,489 'latest':514 'let':455 'll':420,424 'make':114 'memori':496,515 'messag':99 'method':190 'minimum':110 'miss':104,189 'mock':376,388,461,468 'mock-heavi':375 'move':294 'multipl':343 'must':94,182,288 'name':165 'need':230,413,444 'never':63,72 'new':17,212 'next':89,150,232,373 'noth':75,118 'npx':510 'one':160,163,346,348 'order':33 'outsid':495 'pass':117,206,227,265,290,380 'pattern':302,303,506 'per':350 'pick':148,217 'plate':354 'predict':285 'prefer':385 'problem':304 'product':12,39,47,111,134,275 'prove':74 'public':337 'ration':395,396 're':243,487 'read':96 'real':282,382,386 'reason':187 'red':28,66,83,158,341,374,392 'refactor':30,128,262,269,293,331,365,370 'remov':270,361 'repeat':153 'requir':250,360 'return':192 'reusabl':504 'right':186,428 'rule':37,154 'run':91,120,136,295 'second':268 'see':281,446 'session':502 'setup':507 'shape':310,437 'signal':469 'simpl':406,410 'simplest':224 'skill':126,146 'skill-tdd' 'skip':64,364 'source-codeaholicguy' 'spec':415 'start':57 'step':67,157,342 'still':140,289,412 'store':503,516 'syntax':198 'system':171 'tag':519 'tdd':1,27,501,520 'tech':366 'test':3,9,44,53,62,69,86,116,122,132,138,159,167,181,205,211,233,254,273,287,307,312,324,326,328,336,347,359,378,379,408,418,427,439,440,451,457,476,478,488,490,505,521 'test-aft':306 'test-driven':2 'tight':470 'time':35 'titl':517 'topic-agent-skills' 'topic-ai-assisted-development' 'topic-antigravity' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-development' 'topic-engineering' 'topic-engineering-enablement' 'topic-engineering-experience' 'topic-prd' 'unit':79 'unmet':194 'untest':362 'use':14 'valu':193 'verifi':125,145 'way':317 'without':41 'won':431 'would':479 'write':6,11,84,108,222,322,416 'written':50 'wrong':191,400 'yet':259","prices":[{"id":"3262c15b-c07a-448d-ba36-69cbd1e6ff9c","listingId":"24b6a402-d358-4cfc-b83a-2dfb692c7e6c","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"codeaholicguy","category":"ai-devkit","install_from":"skills.sh"},"createdAt":"2026-04-18T21:55:32.571Z"}],"sources":[{"listingId":"24b6a402-d358-4cfc-b83a-2dfb692c7e6c","source":"github","sourceId":"codeaholicguy/ai-devkit/tdd","sourceUrl":"https://github.com/codeaholicguy/ai-devkit/tree/main/skills/tdd","isPrimary":false,"firstSeenAt":"2026-04-18T21:55:32.571Z","lastSeenAt":"2026-05-03T00:52:57.338Z"}],"details":{"listingId":"24b6a402-d358-4cfc-b83a-2dfb692c7e6c","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"codeaholicguy","slug":"tdd","github":{"repo":"codeaholicguy/ai-devkit","stars":1174,"topics":["agent-skills","ai","ai-assisted-development","antigravity","claude-code","codex","cursor","development","engineering","engineering-enablement","engineering-experience","prd"],"license":null,"html_url":"https://github.com/codeaholicguy/ai-devkit","pushed_at":"2026-05-03T00:18:58Z","description":"A universal CLI toolkit for AI agent skills, enabling structured AI-assisted development across tools like Cursor, Claude Code, Codex, and more.","skill_md_sha":"4ac33cd18e4ec30fcf96ea230e7592c0124e4671","skill_md_path":"skills/tdd/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/codeaholicguy/ai-devkit/tree/main/skills/tdd"},"layout":"multi","source":"github","category":"ai-devkit","frontmatter":{"name":"tdd","description":"Test-driven development — write a failing test before writing production code. Use when implementing new functionality, adding behavior, or fixing bugs during active development."},"skills_sh_url":"https://skills.sh/codeaholicguy/ai-devkit/tdd"},"updatedAt":"2026-05-03T00:52:57.338Z"}}