[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71J7TV45W0945YVDGW7GP69":3,"skill-same:01M71J7TV45W0945YVDGW7GP69":64},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":14,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M71J7TV45W0945YVDGW7GP69","tdd-bugfix",null,"Use whenever the goal is to correct a defect: a reported bug, a failing test, a CI or build failure to investigate, a regression, or any \"why is this broken \u002F make this behave correctly\" task. Enforces a test-first RED→GREEN workflow — reproduce the bug with a failing test and confirm it fails for the RIGHT reason BEFORE writing any fix, then implement the fix and confirm that test plus the surrounding suite pass. Trigger this even when the user never says \"TDD\" or \"test\": phrases like \"fix this bug\", \"investigate the CI failure\", \"this is broken\", \"figure out why X happens\", or pasting a stack trace all count. Do NOT jump straight to editing source code.","pedromvgomes\u002Fagentic-toolkit","pedromvgomes","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1675436?v=4","01M71J6N3KV6ZE9291VKGCR29J","Pedro Gomes","01M71J6N4SG1E3B2DP5PWM8J22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fdefinitions\u002Fskills\u002Ftdd-bugfix\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"tdd","tdd bugfix","bugfix","why","goal","defect","stack","code","workflow","when","writing","behave","failing","ci","fix","regression","green","never","broken","test-first","2026-11-10 10:12:30",false,"---\nname: tdd-bugfix\ndescription: >-\n  Use whenever the goal is to correct a defect: a reported bug, a failing test, a\n  CI or build failure to investigate, a regression, or any \"why is this broken \u002F\n  make this behave correctly\" task. Enforces a test-first RED→GREEN workflow —\n  reproduce the bug with a failing test and confirm it fails for the RIGHT reason\n  BEFORE writing any fix, then implement the fix and confirm that test plus the\n  surrounding suite pass. Trigger this even when the user never says \"TDD\" or\n  \"test\": phrases like \"fix this bug\", \"investigate the CI failure\", \"this is\n  broken\", \"figure out why X happens\", or pasting a stack trace all count. Do NOT\n  jump straight to editing source code.\n---\n\n# TDD Bugfix\n\nA bug is a gap between expected and actual behavior that no current test catches.\nThe fix is not done when the symptom disappears — it is done when a test *would\nhave caught the bug* and now passes. Writing that test first is the only way to be\nsure of both.\n\nThe discipline is: make the bug visible as a failing test (RED), then make it\ndisappear (GREEN), then leave the test behind as a guard. Skipping the RED step is\nthe most common way to \"fix\" something that was never actually broken where you\nthought, or to ship a fix that quietly does nothing.\n\n## When this applies\n\nUse this loop for any defect-correction task, including when the bug is discovered\nindirectly:\n\n- A bug report or reproduction steps from a user or ticket.\n- A failing or flaky test you're asked to fix.\n- A CI \u002F build \u002F pipeline failure you're asked to investigate.\n- A regression (\"this used to work\").\n- Vague reports — \"this is broken\", \"the numbers are wrong\", \"it hangs sometimes\" —\n  where the first job is to pin the defect down precisely enough to write a test.\n\nThis is for correcting *incorrect behavior*. Pure new-feature work and mechanical\nrefactors (behavior unchanged, tests already green) are out of scope.\n\n## The loop: RED → GREEN → guard\n\n### 1. Reproduce — understand the exact failure first\n\nDo not write a test until you can state, in one sentence, what the wrong behavior is\nand where it happens. Resist the pull to start editing source. Concretely:\n\n- Read the actual evidence: the stack trace, assertion message, failing CI log,\n  reproduction steps. For a CI failure, read the real error from the logs before\n  forming any theory — do not guess from the job name.\n- Locate the smallest unit that exhibits the bug (a function, an endpoint, a\n  workflow step). The narrower the surface, the faster the test.\n- Form a falsifiable hypothesis: \"given input X, the code returns Y but should\n  return Z.\" If you can't yet, investigate until you can.\n\n### 2. RED — write a test that fails for the right reason\n\nWrite a test that asserts the *correct* behavior, so it fails against the current\nbuggy code. Then run it and read the failure.\n\nThis is the step that earns the whole skill, so be rigorous about it:\n\n- **Confirm it fails, and fails for the reason you predicted.** The failure message \u002F\n  assertion must match your hypothesis from step 1. A test that fails because of a\n  compile error, a missing import, a wrong fixture, or an unrelated assertion has\n  proven nothing — fix the test scaffolding and re-run until the *only* reason it's\n  red is the bug itself.\n- **If it unexpectedly passes, STOP.** Do not edit source. An already-green test means\n  one of: the bug isn't where you think, your reproduction is wrong, or it's already\n  fixed. Go back to step 1 with the new information.\n- Make the test minimal and targeted at the defect — one clear assertion about the\n  wrong behavior, not a sprawling scenario.\n- Name it so its intent survives without context, and reference the ticket\u002Fissue if\n  there is one (e.g. `returns_zero_balance_for_closed_account`, or a name tying it to\n  the bug ID). This test is going to live in the suite permanently.\n\nRun the narrowest target that includes the new test (see \"Running tests\" below) and\npaste\u002Fread the failure before moving on.\n\n### 3. GREEN — implement the minimal fix\n\nNow, and only now, change the source.\n\n- Make the smallest change that turns the red test green. Do not bundle refactors,\n  cleanup, or unrelated improvements into the same change — note them separately and\n  raise them after.\n- **Never weaken the test to make it pass.** Loosening an assertion, deleting a case,\n  or adding a special-case branch *in the test* to dodge the failure defeats the\n  entire purpose. The code moves to meet the test, never the reverse.\n\n### 4. Verify and guard against regression\n\nA passing new test is necessary but not sufficient.\n\n- Re-run the new test → confirm GREEN.\n- Run the surrounding suite (the module\u002Fpackage, then wider if the change is risky) →\n  confirm you didn't break anything else. Bug fixes frequently break adjacent\n  behavior that no longer matches the old wrong assumption.\n- **Keep the reproduction test.** It is now a regression guard — never delete it after\n  the fix. That permanent test is the durable value of this whole exercise.\n- For anything subtle or high-stakes, *prove the test catches the bug*: temporarily\n  revert the fix, confirm the test goes RED again, then re-apply. This guarantees the\n  test is actually wired to the defect and not passing for an incidental reason.\n\nOnly report the bug as fixed once the new test passes, the suite is green, and the\nreproduction test remains in place.\n\n## Running tests\n\nRun the **narrowest target** during the loop for fast feedback (a single test or\ntest class), then widen to the module and finally the relevant suite before\ndeclaring done. Discover the right command from the project rather than assuming —\ncheck the build files, existing test layout, and CI config:\n\n- **Gradle \u002F Kotlin \u002F JVM**: `.\u002Fgradlew :module:test --tests 'FullyQualifiedTestName'`;\n  whole module `:module:test`. Check `build.gradle(.kts)` and the CI workflow for the\n  exact module path and any required flags.\n- **Node \u002F TypeScript**: inspect `package.json` scripts. Common: `npm test -- \u003Cpattern>`,\n  `jest \u003Cfile>`, `vitest run \u003Cfile>`. Match the runner the repo actually uses.\n- **Rust**: `cargo test \u003Ctest_name>` for one test, `cargo test -p \u003Ccrate>` for a crate.\n- **Other stacks**: read the CI config — it is the source of truth for how tests are\n  run in this repo, including environment setup.\n\nIf you can't determine the command, find and mimic how an existing test in the repo\nis run rather than inventing one.\n\n## When you genuinely can't write a failing test first\n\nSome bugs resist a clean test-first reproduction: races and concurrency, timing,\nflakiness, environment-specific failures, or defects buried behind untested\nintegration seams. Do not silently abandon TDD when this happens. Instead:\n\n- **Try harder first.** Loop\u002Fstress the test to surface a race; inject the triggering\n  condition (clock, fault, ordering) deterministically; add a seam or test hook;\n  reproduce at a lower level than where the symptom appears.\n- **If still impossible, say so explicitly** and write the closest test you can — even\n  one that characterizes the surrounding behavior or asserts the invariant that was\n  violated — and call out in your summary that a true pre-fix RED couldn't be\n  achieved and why. Never imply test-first happened when it didn't.\n\nA flaky test in CI may be a real concurrency bug (in scope — reproduce and fix) or\ngenuine infrastructure noise (out of scope for a code fix — diagnose and report\nrather than patching the test to hide it). Decide which before touching anything.\n\n## Anti-patterns — do not do these\n\n- Editing source before a failing test exists.\n- Accepting a red test without checking it failed *for the bug's reason*.\n- Continuing after a test unexpectedly passes instead of re-investigating.\n- Changing the test to fit the code (loosening assertions, deleting cases).\n- Deleting the reproduction test once the fix is in.\n- Bundling unrelated refactors into the fix.\n- Declaring victory on a green new test without running the wider suite.\n\n## Quick reference\n\n```\n1. Reproduce   → state the exact wrong behavior (read logs\u002Ftrace, form hypothesis)\n2. RED         → write test for correct behavior → run → MUST fail for the right reason\n                 (passes unexpectedly? STOP, re-investigate)\n3. GREEN       → smallest source change to pass → never weaken the test\n4. Guard       → new test green + suite green + keep the test (optionally revert-to-confirm)\n```","# TDD Bugfix\n\nA bug is a gap between expected and actual behavior that no current test catches.\nThe fix is not done when the symptom disappears — it is done when a test *would\nhave caught the bug* and now passes. Writing that test first is the only way to be\nsure of both.\n\nThe discipline is: make the bug visible as a failing test (RED), then make it\ndisappear (GREEN), then leave the test behind as a guard. Skipping the RED step is\nthe most common way to \"fix\" something that was never actually broken where you\nthought, or to ship a fix that quietly does nothing.\n\n## When this applies\n\nUse this loop for any defect-correction task, including when the bug is discovered\nindirectly:\n\n- A bug report or reproduction steps from a user or ticket.\n- A failing or flaky test you're asked to fix.\n- A CI \u002F build \u002F pipeline failure you're asked to investigate.\n- A regression (\"this used to work\").\n- Vague reports — \"this is broken\", \"the numbers are wrong\", \"it hangs sometimes\" —\n  where the first job is to pin the defect down precisely enough to write a test.\n\nThis is for correcting *incorrect behavior*. Pure new-feature work and mechanical\nrefactors (behavior unchanged, tests already green) are out of scope.\n\n## The loop: RED → GREEN → guard\n\n### 1. Reproduce — understand the exact failure first\n\nDo not write a test until you can state, in one sentence, what the wrong behavior is\nand where it happens. Resist the pull to start editing source. Concretely:\n\n- Read the actual evidence: the stack trace, assertion message, failing CI log,\n  reproduction steps. For a CI failure, read the real error from the logs before\n  forming any theory — do not guess from the job name.\n- Locate the smallest unit that exhibits the bug (a function, an endpoint, a\n  workflow step). The narrower the surface, the faster the test.\n- Form a falsifiable hypothesis: \"given input X, the code returns Y but should\n  return Z.\" If you can't yet, investigate until you can.\n\n### 2. RED — write a test that fails for the right reason\n\nWrite a test that asserts the *correct* behavior, so it fails against the current\nbuggy code. Then run it and read the failure.\n\nThis is the step that earns the whole skill, so be rigorous about it:\n\n- **Confirm it fails, and fails for the reason you predicted.** The failure message \u002F\n  assertion must match your hypothesis from step 1. A test that fails because of a\n  compile error, a missing import, a wrong fixture, or an unrelated assertion has\n  proven nothing — fix the test scaffolding and re-run until the *only* reason it's\n  red is the bug itself.\n- **If it unexpectedly passes, STOP.** Do not edit source. An already-green test means\n  one of: the bug isn't where you think, your reproduction is wrong, or it's already\n  fixed. Go back to step 1 with the new information.\n- Make the test minimal and targeted at the defect — one clear assertion about the\n  wrong behavior, not a sprawling scenario.\n- Name it so its intent survives without context, and reference the ticket\u002Fissue if\n  there is one (e.g. `returns_zero_balance_for_closed_account`, or a name tying it to\n  the bug ID). This test is going to live in the suite permanently.\n\nRun the narrowest target that includes the new test (see \"Running tests\" below) and\npaste\u002Fread the failure before moving on.\n\n### 3. GREEN — implement the minimal fix\n\nNow, and only now, change the source.\n\n- Make the smallest change that turns the red test green. Do not bundle refactors,\n  cleanup, or unrelated improvements into the same change — note them separately and\n  raise them after.\n- **Never weaken the test to make it pass.** Loosening an assertion, deleting a case,\n  or adding a special-case branch *in the test* to dodge the failure defeats the\n  entire purpose. The code moves to meet the test, never the reverse.\n\n### 4. Verify and guard against regression\n\nA passing new test is necessary but not sufficient.\n\n- Re-run the new test → confirm GREEN.\n- Run the surrounding suite (the module\u002Fpackage, then wider if the change is risky) →\n  confirm you didn't break anything else. Bug fixes frequently break adjacent\n  behavior that no longer matches the old wrong assumption.\n- **Keep the reproduction test.** It is now a regression guard — never delete it after\n  the fix. That permanent test is the durable value of this whole exercise.\n- For anything subtle or high-stakes, *prove the test catches the bug*: temporarily\n  revert the fix, confirm the test goes RED again, then re-apply. This guarantees the\n  test is actually wired to the defect and not passing for an incidental reason.\n\nOnly report the bug as fixed once the new test passes, the suite is green, and the\nreproduction test remains in place.\n\n## Running tests\n\nRun the **narrowest target** during the loop for fast feedback (a single test or\ntest class), then widen to the module and finally the relevant suite before\ndeclaring done. Discover the right command from the project rather than assuming —\ncheck the build files, existing test layout, and CI config:\n\n- **Gradle \u002F Kotlin \u002F JVM**: `.\u002Fgradlew :module:test --tests 'FullyQualifiedTestName'`;\n  whole module `:module:test`. Check `build.gradle(.kts)` and the CI workflow for the\n  exact module path and any required flags.\n- **Node \u002F TypeScript**: inspect `package.json` scripts. Common: `npm test -- \u003Cpattern>`,\n  `jest \u003Cfile>`, `vitest run \u003Cfile>`. Match the runner the repo actually uses.\n- **Rust**: `cargo test \u003Ctest_name>` for one test, `cargo test -p \u003Ccrate>` for a crate.\n- **Other stacks**: read the CI config — it is the source of truth for how tests are\n  run in this repo, including environment setup.\n\nIf you can't determine the command, find and mimic how an existing test in the repo\nis run rather than inventing one.\n\n## When you genuinely can't write a failing test first\n\nSome bugs resist a clean test-first reproduction: races and concurrency, timing,\nflakiness, environment-specific failures, or defects buried behind untested\nintegration seams. Do not silently abandon TDD when this happens. Instead:\n\n- **Try harder first.** Loop\u002Fstress the test to surface a race; inject the triggering\n  condition (clock, fault, ordering) deterministically; add a seam or test hook;\n  reproduce at a lower level than where the symptom appears.\n- **If still impossible, say so explicitly** and write the closest test you can — even\n  one that characterizes the surrounding behavior or asserts the invariant that was\n  violated — and call out in your summary that a true pre-fix RED couldn't be\n  achieved and why. Never imply test-first happened when it didn't.\n\nA flaky test in CI may be a real concurrency bug (in scope — reproduce and fix) or\ngenuine infrastructure noise (out of scope for a code fix — diagnose and report\nrather than patching the test to hide it). Decide which before touching anything.\n\n## Anti-patterns — do not do these\n\n- Editing source before a failing test exists.\n- Accepting a red test without checking it failed *for the bug's reason*.\n- Continuing after a test unexpectedly passes instead of re-investigating.\n- Changing the test to fit the code (loosening assertions, deleting cases).\n- Deleting the reproduction test once the fix is in.\n- Bundling unrelated refactors into the fix.\n- Declaring victory on a green new test without running the wider suite.\n\n## Quick reference\n\n```\n1. Reproduce   → state the exact wrong behavior (read logs\u002Ftrace, form hypothesis)\n2. RED         → write test for correct behavior → run → MUST fail for the right reason\n                 (passes unexpectedly? STOP, re-investigate)\n3. GREEN       → smallest source change to pass → never weaken the test\n4. Guard       → new test green + suite green + keep the test (optionally revert-to-confirm)\n```",{"name":5,"description":7},"main","1b7c664629c06c5cf03e54d6525818588ae28b19","definitions\u002Fskills\u002Ftdd-bugfix","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit","https:\u002F\u002Fgithub.com\u002Fpedromvgomes","2026-10-20 13:33:49",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add pedromvgomes\u002Fagentic-toolkit --skill tdd-bugfix",{"tool":56,"command":57},"bunx","bunx skills add pedromvgomes\u002Fagentic-toolkit --skill tdd-bugfix",{"tool":59,"command":60},"pnpm","pnpm dlx skills add pedromvgomes\u002Fagentic-toolkit --skill tdd-bugfix","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fdefinitions\u002Fskills\u002Ftdd-bugfix\u002FSKILL.md",true,[],[65,81,91,106,116,124],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":39},"01M71J8QDJVQ4W5RCR5MM54505","challenge","Stress-test a plan through one-question-at-a-time interviewing.","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fresolver\u002Ftests\u002Ftestdata\u002Fprimary\u002Fdefinitions\u002Fskills\u002Fchallenge\u002FSKILL.md",[],[67,72,73,74,75,76,77,78,79,80],"stress","time","question","interviewing","stress-test","one","test","plan","at",{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":39},"01M71J8PEYQ95HPKR924PT132W","skill-creator","Skill-creator external bundle.","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fresolver\u002Ftests\u002Ftestdata\u002Fexternal\u002Fskill-creator\u002FSKILL.md",[],[88,89,90,83],"creator","skill creator","bundle",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":39},"01M71J8NFBH2HTB4690QHJ6Z9F","example","An example skill used by parser tests.","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fdefinitions\u002Ftests\u002Ftestdata\u002Fvalid\u002Fdefinitions\u002Fskills\u002Fexample\u002FSKILL.md",[],[93,98,99,100,101,23,102,103,104,105],"grep","parser","read","cursor","example skill","demo","tests","true",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":39},"01M71J8MGJVK5HACJXYAEK14SC","unknown-field","Has a field the schema doesn't recognize.","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fdefinitions\u002Ftests\u002Ftestdata\u002Finvalid\u002Fdefinitions\u002Fskills\u002Funknown-field\u002FSKILL.md",[],[113,114,115],"unknown field","unknown","schema",{"skillNo":117,"name":118,"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":119,"categories":120,"keywords":121,"publishedAt":39},"01M71J8KMKFZN9T16HPHJ3QZBZ","unclosed-frontmatter","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fdefinitions\u002Ftests\u002Ftestdata\u002Finvalid\u002Fdefinitions\u002Fskills\u002Funclosed-frontmatter\u002FSKILL.md",[],[122,123],"frontmatter","unclosed frontmatter",{"skillNo":125,"name":126,"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":127,"categories":128,"keywords":129,"publishedAt":39},"01M71J8JRFKWKK32SBA8EPC1YA","no-frontmatter","https:\u002F\u002Fgithub.com\u002Fpedromvgomes\u002Fagentic-toolkit\u002Fblob\u002Fmain\u002Fsource\u002Ftoolkit\u002Finternal\u002Fdefinitions\u002Ftests\u002Ftestdata\u002Finvalid\u002Fdefinitions\u002Fskills\u002Fno-frontmatter\u002FSKILL.md",[],[130,122],"no frontmatter"]