[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ZYHRD5N4YEXSD0535RA79":3,"skill-same:01M79ZYHRD5N4YEXSD0535RA79":79},{"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":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M79ZYHRD5N4YEXSD0535RA79","go-testing",null,"Use when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff. Also use when a user asks to write a test for a Go function, even if they don't mention specific patterns like table-driven tests or subtests. Does not cover benchmark performance testing (see go-performance).","kongnakornna\u002Fgolangapi","kongnakornna","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10528904?v=4","01M79Z5JQPPV5CWQHXS235Q9MD","Kongnakorn Jantakun","01M79Z5JRHJJJ6PR2DGQS4P985",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-testing\ndescription: Use when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff. Also use when a user asks to write a test for a Go function, even if they don't mention specific patterns like table-driven tests or subtests. Does not cover benchmark performance testing (see go-performance).\nallowed-tools: Bash(bash:*)\n---\n\n# Go Testing\n\n> Compatibility: Diff examples may use `github.com\u002Fgoogle\u002Fgo-cmp`.\n\n## Resource Routing\n\n- `scripts\u002Fgen-table-test.sh` - Run when generating a table-driven test scaffold.\n- `assets\u002Ftable-test-template.go` - Use as a copyable table-test starting point.\n- `references\u002FTABLE-DRIVEN-TESTS.md` - Read when choosing table tests, subtests, or parallel test patterns.\n- `references\u002FTEST-HELPERS.md` - Read when writing helpers, fixtures, cleanup, or test doubles.\n- `references\u002FTEST-ORGANIZATION.md` - Read when structuring packages, black-box tests, or larger test suites.\n- `references\u002FVALIDATION-APIS.md` - Read when choosing `t.Error`, `t.Fatal`, `cmp.Diff`, or assertion style.\n- `references\u002FINTEGRATION.md` - Read when testing external services, HTTP handlers, databases, or long-running setup.\n\n## Quick Reference\n\n| Pattern | Use When |\n|---------|----------|\n| `t.Error` | Default — report failure, keep running |\n| `t.Fatal` | Setup failed or continuing is meaningless |\n| `cmp.Diff` | Comparing structs, slices, maps, protos |\n| Table-driven | Many cases share identical logic |\n| Subtests | Need filtering, parallel execution, or naming |\n| `t.Helper()` | Any test helper function (call as first statement) |\n| `t.Cleanup()` | Teardown in helpers instead of defer |\n\n---\n\n## Useful Test Failures\n\n> **Normative**: Test failures must be diagnosable without reading the test\n> source.\n\nEvery failure message must include: function name, inputs, actual (got), and\nexpected (want). Use the format `YourFunc(%v) = %v, want %v`.\n\n```go\n\u002F\u002F Good:\nt.Errorf(\"Add(2, 3) = %d, want %d\", got, 5)\n\n\u002F\u002F Bad: Missing function name and inputs\nt.Errorf(\"got %d, want %d\", got, 5)\n```\n\nAlways print got before want: `got %v, want %v` — never reversed.\n\n---\n\n## No Assertion Libraries\n\n> **Normative**: Do not use assertion libraries. Use `cmp.Diff` for complex\n> comparisons.\n\n```go\nif diff := cmp.Diff(want, got); diff != \"\" {\n    t.Errorf(\"GetPost() mismatch (-want +got):\\n%s\", diff)\n}\n```\n\nFor protocol buffers, add `protocmp.Transform()` as a cmp option. Always\ninclude the direction key `(-want +got)` in diff messages. Avoid comparing\nJSON\u002Fserialized output — compare semantically instead.\n\n---\n\n## t.Error vs t.Fatal\n\n> **Normative**: Use `t.Error` by default to report all failures in one run.\n> Use `t.Fatal` only when continuing is impossible.\n\n**Choose `t.Fatal` when:**\n- Setup fails (DB connection, file load)\n- The next assertion depends on the previous one succeeding (e.g., decode after\n  encode)\n\n**Never call `t.Fatal`\u002F`t.FailNow` from a goroutine** other than the test\ngoroutine — use `t.Error` instead.\n\n---\n\n## Table-Driven Tests\n\n> See `assets\u002Ftable-test-template.go` when scaffolding a new table-driven test and need the canonical struct, loop, and subtest layout.\n\n> **Advisory**: Use table-driven tests when many cases share identical logic.\n\n**Use table tests when:** all cases run the same code path with no conditional\nsetup, mocking, or assertions. A single `shouldErr` bool is acceptable.\n\n**Don't use table tests when:** cases need complex setup, conditional mocking,\nor multiple branches — write separate test functions instead.\n\n**Key rules:**\n- Use field names when cases span many lines or have same-type adjacent fields\n- Include inputs in failure messages — never identify rows by index\n\n> **Validation**: After generating or modifying tests, run `go test -run TestXxx -v` to verify the tests compile and pass. Fix any compilation errors before proceeding.\n\n---\n\n## Test Helpers\n\n> **Normative**: Test helpers must call `t.Helper()` first and use `t.Cleanup()`\n> for teardown.\n\n```go\nfunc setupTestDB(t *testing.T) *sql.DB {\n    t.Helper()\n    db, err := sql.Open(\"sqlite3\", \":memory:\")\n    if err != nil {\n        t.Fatalf(\"Could not open database: %v\", err)\n    }\n    t.Cleanup(func() { db.Close() })\n    return db\n}\n```\n\n---\n\n## Test Error Semantics\n\n> **Advisory**: Test error semantics, not error message strings.\n\n```go\n\u002F\u002F Bad: Brittle string comparison\nif err.Error() != \"invalid input\" { ... }\n\n\u002F\u002F Good: Semantic check\nif !errors.Is(err, ErrInvalidInput) { ... }\n```\n\nFor simple presence checks when specific semantics don't matter:\n\n```go\nif gotErr := err != nil; gotErr != tt.wantErr {\n    t.Errorf(\"f(%v) error = %v, want error presence = %t\", tt.input, err, tt.wantErr)\n}\n```\n\n---\n\n## Related Skills\n\n- **Error testing**: See [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) when testing error semantics with `errors.Is`\u002F`errors.As` or sentinel errors\n- **Interface mocking**: See [go-interfaces](..\u002Fgo-interfaces\u002FSKILL.md) when creating test doubles by implementing interfaces at the consumer side\n- **Naming test functions**: See [go-naming](..\u002Fgo-naming\u002FSKILL.md) when naming test functions, subtests, or test helper utilities\n- **Linter integration**: See [go-linting](..\u002Fgo-linting\u002FSKILL.md) when running linters alongside tests in CI or pre-commit hooks\n","# Go Testing\n\n> Compatibility: Diff examples may use `github.com\u002Fgoogle\u002Fgo-cmp`.\n\n## Resource Routing\n\n- `scripts\u002Fgen-table-test.sh` - Run when generating a table-driven test scaffold.\n- `assets\u002Ftable-test-template.go` - Use as a copyable table-test starting point.\n- `references\u002FTABLE-DRIVEN-TESTS.md` - Read when choosing table tests, subtests, or parallel test patterns.\n- `references\u002FTEST-HELPERS.md` - Read when writing helpers, fixtures, cleanup, or test doubles.\n- `references\u002FTEST-ORGANIZATION.md` - Read when structuring packages, black-box tests, or larger test suites.\n- `references\u002FVALIDATION-APIS.md` - Read when choosing `t.Error`, `t.Fatal`, `cmp.Diff`, or assertion style.\n- `references\u002FINTEGRATION.md` - Read when testing external services, HTTP handlers, databases, or long-running setup.\n\n## Quick Reference\n\n| Pattern | Use When |\n|---------|----------|\n| `t.Error` | Default — report failure, keep running |\n| `t.Fatal` | Setup failed or continuing is meaningless |\n| `cmp.Diff` | Comparing structs, slices, maps, protos |\n| Table-driven | Many cases share identical logic |\n| Subtests | Need filtering, parallel execution, or naming |\n| `t.Helper()` | Any test helper function (call as first statement) |\n| `t.Cleanup()` | Teardown in helpers instead of defer |\n\n---\n\n## Useful Test Failures\n\n> **Normative**: Test failures must be diagnosable without reading the test\n> source.\n\nEvery failure message must include: function name, inputs, actual (got), and\nexpected (want). Use the format `YourFunc(%v) = %v, want %v`.\n\n```go\n\u002F\u002F Good:\nt.Errorf(\"Add(2, 3) = %d, want %d\", got, 5)\n\n\u002F\u002F Bad: Missing function name and inputs\nt.Errorf(\"got %d, want %d\", got, 5)\n```\n\nAlways print got before want: `got %v, want %v` — never reversed.\n\n---\n\n## No Assertion Libraries\n\n> **Normative**: Do not use assertion libraries. Use `cmp.Diff` for complex\n> comparisons.\n\n```go\nif diff := cmp.Diff(want, got); diff != \"\" {\n    t.Errorf(\"GetPost() mismatch (-want +got):\\n%s\", diff)\n}\n```\n\nFor protocol buffers, add `protocmp.Transform()` as a cmp option. Always\ninclude the direction key `(-want +got)` in diff messages. Avoid comparing\nJSON\u002Fserialized output — compare semantically instead.\n\n---\n\n## t.Error vs t.Fatal\n\n> **Normative**: Use `t.Error` by default to report all failures in one run.\n> Use `t.Fatal` only when continuing is impossible.\n\n**Choose `t.Fatal` when:**\n- Setup fails (DB connection, file load)\n- The next assertion depends on the previous one succeeding (e.g., decode after\n  encode)\n\n**Never call `t.Fatal`\u002F`t.FailNow` from a goroutine** other than the test\ngoroutine — use `t.Error` instead.\n\n---\n\n## Table-Driven Tests\n\n> See `assets\u002Ftable-test-template.go` when scaffolding a new table-driven test and need the canonical struct, loop, and subtest layout.\n\n> **Advisory**: Use table-driven tests when many cases share identical logic.\n\n**Use table tests when:** all cases run the same code path with no conditional\nsetup, mocking, or assertions. A single `shouldErr` bool is acceptable.\n\n**Don't use table tests when:** cases need complex setup, conditional mocking,\nor multiple branches — write separate test functions instead.\n\n**Key rules:**\n- Use field names when cases span many lines or have same-type adjacent fields\n- Include inputs in failure messages — never identify rows by index\n\n> **Validation**: After generating or modifying tests, run `go test -run TestXxx -v` to verify the tests compile and pass. Fix any compilation errors before proceeding.\n\n---\n\n## Test Helpers\n\n> **Normative**: Test helpers must call `t.Helper()` first and use `t.Cleanup()`\n> for teardown.\n\n```go\nfunc setupTestDB(t *testing.T) *sql.DB {\n    t.Helper()\n    db, err := sql.Open(\"sqlite3\", \":memory:\")\n    if err != nil {\n        t.Fatalf(\"Could not open database: %v\", err)\n    }\n    t.Cleanup(func() { db.Close() })\n    return db\n}\n```\n\n---\n\n## Test Error Semantics\n\n> **Advisory**: Test error semantics, not error message strings.\n\n```go\n\u002F\u002F Bad: Brittle string comparison\nif err.Error() != \"invalid input\" { ... }\n\n\u002F\u002F Good: Semantic check\nif !errors.Is(err, ErrInvalidInput) { ... }\n```\n\nFor simple presence checks when specific semantics don't matter:\n\n```go\nif gotErr := err != nil; gotErr != tt.wantErr {\n    t.Errorf(\"f(%v) error = %v, want error presence = %t\", tt.input, err, tt.wantErr)\n}\n```\n\n---\n\n## Related Skills\n\n- **Error testing**: See [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) when testing error semantics with `errors.Is`\u002F`errors.As` or sentinel errors\n- **Interface mocking**: See [go-interfaces](..\u002Fgo-interfaces\u002FSKILL.md) when creating test doubles by implementing interfaces at the consumer side\n- **Naming test functions**: See [go-naming](..\u002Fgo-naming\u002FSKILL.md) when naming test functions, subtests, or test helper utilities\n- **Linter integration**: See [go-linting](..\u002Fgo-linting\u002FSKILL.md) when running linters alongside tests in CI or pre-commit hooks\n",{"name":5,"description":7,"allowed-tools":24},"Bash(bash:*)","main","19f4d52a98d557f3a645a2cfbbeb5bd54f28831d",".github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi","https:\u002F\u002Fgithub.com\u002Fkongnakornna","http:\u002F\u002Fcmoniot.trueddns.com:52160","Technical Skills and Expertise\r\nLanguages and Frameworks\r\nFrontend: HTML, JavaScript, TypeScript, React, Vue, Angular, Next.js\r\nBackend: Node.js,Python,Golang","2026-10-06 23:01:46",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add kongnakornna\u002Fgolangapi --skill go-testing",{"tool":39,"command":40},"bunx","bunx skills add kongnakornna\u002Fgolangapi --skill go-testing",{"tool":42,"command":43},"pnpm","pnpm dlx skills add kongnakornna\u002Fgolangapi --skill go-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002FSKILL.md",true,[47,53,59,63,67,71,75],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"assets\u002Ftable-test-template.go","SCRIPT","脚本",677,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Fassets\u002Ftable-test-template.go",{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002FINTEGRATION.md","REFERENCE","参考文档",4262,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Freferences\u002FINTEGRATION.md",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002FTABLE-DRIVEN-TESTS.md",3888,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Freferences\u002FTABLE-DRIVEN-TESTS.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002FTEST-HELPERS.md",3665,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Freferences\u002FTEST-HELPERS.md",{"path":68,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002FTEST-ORGANIZATION.md",4612,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Freferences\u002FTEST-ORGANIZATION.md",{"path":72,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002FVALIDATION-APIS.md",3490,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Freferences\u002FVALIDATION-APIS.md",{"path":76,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":77,"sourceHtmlUrl":78},"scripts\u002Fgen-table-test.sh",4798,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-testing\u002Fscripts\u002Fgen-table-test.sh",[80,87,94,101,108,115],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7A0M9RJJ3383VEFYKABWV15","tb-writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-writing-plans\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7A0M4JKY4DEDRP1CBHT00WV","tb-using-git-worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-using-git-worktrees\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7A0KZ5HRAQAAT2KXR6146Q7","tb-test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-test-driven-development\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"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},"01M7A0KW92W3F18E2MRP8H62P2","tb-subagent-driven-development","Use when executing implementation plans with independent tasks in the current session","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-subagent-driven-development\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7A0KKYQCHYYRHA5J5BAP24M","tb-scrutinize","Outsider-perspective end-to-end review of a plan, PR, or code change. First questions intent and whether a simpler\u002Fmore elegant approach would achieve the same goal, then traces the actual code path (not just the diff) to verify the change does what it claims. Output is concise, actionable, and every call carries its rationale. Trigger on \u002Ftb-scrutinize and proactively whenever the user asks to review, audit, sanity-check, or get a second opinion on a plan, PR, diff, design doc, or proposed code change.","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-scrutinize\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"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":19},"01M7A0KFDR1V3RW7SW1XNHP82P","tb-requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-requesting-code-review\u002FSKILL.md",[],[]]