golang-context
Improve Go Context Propagation and Cancellation
Broken context propagation leaves downstream work running after requests end. This skill guides context lifecycles across Go handlers, services, and databases.
Instalar com meu Agente
Copie esta solicitação para o seu Agente. Ela inclui a página canônica do Skill e o manifesto.
Review the Skillstore skill "golang-context" from https://skillstore.io/skills/samber-golang-context.md and its manifest at https://skillstore.io/api/skills/samber-golang-context/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Seu Agente ainda deve apresentar o plano e solicitar qualquer confirmação exigida pela política de segurança.
Recursos legíveis por agentes
Use estes links quando um agente de IA, crawler ou script precisar de contexto limpo em vez de ler a página completa.
Testar
Usando "golang-context". Review a handler that creates Background before calling its repository and payment client.
Resultado esperado:
- The handler discards request cancellation by creating a new root context.
- Pass the request context through service, database, and HTTP client calls.
- Test that client cancellation reaches both downstream operations.
Usando "golang-context". Review a repository transaction that starts with Begin but uses ExecContext for its updates.
Resultado esperado:
- Transaction creation does not receive the caller context.
- Start the transaction with BeginTx and keep passing the caller context to statements.
- Retain rollback cleanup and test cancellation during transaction startup.
Usando "golang-context". Explain why an asynchronous audit event stops when its HTTP handler returns.
Resultado esperado:
- The goroutine inherits a request context that is canceled when the handler returns.
- WithoutCancel preserves request values while removing cancellation and deadlines.
- Add a finite timeout and shutdown ownership; detaching cancellation alone does not guarantee delivery.
Auditoria de segurança
Risco MédioAll 49 static findings are false positives caused by Markdown formatting, Go identifiers, metadata, or illustrative evaluation fixtures. No evidence found of prompt injection, credential theft, system reconnaissance, or unauthorized command execution. One semantic risk remains: the background audit example removes cancellation and deadlines without bounding its goroutine lifetime.
Preocupações de segurança confirmadas (1)
Fatores de risco
⚙️ Comandos externos (25)
🌐 Acesso à rede (4)
Compartilhar e citar este relatório
Compartilhe o relatório de avaliação versionado, o badge neutro, o cartão incorporável e as citações. A Skillstore apresenta evidências sem decidir se este Skill é seguro.
Copiar link do relatório
https://skillstore.io/skills/samber-golang-context/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportBadge Markdown
[](https://skillstore.io/skills/samber-golang-context?utm_source=security_passport_badge)Badge HTML
<a href="https://skillstore.io/skills/samber-golang-context?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-context/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Cartão incorporável
<iframe src="https://skillstore.io/embed/skills/samber-golang-context.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Citações acadêmicas (APA · BibTeX · CFF)
Citação APA
samber. (2026). golang-context security audit report (audit version 1) [Author version 1.3.1]. Skillstore. https://skillstore.io/skills/samber-golang-context/audits/1Citação BibTeX
@techreport{samber-samber-golang-context-2026,
author = {samber},
title = {golang-context security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-context/audits/1},
note = {Author version 1.3.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-context security audit report (audit version 1)"
version: "1.3.1"
type: report
authors:
- name: "samber"
date-released: "2026-10-15"
url: "https://skillstore.io/skills/samber-golang-context/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-context:audit:1"
description: "Skillstore immutable audit report identifier"
Pontuação do Skillstore
Por que esta pontuação Confiança das evidências: MédioO que você pode criar
Review Request Cancellation
Find context propagation breaks between handlers, services, SQL queries, and downstream HTTP requests.
Investigate Work That Outlives Requests
Review cancellation ownership, timeout cleanup, and background goroutines that continue after client disconnection.
Standardize Request Metadata
Design typed context accessors and trace propagation conventions without hiding business inputs or infrastructure dependencies.
Teste estes prompts
Explain when to use Background, TODO, and r.Context in Go. Review this function: [function].
Review this handler, service, and repository for broken context propagation: [code]. Identify missing context-aware calls and cancellation cleanup.
Review this service flow: [code]. Propose nested timeout budgets and typed request metadata accessors while keeping dependencies explicit.
Review this asynchronous audit flow: [code]. Preserve trace values with WithoutCancel, add a finite timeout, and assess shutdown ownership and concurrency limits.
Boas práticas
- Pass the caller context as the first parameter and use context-aware downstream APIs.
- Release derived contexts on every path unless cancellation ownership is explicitly transferred.
- Use typed metadata keys and give detached work an explicit timeout and lifecycle owner.
Evitar
- Creating a new Background context inside a request call chain.
- Using context values to hide database connections, configuration, or required business arguments.
- Launching detached goroutines without lifetime limits or shutdown coordination.
Perguntas frequentes
Which AI tools does this skill support?
Which Go version do the newer context examples require?
Does this skill automatically detect every context bug?
What belongs in context values?
Can a child timeout extend its parent deadline?
Does WithoutCancel guarantee background audit delivery?
Detalhes do desenvolvedor
Autor
samberLicença
MIT
Versão do autor
v1.3.1
Revisão da Skillstore
r1
Referência
e8578ae623cd20ef61db8894d3441416b52a9dad
Atualidade da manutenção
15/10/2026
Uso
0 downloads · 0 visualizações
Estrutura de arquivos