[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BQC617QD9ESG024XFS3TEE":3,"skill-same:01M7BQC617QD9ESG024XFS3TEE":51},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7BQC617QD9ESG024XFS3TEE","go-context",null,"Use when handling Go context.Context, cancellation, deadlines, timeouts, or request-scoped values and parameter placement. Goroutine lifecycle and synchronization belong to go-concurrency.","h0rn3t\u002Fgolang-skills","h0rn3t","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1213719?v=4","01M7BQBDJ8D4P5W7EQHBD464BX","Eugene Shershen","01M7BQBDJXMTCKNCEDKVEYDRGA",7,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-context\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-context\ndescription: Use when handling Go context.Context, cancellation, deadlines, timeouts, or request-scoped values and parameter placement. Goroutine lifecycle and synchronization belong to go-concurrency.\n---\n\n# Go Context Usage\n\n> Compatibility: Baseline Go 1.27 (see [COMPATIBILITY.md](..\u002Fgo-style-core\u002Freferences\u002FCOMPATIBILITY.md)).\n> `context.WithoutCancel`, `context.AfterFunc`, `context.WithTimeoutCause` and\n> `context.WithDeadlineCause` require Go 1.21+;\n> `t.Context()` in tests, Go 1.24+.\n\n## Resource Routing\n\n- `references\u002FPATTERNS.md` - Read when deriving contexts, checking cancellation, handling HTTP request contexts, or using typed context-value keys.\n\n## Context as First Parameter\n\nFunctions that use a Context accept it as their **first parameter**. Do not\nadd a Context member to a struct type (`containedctx` in the gate reports it);\npass `ctx` to each method that needs it. **Exception**: methods whose signature must match an interface in the\nstandard library or a third-party library. Do not create custom Context types\nor use interfaces other than `context.Context` in function signatures.\n\n---\n\n## Where to Put Application Data\n\nParameters first, then the receiver, then a global; a context value carries\nonly request-scoped data that crosses APIs — a request or trace ID, the\nauthenticated principal — never an optional parameter, per-process\nconfiguration, or a deadline, which is derived with `WithTimeout`,\n`WithDeadline`, or `WithCancel`.\n\n---\n\n## Common Patterns\n\n### Deriving Contexts\n\n`defer cancel()` immediately after creating a derived context. Inside a loop a\n`defer` waits for the function to return, so every iteration's context stays\nlive until then: cancel at the end of each iteration, or move the iteration\ninto its own function that defers `cancel()`.\n\n```go\nctx, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\n\nfor _, item := range items {\n    itemCtx, cancelItem := context.WithTimeout(ctx, time.Second)\n    err := send(itemCtx, item)\n    cancelItem() \u002F\u002F per iteration, not deferred\n    if err != nil {\n        return err\n    }\n}\n```\n\n### Cancellation With a Reason\n\nWith `context.WithCancelCause`, `WithTimeoutCause`, or `WithDeadlineCause`,\n`ctx.Err()` still returns `Canceled` or `DeadlineExceeded`; only\n`context.Cause(ctx)` returns the reason supplied, so a caller that must tell\nthis cancellation or timeout from an upstream one reads `Cause`.\n`WithCancelCause` returns a `CancelCauseFunc`, released on the success path\nwith `defer cancel(nil)`; `WithTimeoutCause` and `WithDeadlineCause` return a\nplain `CancelFunc` (`defer cancel()`), and their cause is set only when the\ntimer fires.\n\n`context.WithoutCancel(ctx)` keeps the values but drops cancellation; use it\nfor work that must outlive the request (audit log, cleanup) and give that work\nits own timeout.\n\n---\n\n## Related Skills\n\n- [go-resilience](..\u002Fgo-resilience\u002FSKILL.md): total and attempt time budgets, cancellation-aware backoff, durable retry ownership.\n- [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md): goroutine cancellation, select timeouts, errgroup.\n- Returning `ctx.Err()` or `context.Cause(ctx)`: [Cancellation With a Reason](#cancellation-with-a-reason) above.\n- [go-interfaces](..\u002Fgo-interfaces\u002FSKILL.md): APIs that take context alongside interfaces.\n- [go-logging](..\u002Fgo-logging\u002FSKILL.md): loggers and request IDs carried in context.\n","# Go Context Usage\n\n> Compatibility: Baseline Go 1.27 (see [COMPATIBILITY.md](..\u002Fgo-style-core\u002Freferences\u002FCOMPATIBILITY.md)).\n> `context.WithoutCancel`, `context.AfterFunc`, `context.WithTimeoutCause` and\n> `context.WithDeadlineCause` require Go 1.21+;\n> `t.Context()` in tests, Go 1.24+.\n\n## Resource Routing\n\n- `references\u002FPATTERNS.md` - Read when deriving contexts, checking cancellation, handling HTTP request contexts, or using typed context-value keys.\n\n## Context as First Parameter\n\nFunctions that use a Context accept it as their **first parameter**. Do not\nadd a Context member to a struct type (`containedctx` in the gate reports it);\npass `ctx` to each method that needs it. **Exception**: methods whose signature must match an interface in the\nstandard library or a third-party library. Do not create custom Context types\nor use interfaces other than `context.Context` in function signatures.\n\n---\n\n## Where to Put Application Data\n\nParameters first, then the receiver, then a global; a context value carries\nonly request-scoped data that crosses APIs — a request or trace ID, the\nauthenticated principal — never an optional parameter, per-process\nconfiguration, or a deadline, which is derived with `WithTimeout`,\n`WithDeadline`, or `WithCancel`.\n\n---\n\n## Common Patterns\n\n### Deriving Contexts\n\n`defer cancel()` immediately after creating a derived context. Inside a loop a\n`defer` waits for the function to return, so every iteration's context stays\nlive until then: cancel at the end of each iteration, or move the iteration\ninto its own function that defers `cancel()`.\n\n```go\nctx, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\n\nfor _, item := range items {\n    itemCtx, cancelItem := context.WithTimeout(ctx, time.Second)\n    err := send(itemCtx, item)\n    cancelItem() \u002F\u002F per iteration, not deferred\n    if err != nil {\n        return err\n    }\n}\n```\n\n### Cancellation With a Reason\n\nWith `context.WithCancelCause`, `WithTimeoutCause`, or `WithDeadlineCause`,\n`ctx.Err()` still returns `Canceled` or `DeadlineExceeded`; only\n`context.Cause(ctx)` returns the reason supplied, so a caller that must tell\nthis cancellation or timeout from an upstream one reads `Cause`.\n`WithCancelCause` returns a `CancelCauseFunc`, released on the success path\nwith `defer cancel(nil)`; `WithTimeoutCause` and `WithDeadlineCause` return a\nplain `CancelFunc` (`defer cancel()`), and their cause is set only when the\ntimer fires.\n\n`context.WithoutCancel(ctx)` keeps the values but drops cancellation; use it\nfor work that must outlive the request (audit log, cleanup) and give that work\nits own timeout.\n\n---\n\n## Related Skills\n\n- [go-resilience](..\u002Fgo-resilience\u002FSKILL.md): total and attempt time budgets, cancellation-aware backoff, durable retry ownership.\n- [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md): goroutine cancellation, select timeouts, errgroup.\n- Returning `ctx.Err()` or `context.Cause(ctx)`: [Cancellation With a Reason](#cancellation-with-a-reason) above.\n- [go-interfaces](..\u002Fgo-interfaces\u002FSKILL.md): APIs that take context alongside interfaces.\n- [go-logging](..\u002Fgo-logging\u002FSKILL.md): loggers and request IDs carried in context.\n",{"name":5,"description":7},"main","59ac8ac7a0dd394878aaa0a7a7ecbc227356739f","skills\u002Fgo-context",2,"https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills","https:\u002F\u002Fgithub.com\u002Fh0rn3t","2026-11-14 04:23:12",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add h0rn3t\u002Fgolang-skills --skill go-context",{"tool":37,"command":38},"bunx","bunx skills add h0rn3t\u002Fgolang-skills --skill go-context",{"tool":40,"command":41},"pnpm","pnpm dlx skills add h0rn3t\u002Fgolang-skills --skill go-context","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-context\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002FPATTERNS.md","REFERENCE","参考文档",9202,"https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-context\u002Freferences\u002FPATTERNS.md",[52,59,66,73,80,87],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7BQEMJBPJWY6CCGVKW27SH0","go-troubleshooting","Use when investigating a bug or ticket in a Go service whose cause is unknown — wrong or missing results, tenant-specific behavior, a regression, stage\u002Fprod\u002FCI differences, a panic, hang, deadlock, leak, unexplained CPU\u002FRSS growth, or a flaky test. Also use for pasted stack traces, profiles, logs, or requests to find a Go issue's root cause, even without the word debug. Does not cover rewriting ticket text, implementing an already-diagnosed fix alone (use its topic skill), or optimizing a known bottleneck (see go-performance).","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-troubleshooting\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7BQEFVSRHNDND750SB69WD8","go-testing","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).","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-testing\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7BQEA2DRH6H6WFYNJYJJRQQ","go-style-core","Use when resolving Go style or language mechanics such as formatting, nesting, declarations, initialization, scope, shadowing, loops, switches, or enum zero values. API design, naming, errors, and tests have specialized skills.","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-style-core\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7BQE3D1H45ANCXAWCS55CDK","go-security","Use when writing or reviewing Go code that touches untrusted input, secrets, or credentials — SQL, shell, or template injection, path traversal, SSRF, cookies and security headers, password hashing, TLS settings, token comparison, or what may appear in a log line. Also use when a handler accepts a file name, URL, or command argument from a client, or when asked to find \"vulnerabilities\", even if the user never says \"security\". Does not cover the os.Root and crypto\u002Frand mechanics (see go-defensive) or the dependency CVE scan in the gate (see go-linting).","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-security\u002FSKILL.md",[],[],{"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},"01M7BQDZYHG2YRJA3J26HFPKR7","go-resilience","Use when handling Go dependency failures or overload with retries, backoff\u002Fjitter, budgets, idempotency, duplicate delivery, circuit breakers, bulkheads, rate limits, backpressure, or degradation. Unknown root causes belong to go-troubleshooting.","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-resilience\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},"01M7BQDVG7DH2G9Z97Y8H3P3E9","go-performance","Use when optimizing slow or performance-critical Go code, allocations, string concatenation in loops, or benchmarks. Also use when writing or reviewing a cache, including implementing one from a stub — its key, its expiry, and how a miss loads. Concurrent code patterns belong to go-concurrency.","https:\u002F\u002Fgithub.com\u002Fh0rn3t\u002Fgolang-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgo-performance\u002FSKILL.md",[],[]]