[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72WXCCPKMFH7JCYW363PEFG":3,"skill-same:01M72WXCCPKMFH7JCYW363PEFG":54},{"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":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":37,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M72WXCCPKMFH7JCYW363PEFG","golang-testing",null,"Go testing best practices including table-driven tests, test helpers, benchmarking, race detection, coverage analysis, and integration testing patterns. Use when writing or improving Go tests.","SriramGandhiS\u002FSkills","SriramGandhiS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211849986?v=4","01M72WQCW12BYX71C6WN584TTA","Sriram S","01M72WQCWTJ2RD0ET1X31AF1RC",1,"MIT","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002F.kiro\u002Fskills\u002Fgolang-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: golang-testing\ndescription: >\n  Go testing best practices including table-driven tests, test helpers,\n  benchmarking, race detection, coverage analysis, and integration testing\n  patterns. Use when writing or improving Go tests.\nmetadata:\n  origin: ECC\n  globs: [\"**\u002F*.go\", \"**\u002Fgo.mod\", \"**\u002Fgo.sum\"]\n---\n\n# Go Testing\n\n> This skill provides comprehensive Go testing patterns extending common testing principles with Go-specific idioms.\n\n## Testing Framework\n\nUse the standard `go test` with **table-driven tests** as the primary pattern.\n\n### Table-Driven Tests\n\nThe idiomatic Go testing pattern:\n\n```go\nfunc TestValidateEmail(t *testing.T) {\n    tests := []struct {\n        name    string\n        email   string\n        wantErr bool\n    }{\n        {\n            name:    \"valid email\",\n            email:   \"user@example.com\",\n            wantErr: false,\n        },\n        {\n            name:    \"missing @\",\n            email:   \"userexample.com\",\n            wantErr: true,\n        },\n        {\n            name:    \"empty string\",\n            email:   \"\",\n            wantErr: true,\n        },\n    }\n\n    for _, tt := range tests {\n        t.Run(tt.name, func(t *testing.T) {\n            err := ValidateEmail(tt.email)\n            if (err != nil) != tt.wantErr {\n                t.Errorf(\"ValidateEmail(%q) error = %v, wantErr %v\",\n                    tt.email, err, tt.wantErr)\n            }\n        })\n    }\n}\n```\n\n**Benefits:**\n- Easy to add new test cases\n- Clear test case documentation\n- Parallel test execution with `t.Parallel()`\n- Isolated subtests with `t.Run()`\n\n## Test Helpers\n\nUse `t.Helper()` to mark helper functions:\n\n```go\nfunc assertNoError(t *testing.T, err error) {\n    t.Helper()\n    if err != nil {\n        t.Fatalf(\"unexpected error: %v\", err)\n    }\n}\n\nfunc assertEqual(t *testing.T, got, want interface{}) {\n    t.Helper()\n    if !reflect.DeepEqual(got, want) {\n        t.Errorf(\"got %v, want %v\", got, want)\n    }\n}\n```\n\n**Benefits:**\n- Correct line numbers in test failures\n- Reusable test utilities\n- Cleaner test code\n\n## Test Fixtures\n\nUse `t.Cleanup()` for resource cleanup:\n\n```go\nfunc testDB(t *testing.T) *sql.DB {\n    t.Helper()\n\n    db, err := sql.Open(\"sqlite3\", \":memory:\")\n    if err != nil {\n        t.Fatalf(\"failed to open test db: %v\", err)\n    }\n\n    \u002F\u002F Cleanup runs after test completes\n    t.Cleanup(func() {\n        if err := db.Close(); err != nil {\n            t.Errorf(\"failed to close db: %v\", err)\n        }\n    })\n\n    return db\n}\n\nfunc TestUserRepository(t *testing.T) {\n    db := testDB(t)\n    repo := NewUserRepository(db)\n    \u002F\u002F ... test logic\n}\n```\n\n## Race Detection\n\nAlways run tests with the `-race` flag to detect data races:\n\n```bash\ngo test -race .\u002F...\n```\n\n**In CI\u002FCD:**\n```yaml\n- name: Test with race detector\n  run: go test -race -timeout 5m .\u002F...\n```\n\n**Why:**\n- Detects concurrent access bugs\n- Prevents production race conditions\n- Minimal performance overhead in tests\n\n## Coverage Analysis\n\n### Basic Coverage\n\n```bash\ngo test -cover .\u002F...\n```\n\n### Detailed Coverage Report\n\n```bash\ngo test -coverprofile=coverage.out .\u002F...\ngo tool cover -html=coverage.out\n```\n\n### Coverage Thresholds\n\n```bash\n# Fail if coverage below 80%\ngo test -cover .\u002F... | grep -E 'coverage: [0-7][0-9]\\.[0-9]%' && exit 1\n```\n\n## Benchmarking\n\n```go\nfunc BenchmarkValidateEmail(b *testing.B) {\n    email := \"user@example.com\"\n\n    b.ResetTimer()\n    for i := 0; i \u003C b.N; i++ {\n        ValidateEmail(email)\n    }\n}\n```\n\n**Run benchmarks:**\n```bash\ngo test -bench=. -benchmem\n```\n\n**Compare benchmarks:**\n```bash\ngo test -bench=. -benchmem > old.txt\n# make changes\ngo test -bench=. -benchmem > new.txt\nbenchstat old.txt new.txt\n```\n\n## Mocking\n\n### Interface-Based Mocking\n\n```go\ntype UserRepository interface {\n    GetUser(id string) (*User, error)\n}\n\ntype mockUserRepository struct {\n    users map[string]*User\n    err   error\n}\n\nfunc (m *mockUserRepository) GetUser(id string) (*User, error) {\n    if m.err != nil {\n        return nil, m.err\n    }\n    return m.users[id], nil\n}\n\nfunc TestUserService(t *testing.T) {\n    mock := &mockUserRepository{\n        users: map[string]*User{\n            \"1\": {ID: \"1\", Name: \"Alice\"},\n        },\n    }\n\n    service := NewUserService(mock)\n    \u002F\u002F ... test logic\n}\n```\n\n## Integration Tests\n\n### Build Tags\n\n```go\n\u002F\u002Fgo:build integration\n\u002F\u002F +build integration\n\npackage user_test\n\nfunc TestUserRepository_Integration(t *testing.T) {\n    \u002F\u002F ... integration test\n}\n```\n\n**Run integration tests:**\n```bash\ngo test -tags=integration .\u002F...\n```\n\n### Test Containers\n\n```go\nfunc TestWithPostgres(t *testing.T) {\n    if testing.Short() {\n        t.Skip(\"skipping integration test\")\n    }\n\n    \u002F\u002F Setup test container\n    ctx := context.Background()\n    container, err := testcontainers.GenericContainer(ctx, ...)\n    assertNoError(t, err)\n\n    t.Cleanup(func() {\n        container.Terminate(ctx)\n    })\n\n    \u002F\u002F ... test logic\n}\n```\n\n## Test Organization\n\n### File Structure\n\n```\npackage\u002F\n├── user.go\n├── user_test.go          # Unit tests\n├── user_integration_test.go  # Integration tests\n└── testdata\u002F             # Test fixtures\n    └── users.json\n```\n\n### Package Naming\n\n```go\n\u002F\u002F Black-box testing (external perspective)\npackage user_test\n\n\u002F\u002F White-box testing (internal access)\npackage user\n```\n\n## Common Patterns\n\n### Testing HTTP Handlers\n\n```go\nfunc TestUserHandler(t *testing.T) {\n    req := httptest.NewRequest(\"GET\", \"\u002Fusers\u002F1\", nil)\n    rec := httptest.NewRecorder()\n\n    handler := NewUserHandler(mockRepo)\n    handler.ServeHTTP(rec, req)\n\n    assertEqual(t, rec.Code, http.StatusOK)\n}\n```\n\n### Testing with Context\n\n```go\nfunc TestWithTimeout(t *testing.T) {\n    ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)\n    defer cancel()\n\n    err := SlowOperation(ctx)\n    if !errors.Is(err, context.DeadlineExceeded) {\n        t.Errorf(\"expected timeout error, got %v\", err)\n    }\n}\n```\n\n## Best Practices\n\n1. **Use `t.Parallel()`** for independent tests\n2. **Use `testing.Short()`** to skip slow tests\n3. **Use `t.TempDir()`** for temporary directories\n4. **Use `t.Setenv()`** for environment variables\n5. **Avoid `init()`** in test files\n6. **Keep tests focused** - one behavior per test\n7. **Use meaningful test names** - describe what's being tested\n\n## When to Use This Skill\n\n- Writing new Go tests\n- Improving test coverage\n- Setting up test infrastructure\n- Debugging flaky tests\n- Optimizing test performance\n- Implementing integration tests\n","# Go Testing\n\n> This skill provides comprehensive Go testing patterns extending common testing principles with Go-specific idioms.\n\n## Testing Framework\n\nUse the standard `go test` with **table-driven tests** as the primary pattern.\n\n### Table-Driven Tests\n\nThe idiomatic Go testing pattern:\n\n```go\nfunc TestValidateEmail(t *testing.T) {\n    tests := []struct {\n        name    string\n        email   string\n        wantErr bool\n    }{\n        {\n            name:    \"valid email\",\n            email:   \"user@example.com\",\n            wantErr: false,\n        },\n        {\n            name:    \"missing @\",\n            email:   \"userexample.com\",\n            wantErr: true,\n        },\n        {\n            name:    \"empty string\",\n            email:   \"\",\n            wantErr: true,\n        },\n    }\n\n    for _, tt := range tests {\n        t.Run(tt.name, func(t *testing.T) {\n            err := ValidateEmail(tt.email)\n            if (err != nil) != tt.wantErr {\n                t.Errorf(\"ValidateEmail(%q) error = %v, wantErr %v\",\n                    tt.email, err, tt.wantErr)\n            }\n        })\n    }\n}\n```\n\n**Benefits:**\n- Easy to add new test cases\n- Clear test case documentation\n- Parallel test execution with `t.Parallel()`\n- Isolated subtests with `t.Run()`\n\n## Test Helpers\n\nUse `t.Helper()` to mark helper functions:\n\n```go\nfunc assertNoError(t *testing.T, err error) {\n    t.Helper()\n    if err != nil {\n        t.Fatalf(\"unexpected error: %v\", err)\n    }\n}\n\nfunc assertEqual(t *testing.T, got, want interface{}) {\n    t.Helper()\n    if !reflect.DeepEqual(got, want) {\n        t.Errorf(\"got %v, want %v\", got, want)\n    }\n}\n```\n\n**Benefits:**\n- Correct line numbers in test failures\n- Reusable test utilities\n- Cleaner test code\n\n## Test Fixtures\n\nUse `t.Cleanup()` for resource cleanup:\n\n```go\nfunc testDB(t *testing.T) *sql.DB {\n    t.Helper()\n\n    db, err := sql.Open(\"sqlite3\", \":memory:\")\n    if err != nil {\n        t.Fatalf(\"failed to open test db: %v\", err)\n    }\n\n    \u002F\u002F Cleanup runs after test completes\n    t.Cleanup(func() {\n        if err := db.Close(); err != nil {\n            t.Errorf(\"failed to close db: %v\", err)\n        }\n    })\n\n    return db\n}\n\nfunc TestUserRepository(t *testing.T) {\n    db := testDB(t)\n    repo := NewUserRepository(db)\n    \u002F\u002F ... test logic\n}\n```\n\n## Race Detection\n\nAlways run tests with the `-race` flag to detect data races:\n\n```bash\ngo test -race .\u002F...\n```\n\n**In CI\u002FCD:**\n```yaml\n- name: Test with race detector\n  run: go test -race -timeout 5m .\u002F...\n```\n\n**Why:**\n- Detects concurrent access bugs\n- Prevents production race conditions\n- Minimal performance overhead in tests\n\n## Coverage Analysis\n\n### Basic Coverage\n\n```bash\ngo test -cover .\u002F...\n```\n\n### Detailed Coverage Report\n\n```bash\ngo test -coverprofile=coverage.out .\u002F...\ngo tool cover -html=coverage.out\n```\n\n### Coverage Thresholds\n\n```bash\n# Fail if coverage below 80%\ngo test -cover .\u002F... | grep -E 'coverage: [0-7][0-9]\\.[0-9]%' && exit 1\n```\n\n## Benchmarking\n\n```go\nfunc BenchmarkValidateEmail(b *testing.B) {\n    email := \"user@example.com\"\n\n    b.ResetTimer()\n    for i := 0; i \u003C b.N; i++ {\n        ValidateEmail(email)\n    }\n}\n```\n\n**Run benchmarks:**\n```bash\ngo test -bench=. -benchmem\n```\n\n**Compare benchmarks:**\n```bash\ngo test -bench=. -benchmem > old.txt\n# make changes\ngo test -bench=. -benchmem > new.txt\nbenchstat old.txt new.txt\n```\n\n## Mocking\n\n### Interface-Based Mocking\n\n```go\ntype UserRepository interface {\n    GetUser(id string) (*User, error)\n}\n\ntype mockUserRepository struct {\n    users map[string]*User\n    err   error\n}\n\nfunc (m *mockUserRepository) GetUser(id string) (*User, error) {\n    if m.err != nil {\n        return nil, m.err\n    }\n    return m.users[id], nil\n}\n\nfunc TestUserService(t *testing.T) {\n    mock := &mockUserRepository{\n        users: map[string]*User{\n            \"1\": {ID: \"1\", Name: \"Alice\"},\n        },\n    }\n\n    service := NewUserService(mock)\n    \u002F\u002F ... test logic\n}\n```\n\n## Integration Tests\n\n### Build Tags\n\n```go\n\u002F\u002Fgo:build integration\n\u002F\u002F +build integration\n\npackage user_test\n\nfunc TestUserRepository_Integration(t *testing.T) {\n    \u002F\u002F ... integration test\n}\n```\n\n**Run integration tests:**\n```bash\ngo test -tags=integration .\u002F...\n```\n\n### Test Containers\n\n```go\nfunc TestWithPostgres(t *testing.T) {\n    if testing.Short() {\n        t.Skip(\"skipping integration test\")\n    }\n\n    \u002F\u002F Setup test container\n    ctx := context.Background()\n    container, err := testcontainers.GenericContainer(ctx, ...)\n    assertNoError(t, err)\n\n    t.Cleanup(func() {\n        container.Terminate(ctx)\n    })\n\n    \u002F\u002F ... test logic\n}\n```\n\n## Test Organization\n\n### File Structure\n\n```\npackage\u002F\n├── user.go\n├── user_test.go          # Unit tests\n├── user_integration_test.go  # Integration tests\n└── testdata\u002F             # Test fixtures\n    └── users.json\n```\n\n### Package Naming\n\n```go\n\u002F\u002F Black-box testing (external perspective)\npackage user_test\n\n\u002F\u002F White-box testing (internal access)\npackage user\n```\n\n## Common Patterns\n\n### Testing HTTP Handlers\n\n```go\nfunc TestUserHandler(t *testing.T) {\n    req := httptest.NewRequest(\"GET\", \"\u002Fusers\u002F1\", nil)\n    rec := httptest.NewRecorder()\n\n    handler := NewUserHandler(mockRepo)\n    handler.ServeHTTP(rec, req)\n\n    assertEqual(t, rec.Code, http.StatusOK)\n}\n```\n\n### Testing with Context\n\n```go\nfunc TestWithTimeout(t *testing.T) {\n    ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)\n    defer cancel()\n\n    err := SlowOperation(ctx)\n    if !errors.Is(err, context.DeadlineExceeded) {\n        t.Errorf(\"expected timeout error, got %v\", err)\n    }\n}\n```\n\n## Best Practices\n\n1. **Use `t.Parallel()`** for independent tests\n2. **Use `testing.Short()`** to skip slow tests\n3. **Use `t.TempDir()`** for temporary directories\n4. **Use `t.Setenv()`** for environment variables\n5. **Avoid `init()`** in test files\n6. **Keep tests focused** - one behavior per test\n7. **Use meaningful test names** - describe what's being tested\n\n## When to Use This Skill\n\n- Writing new Go tests\n- Improving test coverage\n- Setting up test infrastructure\n- Debugging flaky tests\n- Optimizing test performance\n- Implementing integration tests\n",{"name":5,"metadata":24,"description":30},{"globs":25,"origin":29},[26,27,28],"**\u002F*.go","**\u002Fgo.mod","**\u002Fgo.sum","ECC","Go testing best practices including table-driven tests, test helpers, benchmarking, race detection, coverage analysis, and integration testing patterns. Use when writing or improving Go tests.\n","master","d6ca01da0f24a3b0e26e4a8b7b66cbd25d429f5d",".kiro\u002Fskills\u002Fgolang-testing",0,"https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills","https:\u002F\u002Fgithub.com\u002FSriramGandhiS","https:\u002F\u002Fsriram.website\u002F","Curious guy who keeps tinkering until something works","2026-05-20 16:21:34",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add SriramGandhiS\u002FSkills --skill golang-testing",{"tool":46,"command":47},"bunx","bunx skills add SriramGandhiS\u002FSkills --skill golang-testing",{"tool":49,"command":50},"pnpm","pnpm dlx skills add SriramGandhiS\u002FSkills --skill golang-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002F.kiro\u002Fskills\u002Fgolang-testing\u002FSKILL.md",true,[],[55,63,68,74,81,88],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":62},"01M732609EPJWV13PVTX3GT4TM","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":64,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":62},"01M7325XM47AGWB6K6C4VXKE6B","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"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":71,"categories":72,"keywords":73,"publishedAt":62},"01M7325WP6DES69JKC840VMFEP","verification-loop","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":62},"01M7325TFQF1DZTQ6J3WGQQ1VR","tdd-workflow","Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Ftdd-workflow\u002FSKILL.md",[],[],{"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":62},"01M7325RGV9AY9PK92D2V8KKPW","strategic-compact","Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fstrategic-compact\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":62},"01M7325MZC28SE86E7NMCNEFS4","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fsecurity-review\u002FSKILL.md",[],[]]