[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSA1FD3HN9SX46XJAMCBGQ":3,"skill-same:01M7CSA1FD3HN9SX46XJAMCBGQ":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7CSA1FD3HN9SX46XJAMCBGQ","tdd-workflow",null,"Test-first discipline and what makes a test worth keeping. Use when implementing any feature or bug fix, before writing production code, and whenever writing or changing a test.","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Ftdd-workflow\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: tdd-workflow\ncategory: testing\ndescription: Test-first discipline and what makes a test worth keeping. Use when implementing any feature or bug fix, before writing production code, and whenever writing or changing a test.\nsource: obra\u002Fsuperpowers (MIT), adapted\n---\n# Test-Driven Development\n\n## Overview\n\nWrite the test first. Watch it fail. Write minimal code to pass.\n\n**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.\n\n**Violating the letter of the rules is violating the spirit of the rules.**\n\n## The Iron Law\n\n```\nNO PRODUCTION CODE WITHOUT A FAILING TEST FIRST\n```\n\nWrote code before the test? Delete it. Start over. Don't keep it as \"reference\", don't \"adapt\" it while writing tests — delete means delete, implement fresh from the test.\n\n## When to Use\n\nAlways: new features, bug fixes, refactoring, behavior changes. Thinking \"skip TDD just this once\"? Stop. That's rationalization.\n\n**Exceptions — no new test required:** pure config, copy\u002Ftext, or asset edits, and generated code you did not hand-write. Say so explicitly in your closing message; this matches the standing acceptance criteria's own exemption, it does not replace it.\n\n## Red-Green-Refactor\n\n### RED — write one failing test\n- One behavior per test, clear name that describes the behavior.\n- Test real code; mocks only when unavoidable (external services). The mock earns no assertions of its own — assert on what your code does with its result, not that the mock was called.\n- **Before writing the body, name the production change that would make this test fail.** If you can't name one, you're not testing behavior yet.\n- **Derive the expected value independently, by hand** — a literal, not a recomputation. ❌ `expect(build(x)).toBe(build(x))` tests nothing; it recomputes the answer the way the code does, so it passes no matter what. ✅ `expect(build({id:1})).toBe(\"item-1\")`.\n- Bad: a test whose assertions only exercise the mock, not the code under test.\n\n### Verify RED — watch it fail (MANDATORY, never skip)\n- Run it with the stack's focused command, not the whole suite: `go test .\u002Fpkg\u002F... -run TestName`, `npx vitest run path\u002Fto.test.tsx`, `flutter test test\u002Fx_test.dart`, `.\u002Fmvnw -q test -Dtest=ClassName`, `dotnet test --filter \"FullyQualifiedName~ClassName\"`, `cargo test test_name`.\n- Confirm it FAILS (not errors) and fails because the feature is missing — not a typo or compile error.\n- Test passes immediately? It tests existing behavior — fix the test.\n- Test errors? Fix the error and re-run until it fails correctly.\n\n### GREEN — minimal code\n- Write the simplest code that makes the test pass. Nothing extra (YAGNI).\n- No extra options, no speculative parameters, no \"while I'm here\" improvements.\n\n### Verify GREEN — watch it pass (MANDATORY)\n- Run the focused test, then the surrounding suite. **\"Other tests\" means the whole project's suite, not just your file or package** — a failure that run shows, including one you didn't cause, goes in your closing message by name; it is not silently someone else's problem.\n- All green, output pristine (no warnings).\n- Test fails? Fix the code, not the test. Other tests fail? Fix now, not later.\n\n### REFACTOR — only while green\n- Remove duplication, improve names, extract helpers. No new behavior.\n- Then write the next failing test — one test, one implementation step (a vertical slice). Writing every test up front and implementing after (\"horizontal slicing\") loses the fail-for-the-right-reason check on each one individually.\n\n## No change detectors\n\nDon't assert class names, exact copy, constants, or private structure — a renamed field or a reworded label breaks the test without the behavior changing. Assert the behavior the test's name promises. For pure styling or layout work, the frontend four-width check is the test; a pixel-diff snapshot is not a substitute.\n\n## The mutation check, before finishing\n\nBefore you call the step done, ask: if I introduced a wrong constant, flipped a branch, dropped a side effect, returned empty instead of the value, or skipped a validation (zero \u002F empty \u002F nil \u002F unauthorised \u002F malformed) — would ONE of my tests fail? If a mutation like that survives every test green, the test suite has a gap, not full coverage. This is what the run's advisory mutation score is checking for; a high line-coverage number with a low mutation score means assertions are missing, not lines.\n\n## Resumed run (in_progress) with a previous run's untested diff\n\nDon't delete the existing diff. Write the test the code is missing, then prove it CAN fail: temporarily revert just the covered lines (`git stash push \u003Cfile>` or a targeted edit), run the test (MUST FAIL), restore (`git stash pop`), run again (passes). Then continue from there — this is the same Verify RED discipline applied after the fact, not an exception to it.\n\n## Worked Example\n\nFeature: `slugify(title)` lowercases and hyphenates.\n\n```\nRED   test: slugify(\"Hello World\") == \"hello-world\"\n      run → FAIL: slugify is not defined            ← watched it fail, right reason\nGREEN func slugify(s) { return strings.ReplaceAll(strings.ToLower(s), \" \", \"-\") }\n      run → PASS                                     ← watched it pass\nRED   test: slugify(\"A  B\") == \"a-b\" (collapse runs)\n      run → FAIL: got \"a--b\"                         ← new behavior, fails first\nGREEN collapse whitespace before replacing\n      run → PASS\nREFACTOR extract the whitespace regex, suite still green\n```\n\nEach behavior earned its own failing test first. The second test caught a real gap the first implementation missed — which is the whole point of writing it before the code.\n\n## Bug Fixes\n\nA bug fix starts with a failing test that reproduces the bug. The test proves the fix and prevents regression. Never fix a bug without a reproducing test.\n\n## Common Rationalizations\n\n| Excuse | Reality |\n|--------|---------|\n| \"Too simple to test\" | Simple code breaks too. The test takes 30 seconds. |\n| \"I'll test after\" | Tests written after pass immediately and prove nothing. |\n| \"Already manually tested\" | Ad-hoc is not systematic: no record, cannot re-run. |\n| \"Deleting X hours is wasteful\" | Sunk cost fallacy. Unverified code is technical debt. |\n| \"Keep it as reference\" | You will adapt it — that is testing after. Delete it. |\n| \"TDD will slow me down\" | TDD is faster than debugging in review\u002FQA and revision cycles. |\n| \"Test is hard to write\" | Hard to test = hard to use. Simplify the design. |\n| \"The expectation and the code share the formula, that's fine\" | That's a change detector, not a test — it passes no matter what the code does. |\n\n## Red Flags — STOP and start over\n\n- Code written before its test\n- Test passes on the first run\n- You cannot explain why the test failed\n- An assertion computed the same way the code computes it\n- \"Tests later\", \"just this once\", \"this is different because...\"\n\nAll of these mean: delete the code, start from the test.\n\n## Checklist before moving the task forward\n\n- [ ] Every new function\u002Fbehavior has a test\n- [ ] Watched each test fail for the expected reason\n- [ ] Wrote minimal code to pass\n- [ ] Whole suite green, output pristine\n- [ ] Edge cases and error paths covered\n- [ ] A plausible mutation to the change would fail at least one test\n\nCan't check every box? You skipped TDD. Start over.\n","# Test-Driven Development\n\n## Overview\n\nWrite the test first. Watch it fail. Write minimal code to pass.\n\n**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.\n\n**Violating the letter of the rules is violating the spirit of the rules.**\n\n## The Iron Law\n\n```\nNO PRODUCTION CODE WITHOUT A FAILING TEST FIRST\n```\n\nWrote code before the test? Delete it. Start over. Don't keep it as \"reference\", don't \"adapt\" it while writing tests — delete means delete, implement fresh from the test.\n\n## When to Use\n\nAlways: new features, bug fixes, refactoring, behavior changes. Thinking \"skip TDD just this once\"? Stop. That's rationalization.\n\n**Exceptions — no new test required:** pure config, copy\u002Ftext, or asset edits, and generated code you did not hand-write. Say so explicitly in your closing message; this matches the standing acceptance criteria's own exemption, it does not replace it.\n\n## Red-Green-Refactor\n\n### RED — write one failing test\n- One behavior per test, clear name that describes the behavior.\n- Test real code; mocks only when unavoidable (external services). The mock earns no assertions of its own — assert on what your code does with its result, not that the mock was called.\n- **Before writing the body, name the production change that would make this test fail.** If you can't name one, you're not testing behavior yet.\n- **Derive the expected value independently, by hand** — a literal, not a recomputation. ❌ `expect(build(x)).toBe(build(x))` tests nothing; it recomputes the answer the way the code does, so it passes no matter what. ✅ `expect(build({id:1})).toBe(\"item-1\")`.\n- Bad: a test whose assertions only exercise the mock, not the code under test.\n\n### Verify RED — watch it fail (MANDATORY, never skip)\n- Run it with the stack's focused command, not the whole suite: `go test .\u002Fpkg\u002F... -run TestName`, `npx vitest run path\u002Fto.test.tsx`, `flutter test test\u002Fx_test.dart`, `.\u002Fmvnw -q test -Dtest=ClassName`, `dotnet test --filter \"FullyQualifiedName~ClassName\"`, `cargo test test_name`.\n- Confirm it FAILS (not errors) and fails because the feature is missing — not a typo or compile error.\n- Test passes immediately? It tests existing behavior — fix the test.\n- Test errors? Fix the error and re-run until it fails correctly.\n\n### GREEN — minimal code\n- Write the simplest code that makes the test pass. Nothing extra (YAGNI).\n- No extra options, no speculative parameters, no \"while I'm here\" improvements.\n\n### Verify GREEN — watch it pass (MANDATORY)\n- Run the focused test, then the surrounding suite. **\"Other tests\" means the whole project's suite, not just your file or package** — a failure that run shows, including one you didn't cause, goes in your closing message by name; it is not silently someone else's problem.\n- All green, output pristine (no warnings).\n- Test fails? Fix the code, not the test. Other tests fail? Fix now, not later.\n\n### REFACTOR — only while green\n- Remove duplication, improve names, extract helpers. No new behavior.\n- Then write the next failing test — one test, one implementation step (a vertical slice). Writing every test up front and implementing after (\"horizontal slicing\") loses the fail-for-the-right-reason check on each one individually.\n\n## No change detectors\n\nDon't assert class names, exact copy, constants, or private structure — a renamed field or a reworded label breaks the test without the behavior changing. Assert the behavior the test's name promises. For pure styling or layout work, the frontend four-width check is the test; a pixel-diff snapshot is not a substitute.\n\n## The mutation check, before finishing\n\nBefore you call the step done, ask: if I introduced a wrong constant, flipped a branch, dropped a side effect, returned empty instead of the value, or skipped a validation (zero \u002F empty \u002F nil \u002F unauthorised \u002F malformed) — would ONE of my tests fail? If a mutation like that survives every test green, the test suite has a gap, not full coverage. This is what the run's advisory mutation score is checking for; a high line-coverage number with a low mutation score means assertions are missing, not lines.\n\n## Resumed run (in_progress) with a previous run's untested diff\n\nDon't delete the existing diff. Write the test the code is missing, then prove it CAN fail: temporarily revert just the covered lines (`git stash push \u003Cfile>` or a targeted edit), run the test (MUST FAIL), restore (`git stash pop`), run again (passes). Then continue from there — this is the same Verify RED discipline applied after the fact, not an exception to it.\n\n## Worked Example\n\nFeature: `slugify(title)` lowercases and hyphenates.\n\n```\nRED   test: slugify(\"Hello World\") == \"hello-world\"\n      run → FAIL: slugify is not defined            ← watched it fail, right reason\nGREEN func slugify(s) { return strings.ReplaceAll(strings.ToLower(s), \" \", \"-\") }\n      run → PASS                                     ← watched it pass\nRED   test: slugify(\"A  B\") == \"a-b\" (collapse runs)\n      run → FAIL: got \"a--b\"                         ← new behavior, fails first\nGREEN collapse whitespace before replacing\n      run → PASS\nREFACTOR extract the whitespace regex, suite still green\n```\n\nEach behavior earned its own failing test first. The second test caught a real gap the first implementation missed — which is the whole point of writing it before the code.\n\n## Bug Fixes\n\nA bug fix starts with a failing test that reproduces the bug. The test proves the fix and prevents regression. Never fix a bug without a reproducing test.\n\n## Common Rationalizations\n\n| Excuse | Reality |\n|--------|---------|\n| \"Too simple to test\" | Simple code breaks too. The test takes 30 seconds. |\n| \"I'll test after\" | Tests written after pass immediately and prove nothing. |\n| \"Already manually tested\" | Ad-hoc is not systematic: no record, cannot re-run. |\n| \"Deleting X hours is wasteful\" | Sunk cost fallacy. Unverified code is technical debt. |\n| \"Keep it as reference\" | You will adapt it — that is testing after. Delete it. |\n| \"TDD will slow me down\" | TDD is faster than debugging in review\u002FQA and revision cycles. |\n| \"Test is hard to write\" | Hard to test = hard to use. Simplify the design. |\n| \"The expectation and the code share the formula, that's fine\" | That's a change detector, not a test — it passes no matter what the code does. |\n\n## Red Flags — STOP and start over\n\n- Code written before its test\n- Test passes on the first run\n- You cannot explain why the test failed\n- An assertion computed the same way the code computes it\n- \"Tests later\", \"just this once\", \"this is different because...\"\n\nAll of these mean: delete the code, start from the test.\n\n## Checklist before moving the task forward\n\n- [ ] Every new function\u002Fbehavior has a test\n- [ ] Watched each test fail for the expected reason\n- [ ] Wrote minimal code to pass\n- [ ] Whole suite green, output pristine\n- [ ] Edge cases and error paths covered\n- [ ] A plausible mutation to the change would fail at least one test\n\nCan't check every box? You skipped TDD. Start over.\n",{"name":5,"source":24,"category":25,"description":7},"obra\u002Fsuperpowers (MIT), adapted","testing","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Ftdd-workflow",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill tdd-workflow",{"tool":41,"command":42},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill tdd-workflow",{"tool":44,"command":45},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill tdd-workflow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Ftdd-workflow\u002FSKILL.md",true,[],[50,56,63,70,77,84],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]