Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

golang-backend-development

БесплатноБез исполняемых скриптовНе проверен

Complete guide for Go backend development including concurrency patterns, web servers, database integration, microservices, and production deployment

manutejот manutej★ 64 звезды на GitHub27 установок в других каталогах

Об этом скилле

Go Backend Development

A comprehensive skill for building production-grade backend systems with Go. Master goroutines, channels, web servers, database integration, microservices architecture, and deployment patterns for scalable, concurrent backend applications.

When to Use This Skill

Use this skill when:

  • Building high-performance web servers and REST APIs
  • Developing microservices architectures with gRPC or HTTP
  • Implementing concurrent processing with goroutines and channels
  • Creating real-time systems requiring high throughput
  • Building database-backed applications with connection pooling
  • Developing cloud-native applications for containerized deployment
  • Writing performance-critical backend services
  • Building distributed systems with service discovery
  • Implementing event-driven architectures
  • Creating CLI tools and system utilities with networking capabilities
  • Developing WebSocket servers for real-time communication
  • Building data processing pipelines with concurrent workers

Go excels at:

  • Network programming and HTTP services
  • Concurrent processing with lightweight goroutines
  • System-level programming with garbage collection
  • Cross-platform compilation
  • Fast compilation times for rapid development
  • Built-in testing and benchmarking

Core Concepts

1. Goroutines: Lightweight Concurrency

Goroutines are lightweight threads managed by the Go runtime. They enable concurrent execution with minimal overhead.

Key Characteristics:

  • Extremely lightweight (start with ~2KB stack)
  • Multiplexed onto OS threads by the runtime
  • Thousands or millions can run concurrently
  • Scheduled cooperatively with integrated scheduler

Basic Goroutine Pattern:

func main() {
    // Launch concurrent computation
    go expensiveComputation(x, y, z)
    anotherExpensiveComputation(a, b, c)
}

The go keyword launches a new goroutine, allowing expensiveComputation to run concurrently with anotherExpensiveComputation. This is fundamental to Go's concurrency model.

Common Use Cases:

  • Background processing
  • Concurrent API calls
  • Parallel data processing
  • Real-time event handling
  • Connection handling in servers

2. Channels: Safe Communication

Channels provide type-safe communication between goroutines, eliminating the need for explicit locks in many scenarios.

Channel Types:

// Unbuffered channel - synchronous communication
ch := make(chan int)

// Buffered channel - asynchronous up to buffer size
ch := make(chan int, 100)

// Read-only channel
func receive(ch <-chan int) { /* ... */ }

// Write-only channel
func send(ch chan<- int) { /* ... */ }

Synchronization with Channels:

func computeAndSend(ch chan int, x, y, z int) {
    ch <- expensiveComputation(x, y, z)
}

func main() {
    ch := make(chan int)
    go computeAndSend(ch, x, y, z)
    v2 := anotherExpensiveComputation(a, b, c)
    v1 := <-ch  // Block until result available
    fmt.Println(v1, v2)
}

This pattern ensures both computations complete before proceeding, with the channel providing both communication and synchronization.

Channel Patterns:

  • Producer-consumer
  • Fan-out/fan-in
  • Pipeline stages
  • Timeouts and cancellation
  • Semaphores and rate limiting

3. Select Statement: Multiplexing Channels

The select statement enables multiplexing multiple channel operations, similar to a switch for channels.

Timeout Implementation:

timeout := make(chan bool, 1)
go func() {
    time.Sleep(1 * time.Second)
    timeout <- true
}()

select {
case <-ch:
    // Read from ch succeeded
case <-timeout:
    // Operation timed out
}

Context-Based Cancellation:

select {
case result := <-resultCh:
    return result
case <-ctx.Done():
    return ctx.Err()
}

4. Context Package: Request-Scoped Values

The context.Context interface manages deadlines, cancellation signals, and request-scoped values across API boundaries.

Context Interface:

type Context interface {
    // Done returns a channel closed when work should be canceled
    Done() <-chan struct{}

    // Err returns why context was canceled
    Err() error

    // Deadline returns when work should be canceled
    Deadline() (deadline time.Time, ok bool)

    // Value returns request-scoped value
    Value(key any) any
}

Creating Contexts:

// Background context - never canceled
ctx := context.Background()

// With cancellation
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

// With timeout
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

// With deadline
deadline := time.Now().Add(10 * time.Second)
ctx, cancel := context.WithDeadline(context.Background(), deadline)
defer cancel()

// With values
ctx = context.WithValue(parentCtx, key, value)

Best Practices:

  • Always pass context as first parameter: func DoSomething(ctx context.Context, ...)
  • Call defer cancel() immediately
Полный SKILL.md на GitHub

Установить golang-backend-development в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

EXAMPLES.mdREADME.md

FAQ

Что делает скилл golang-backend-development?

Complete guide for Go backend development including concurrency patterns, web servers, database integration, microservices, and production deployment

Как установить скилл golang-backend-development?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл golang-backend-development запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить golang-backend-development с