golang-patterns
From affaan-m
Patrones idiomáticos de Go, buenas prácticas y convenciones para construir aplicaciones Go robustas, eficientes y mantenibles.
Provides Go idiom reference covering error wrapping, zero-value design, worker pools, context cancellation, and errgroup patterns.
Use it when
- Writing new Go code and want idiomatic conventions applied
- Reviewing or refactoring existing Go code for style
- Designing Go packages/modules and need error-handling patterns
- Implementing concurrency with worker pools, context timeouts, or errgroup
Skip it if
- Only relevant for Go projects, not other languages
- Content is in Spanish, may not fit English-only workflows
- Just a static reference of code snippets, not an executable tool
Facts
- Repository
- affaan-m/ECC
- Status
- Actively maintained
- Last commit
- Source file
- .kiro/skills/golang-patterns/SKILL.md
Source preview
The instructions Claude Code reads when this skill runs.
# Patrones de Desarrollo Go
Patrones idiomáticos de Go y buenas prácticas para construir aplicaciones robustas, eficientes y mantenibles.
## Cuándo Activar
- Escribir nuevo código Go
- Revisar código Go
- Refactorizar código Go existente
- Diseñar paquetes/módulos Go
## Principios Fundamentales
### 1. Simplicidad y Claridad
Go favorece la simplicidad sobre la astucia. El código debe ser obvio y fácil de leer.
```go
// Bien: Claro y directo
func GetUser(id string) (*User, error) {
user, err := db.FindUser(id)
if err != nil {
return nil, fmt.Errorf("get user %s: %w", id, err)
}
return user, nil
}
// Mal: Demasiado ingenioso
func GetUser(id string) (*User, error) {
return func() (*User, error) {
if u, e := db.FindUser(id); e == nil {
return u, nil
} else {
return nil, e
}
}()
}
```
### 2. Hacer que el Valor Cero Sea Útil
Diseñar tipos para que su valor cero sea inmediatamente usable sin inicialización.
```go
// Bien: El valor cero es útil
type Counter struct {
mu sync.Mutex
count int // el valor cero es 0, listo para usar
}
func (c *Counter) Inc() {
c.mu.Lock()
c.count++
c.mu.Unlock()
}
// Bien: bytes.Buffer funciona con el valor cero
var buf bytes.Buffer
buf.WriteString("hello")
// Mal: Requiere inicialización
type BadCounter struct {
counts map[string]int // eView full source on GitHub →Other skills
django-tdd
★ 229,918Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
affaan-mupdated 14d agoMITclickhouse-io
★ 229,918ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
affaan-mupdated 14d agoMITlaravel-patterns
★ 229,918Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.
affaan-mupdated 14d agoMITverification-loop
★ 229,918Sistema de verificación completo para sesiones de Claude Code.
affaan-mupdated 14d agoMITstrategic-compact
★ 229,918Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
affaan-mupdated 14d agoMITfrontend-patterns
★ 229,918Patrones de desarrollo frontend para React, Next.js, gestión de estado, optimización de rendimiento y buenas prácticas de UI.
affaan-mupdated 14d agoMIT