{"id":"24b6a402-d358-4cfc-b83a-2dfb692c7e6c","shortId":"X5K6QZ","kind":"skill","title":"tdd","tagline":"AI DevKit · 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 · 1196 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-18T18:53:09.568Z","embedding":null,"createdAt":"2026-04-18T21:55:32.571Z","updatedAt":"2026-05-18T18:53:09.568Z","lastSeenAt":"2026-05-18T18:53:09.568Z","tsv":"'1':84 '2':108 '3':129 'accumul':370 'activ':27 'ad':21,358 'add':241,427 'ai':2,514 'ai-devkit':513 'alway':444 'anti':303 'anti-pattern':302 'appli':125,145 'around':320 'assert':351,510 'behavior':22,83,92,107,153,163,215,222,336,340,346,353,494 'boundari':392 'break':331 'bug':25 'call':181 'chang':301,337 'clean':131,269 'code':15,42,50,114,137,227,242,278,311,323,359,365,385,413,437 'complet':501 'condit':197 'content':520 'coupl':473 'cycl':78 'debt':369 'delet':56,216,321 'depend':389 'describ':104 'design':450,456,476 'develop':7,28 'devkit':3,515 'differ':221 'difficulti':469 'doesn':258 'done':144 'drive':460 'driven':6 'duplic':273,285,288 'error':201 'everi':36,294 'exist':260 'extract':279 'fail':10,45,63,75,97,185,255,386 'failur':100,204 'fast':424 'first':47,268,327,411,443,451 'fix':24,307,474 'fixtur':511 'flag':395 'forc':237 'function':20,166,179 'general':238 'giant':342 'gold':355 'gold-plat':354 'green':31,109,143,223,266,357 'hard':38,466 'hardcod':230 'heavi':379 'ident':483 'immedi':209,371 'implement':18,486 'import':203 'instead':315,404 'integr':499 'interfac':462 'intern':329,491 'latest':516 'let':457 'll':422,426 'make':116 'memori':498,517 'messag':101 'method':192 'minimum':112 'miss':106,191 'mock':378,390,463,470 'mock-heavi':377 'move':296 'multipl':345 'must':96,184,290 'name':167 'need':232,415,446 'never':65,74 'new':19,214 'next':91,152,234,375 'noth':77,120 'npx':512 'one':162,165,348,350 'order':35 'outsid':497 'pass':119,208,229,267,292,382 'pattern':304,305,508 'per':352 'pick':150,219 'plate':356 'predict':287 'prefer':387 'problem':306 'product':14,41,49,113,136,277 'prove':76 'public':339 'ration':397,398 're':245,489 'read':98 'real':284,384,388 'reason':189 'red':30,68,85,160,343,376,394 'refactor':32,130,264,271,295,333,367,372 'remov':272,363 'repeat':155 'requir':252,362 'return':194 'reusabl':506 'right':188,430 'rule':39,156 'run':93,122,138,297 'second':270 'see':283,448 'session':504 'setup':509 'shape':312,439 'signal':471 'simpl':408,412 'simplest':226 'skill':128,148 'skill-tdd' 'skip':66,366 'source-codeaholicguy' 'spec':417 'start':59 'step':69,159,344 'still':142,291,414 'store':505,518 'syntax':200 'system':173 'tag':521 'tdd':1,29,503,522 'tech':368 'test':5,11,46,55,64,71,88,118,124,134,140,161,169,183,207,213,235,256,275,289,309,314,326,328,330,338,349,361,380,381,410,420,429,441,442,453,459,478,480,490,492,507,523 'test-aft':308 'test-driven':4 'tight':472 'time':37 'titl':519 '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':81 'unmet':196 'untest':364 'use':16 'valu':195 'verifi':127,147 'way':319 'without':43 'won':433 'would':481 'write':8,13,86,110,224,324,418 'written':52 'wrong':193,402 'yet':261","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-18T18:53:09.568Z"}],"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":1196,"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-17T00:23:12Z","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":"240216109436769e6e452d79c2e4c7538e73b670","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":"AI DevKit · 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-18T18:53:09.568Z"}}