[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77XRANEE75V5DZP5XQPDRKC":3,"skill-same:01M77XRANEE75V5DZP5XQPDRKC":77},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":44},"01M77XRANEE75V5DZP5XQPDRKC","vs-tdd",null,"Use when the user says tdd, test first, red green refactor, or wants a bug fix proven by a failing test first.","vltansky\u002Fvs","vltansky","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5851280?v=4","01M77XJAE230PB81N52XJHT5A1","Vlad Tansky","01M77XJAET1CMBAZ2TWTT4ZQT8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: vs-tdd\ndescription: \"Use when the user says tdd, test first, red green refactor, or wants a bug fix proven by a failing test first.\"\ndisable-model-invocation: true\n---\n\n# TDD\n\nRed → Green → Refactor. No exceptions.\n\n## When to Use\n\n- **Bug fixes** — prove the bug exists with a failing test before touching production code\n- **New features** — define the behavior in tests before implementing\n- **Autopilot integration** — build-it can invoke this for each execution step\n\nCompose `\u002Fvs-eval` only when the unit under test is a vs skill contract\n(SKILL.md, fixtures, `*.static.eval.ts`, `*.eval.ts`, `scripts\u002Freject-*.mjs`).\nSkip `\u002Fvs-eval` for ordinary app unit tests.\n\n## Phase 1: Understand\n\nRead the code that needs to change. Before writing anything:\n\n1. Find existing test files for the module. Match the project's test patterns:\n   ```bash\n   # Find test files near the target\n   find . -path '*\u002Fnode_modules' -prune -o -name '*.test.*' -print -o -name '*.spec.*' -print | head -20\n   ```\n\n2. Read 1-2 existing test files to learn:\n   - Test runner and assertion style (jest, vitest, pytest, go test, etc.)\n   - How fixtures and mocks are set up\n   - Naming conventions\n   - File location conventions (colocated vs `__tests__\u002F` vs `test\u002F`)\n\n3. Identify the test command from CLAUDE.md, package.json, or Makefile.\n\nDo not invent a new test style. Match what exists.\n\n## Phase 2: Red (Write Failing Test)\n\nWrite the test FIRST. The test describes the expected behavior — it is the spec.\n\n### For bug fixes\n\nThe test must reproduce the bug:\n\n1. Write a test that exercises the exact code path that fails.\n   - Prefer the public command, API, UI flow, or caller path where the bug was observed.\n   - Do not test a private helper just because it is easy; a shallow seam can give false confidence.\n   - If no correct seam exists yet, write down why and add the nearest durable public-facing guard.\n2. Run it. It MUST fail. If it passes, your test doesn't cover the bug — rewrite it.\n3. Verify the failure message matches the actual bug (not an unrelated failure).\n\n```\nTest: \"should return user score as number, not NaN\"\nExpected: fail (because the bug produces NaN)\nActual: FAIL ✓ — test correctly catches the bug\n```\n\n### For new features\n\nThe test describes the desired behavior:\n\n1. Pick one vertical behavior slice first — the smallest observable behavior that can ship.\n2. Write the happy-path test for that slice, run it, and make it fail.\n3. Implement only enough to pass that slice.\n4. Repeat for edge cases: empty input, null, boundary values, error paths.\n\nDo not write all tests first and then all implementation. That is specification-by-test, not TDD. TDD alternates red → green for each behavior slice.\n\n### Rules for writing tests\n\n- One logical assertion per test. Multiple related assertions are fine if they test\n  the same behavior from different angles.\n- Test names describe behavior, not implementation:\n  `\"returns empty array when no matches found\"` not `\"test filterResults method\"`\n- Do not mock what you don't own. Mock boundaries (HTTP, DB, filesystem), not\n  internal modules.\n- Assert observable behavior through public interfaces. Avoid private method imports,\n  internal call-count assertions, or verifying persistence by bypassing the read API\n  users actually rely on.\n- If the project has no tests at all: create the test file following the nearest\n  convention you can find (framework docs, similar projects). Note this in the\n  decision log.\n\n## Phase 3: Green (Implement)\n\nApply [`vs-ponytail`](..\u002Fvs-ponytail\u002FSKILL.md) in composed mode after the\nfailing behavior is understood.\n\nWrite the minimum code to make the test pass. Nothing more.\n\n1. Implement the fix or feature.\n2. Run the test. It MUST pass.\n3. If it fails: read the error, fix the implementation (not the test), re-run.\n   Max 3 attempts. If still failing, reassess — maybe the test expectation is wrong.\n4. Run the full test suite to check for regressions.\n\n```\nTest: \"should return user score as number, not NaN\"\nExpected: pass (bug is fixed)\nActual: PASS ✓\nFull suite: 142 passed, 0 failed ✓\n```\n\n### If the full suite has failures\n\nDistinguish between:\n- **Your change broke something** — fix it before moving on\n- **Pre-existing failure** — verify it fails on the base branch too. If yes, note it\n  and continue. If no, it's your regression — fix it.\n\n## Phase 4: Refactor (Optional)\n\nTests are green. Now clean up — but only if needed:\n\n1. Remove duplication introduced by the implementation.\n2. Improve naming if the intent isn't clear.\n3. Simplify if there's an obviously cleaner way.\n\nAfter every refactor step, re-run tests. If anything breaks, revert that refactor.\n\nDo NOT refactor:\n- Code you didn't change (out of scope)\n- Working code that's merely \"not how I'd write it\"\n- Test code that's clear and passing\n\n## Phase 5: Commit\n\nTwo commits (or one if the change is small):\n\n1. `test: add failing test for [description]` — the test alone, before the fix\n   (optional, skip if the test and fix are trivially small)\n2. `fix: [description]` or `feat: [description]` — the implementation that makes it pass\n\nStage specific files. Never `git add .`.\n\n## Integration with Autopilot\n\nWhen build-it invokes TDD for an execution step:\n\n- Phase 1-2 (understand + red) run for the step's scope only\n- Phase 3 (green) is the step's implementation\n- Phase 4 (refactor) is skipped — build-it's review phase handles cleanup\n- Phase 5 (commit) follows build-it's commit conventions\n\nAutopilot passes: the step description, affected files, and test command.\nTDD returns: test file path, implementation file paths, guardrail results.\n\n## Rules\n\n- **Never write implementation before the test.** The test comes first. Always.\n- **Never modify the test to make it pass.** If the test is wrong, rewrite it with\n  a clear reason — don't silently weaken assertions.\n- **A passing test you wrote before the implementation is not TDD.** If the test\n  passed on first run, it doesn't prove your code works — it proves the test is\n  weak. Strengthen it until it fails, then implement.\n- **Match existing test patterns.** TDD is about discipline, not about introducing\n  your preferred test framework or assertion library.\n\n## Output style\n\nApply the [shared output style](..\u002Fvs-internal-shared\u002Freferences\u002Foutput-style.md)\nto every user-facing message.\n\n## Workflow\n\nDirect: emit **Next** only. Composed: return to caller.\n\n**Prev:** `\u002Fvs-debug-mode` | `\u002Fvs-build-it`\n**Next:** `\u002Fvs-roast-code`\n**Relevant:** `\u002Fvs-verify` | `\u002Fvs-eval`\n","# TDD\n\nRed → Green → Refactor. No exceptions.\n\n## When to Use\n\n- **Bug fixes** — prove the bug exists with a failing test before touching production code\n- **New features** — define the behavior in tests before implementing\n- **Autopilot integration** — build-it can invoke this for each execution step\n\nCompose `\u002Fvs-eval` only when the unit under test is a vs skill contract\n(SKILL.md, fixtures, `*.static.eval.ts`, `*.eval.ts`, `scripts\u002Freject-*.mjs`).\nSkip `\u002Fvs-eval` for ordinary app unit tests.\n\n## Phase 1: Understand\n\nRead the code that needs to change. Before writing anything:\n\n1. Find existing test files for the module. Match the project's test patterns:\n   ```bash\n   # Find test files near the target\n   find . -path '*\u002Fnode_modules' -prune -o -name '*.test.*' -print -o -name '*.spec.*' -print | head -20\n   ```\n\n2. Read 1-2 existing test files to learn:\n   - Test runner and assertion style (jest, vitest, pytest, go test, etc.)\n   - How fixtures and mocks are set up\n   - Naming conventions\n   - File location conventions (colocated vs `__tests__\u002F` vs `test\u002F`)\n\n3. Identify the test command from CLAUDE.md, package.json, or Makefile.\n\nDo not invent a new test style. Match what exists.\n\n## Phase 2: Red (Write Failing Test)\n\nWrite the test FIRST. The test describes the expected behavior — it is the spec.\n\n### For bug fixes\n\nThe test must reproduce the bug:\n\n1. Write a test that exercises the exact code path that fails.\n   - Prefer the public command, API, UI flow, or caller path where the bug was observed.\n   - Do not test a private helper just because it is easy; a shallow seam can give false confidence.\n   - If no correct seam exists yet, write down why and add the nearest durable public-facing guard.\n2. Run it. It MUST fail. If it passes, your test doesn't cover the bug — rewrite it.\n3. Verify the failure message matches the actual bug (not an unrelated failure).\n\n```\nTest: \"should return user score as number, not NaN\"\nExpected: fail (because the bug produces NaN)\nActual: FAIL ✓ — test correctly catches the bug\n```\n\n### For new features\n\nThe test describes the desired behavior:\n\n1. Pick one vertical behavior slice first — the smallest observable behavior that can ship.\n2. Write the happy-path test for that slice, run it, and make it fail.\n3. Implement only enough to pass that slice.\n4. Repeat for edge cases: empty input, null, boundary values, error paths.\n\nDo not write all tests first and then all implementation. That is specification-by-test, not TDD. TDD alternates red → green for each behavior slice.\n\n### Rules for writing tests\n\n- One logical assertion per test. Multiple related assertions are fine if they test\n  the same behavior from different angles.\n- Test names describe behavior, not implementation:\n  `\"returns empty array when no matches found\"` not `\"test filterResults method\"`\n- Do not mock what you don't own. Mock boundaries (HTTP, DB, filesystem), not\n  internal modules.\n- Assert observable behavior through public interfaces. Avoid private method imports,\n  internal call-count assertions, or verifying persistence by bypassing the read API\n  users actually rely on.\n- If the project has no tests at all: create the test file following the nearest\n  convention you can find (framework docs, similar projects). Note this in the\n  decision log.\n\n## Phase 3: Green (Implement)\n\nApply [`vs-ponytail`](..\u002Fvs-ponytail\u002FSKILL.md) in composed mode after the\nfailing behavior is understood.\n\nWrite the minimum code to make the test pass. Nothing more.\n\n1. Implement the fix or feature.\n2. Run the test. It MUST pass.\n3. If it fails: read the error, fix the implementation (not the test), re-run.\n   Max 3 attempts. If still failing, reassess — maybe the test expectation is wrong.\n4. Run the full test suite to check for regressions.\n\n```\nTest: \"should return user score as number, not NaN\"\nExpected: pass (bug is fixed)\nActual: PASS ✓\nFull suite: 142 passed, 0 failed ✓\n```\n\n### If the full suite has failures\n\nDistinguish between:\n- **Your change broke something** — fix it before moving on\n- **Pre-existing failure** — verify it fails on the base branch too. If yes, note it\n  and continue. If no, it's your regression — fix it.\n\n## Phase 4: Refactor (Optional)\n\nTests are green. Now clean up — but only if needed:\n\n1. Remove duplication introduced by the implementation.\n2. Improve naming if the intent isn't clear.\n3. Simplify if there's an obviously cleaner way.\n\nAfter every refactor step, re-run tests. If anything breaks, revert that refactor.\n\nDo NOT refactor:\n- Code you didn't change (out of scope)\n- Working code that's merely \"not how I'd write it\"\n- Test code that's clear and passing\n\n## Phase 5: Commit\n\nTwo commits (or one if the change is small):\n\n1. `test: add failing test for [description]` — the test alone, before the fix\n   (optional, skip if the test and fix are trivially small)\n2. `fix: [description]` or `feat: [description]` — the implementation that makes it pass\n\nStage specific files. Never `git add .`.\n\n## Integration with Autopilot\n\nWhen build-it invokes TDD for an execution step:\n\n- Phase 1-2 (understand + red) run for the step's scope only\n- Phase 3 (green) is the step's implementation\n- Phase 4 (refactor) is skipped — build-it's review phase handles cleanup\n- Phase 5 (commit) follows build-it's commit conventions\n\nAutopilot passes: the step description, affected files, and test command.\nTDD returns: test file path, implementation file paths, guardrail results.\n\n## Rules\n\n- **Never write implementation before the test.** The test comes first. Always.\n- **Never modify the test to make it pass.** If the test is wrong, rewrite it with\n  a clear reason — don't silently weaken assertions.\n- **A passing test you wrote before the implementation is not TDD.** If the test\n  passed on first run, it doesn't prove your code works — it proves the test is\n  weak. Strengthen it until it fails, then implement.\n- **Match existing test patterns.** TDD is about discipline, not about introducing\n  your preferred test framework or assertion library.\n\n## Output style\n\nApply the [shared output style](..\u002Fvs-internal-shared\u002Freferences\u002Foutput-style.md)\nto every user-facing message.\n\n## Workflow\n\nDirect: emit **Next** only. Composed: return to caller.\n\n**Prev:** `\u002Fvs-debug-mode` | `\u002Fvs-build-it`\n**Next:** `\u002Fvs-roast-code`\n**Relevant:** `\u002Fvs-verify` | `\u002Fvs-eval`\n",{"name":5,"description":7,"disable-model-invocation":24},true,"master","72448991571c9e5f0e76cccf189b8522d442e6eb","skills\u002Fvs-tdd",1,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs","https:\u002F\u002Fgithub.com\u002Fvltansky","2026-11-06 18:47:54",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":24},[34,37,40],{"tool":35,"command":36},"npx","npx skills add vltansky\u002Fvs --skill vs-tdd",{"tool":38,"command":39},"bunx","bunx skills add vltansky\u002Fvs --skill vs-tdd",{"tool":41,"command":42},"pnpm","pnpm dlx skills add vltansky\u002Fvs --skill vs-tdd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002FSKILL.md",[45,51,55,61,65,69,73],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"agents\u002Fopenai.yaml","REFERENCE","参考文档",132,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Fagents\u002Fopenai.yaml",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"test\u002Ffixtures\u002Fslugify-regression\u002Fpackage.json",257,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ffixtures\u002Fslugify-regression\u002Fpackage.json",{"path":56,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":59,"sourceHtmlUrl":60},"test\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Findex.ts","SCRIPT","脚本",37,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Findex.ts",{"path":62,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":63,"sourceHtmlUrl":64},"test\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Fslugify.test.ts",295,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Fslugify.test.ts",{"path":66,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":67,"sourceHtmlUrl":68},"test\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Fslugify.ts",198,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ffixtures\u002Fslugify-regression\u002Fsrc\u002Fslugify.ts",{"path":70,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":71,"sourceHtmlUrl":72},"test\u002Ffixtures\u002Fslugify-regression\u002Ftsconfig.json",227,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ffixtures\u002Fslugify-regression\u002Ftsconfig.json",{"path":74,"resourceType":57,"resourceTypeDesc":58,"sizeBytes":75,"sourceHtmlUrl":76},"test\u002Ftdd.eval.ts",6770,"https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-tdd\u002Ftest\u002Ftdd.eval.ts",[78,85,91,96,103,108],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M77XSKWFMPKFXM0311QKEJHH","vs-write","Use when asked to write, rewrite, edit, tighten, simplify, or polish prose for clarity, or to put text in STE, ASD-STE100, or controlled language. Produces plain, direct, accessible copy without losing substance or precision.","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-write\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"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":88,"categories":89,"keywords":90,"publishedAt":19},"01M77XSJNX2V560HSKQKQD67KP","vs-fake-verify","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-verify\u002Ftest\u002Ffixtures\u002Fpath-end-state\u002Fstub-rejector\u002FSKILL.md",[],[],{"skillNo":92,"name":87,"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":93,"categories":94,"keywords":95,"publishedAt":19},"01M77XSHHBEMMYZ6B4PD384NZH","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-verify\u002Ftest\u002Ffixtures\u002Fpath-end-state\u002Fstructure-paste\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M77XSE2Y7MW0KP3DTFNEE2E8","vs-verify","Use when asked to verify, prove it works, check completion, or before claiming done. Produces evidence-backed PASS\u002FWARN\u002FFAIL status.","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-verify\u002Ftest\u002Ffixtures\u002Fpath-end-state\u002Fpublished-pair\u002FSKILL.md",[],[],{"skillNo":104,"name":87,"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":105,"categories":106,"keywords":107,"publishedAt":19},"01M77XSAXFQXNE6VCRC7275Z0X","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-verify\u002Ftest\u002Ffixtures\u002Fpath-end-state\u002Fphrase-complete-beside\u002FSKILL.md",[],[],{"skillNo":109,"name":98,"nameZh":6,"description":99,"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":19},"01M77XS6R0E9X1E5KKSS00WYSS","https:\u002F\u002Fgithub.com\u002Fvltansky\u002Fvs\u002Fblob\u002Fmaster\u002Fskills\u002Fvs-verify\u002FSKILL.md",[],[]]