kobogithub/knowledge/go-best-practices
Claude Code and agent skill by kobogithub/knowledge
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Go best practices — project layout, error handling, concurrency, interfaces and testing
Install
npx vskill@latest install kobogithub/knowledge/go-best-practicesSKILL.md
The same SKILL.md was published earlier as kobogithub/knowledge/go-best-practices.
go-best-practices
Mejores prácticas para desarrollo en Go: layout de proyecto, manejo de errores, concurrencia con goroutines/channels, interfaces pequeñas y testing idiomático.
Overview
Go es ideal para:
- CLIs y binarios estáticos distribuibles sin runtime
- Servicios/APIs concurrentes de alto rendimiento
- Herramientas de infra y workers
Project Structure
internal/para todo lo que no querés exponer como API pública.cmd/<bin>/main.gomínimo: parsea flags y delega.- Un módulo por repo (
go.mod); nombres de paquete cortos y en minúscula.
Error Handling
- Envolvé con
fmt.Errorf("...: %w", err)para preservar la cadena. - Inspeccioná con
errors.Is(valor centinela) yerrors.As(tipo). - Definí errores centinela con
errors.New; errores ricos como structs que
implementan error.
- No ignores errores (
_ = f()) salvo que sea deliberado y comentado.
Interfaces
- Interfaces pequeñas, definidas por el consumidor, no por el proveedor.
- Aceptá interfaces, devolvé structs concretos.
Concurrencia
- Pasá
context.Contextcomo primer parámetro para cancelación/timeouts. - "Don't communicate by sharing memory; share memory by communicating" — usá channels.
- Protegé estado compartido con
sync.Mutex; verificá congo test -race. - Evitá goroutine leaks: toda goroutine debe tener una salida clara (ctx/close).
Testing
- Table-driven tests + subtests con
t.Run. go test ./... -race -cover.testing.T.TempDir()para archivos temporales;t.Cleanuppara teardown.
Tooling
- Formateo obligatorio con
gofmt/goimports(no hay debate de estilo). go vet+staticcheck/golangci-linten CI.- Fijá versión con la directiva
go 1.xxengo.mod.
DO / DON'T
DO
- Envolver errores con
%wy chequear conerrors.Is/As. - Pasar
context.Contextpara I/O y cancelación. - Interfaces chicas del lado del consumidor.
- Correr tests con
-race.
DON'T
- Ignorar errores silenciosamente.
- Usar
panicpara control de flujo (reservalo para lo irrecuperable). - Sobre-abstraer con interfaces grandes/anticipadas.
- Lanzar goroutines sin una condición de salida.
Recursos
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/go-best-practices/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kobogithub/knowledge/go-best-practices)