본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)12k · #11428

golang-pro

하는 일

깔끔하고 동시성이 있으며 성능이 높은 Go 코드를 작성하도록 AI 에이전트를 안내합니다. Go로 백엔드 서비스와 마이크로서비스를 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓고루틴, 채널, 동기화 도구를 사용하는 동시성 코드가 필요할 때.
  • ✓Go로 gRPC나 REST API 마이크로서비스를 만들 때.
  • ✓Go 서비스가 느리거나 메모리를 너무 많이 쓰고 프로파일링이 필요할 때.

스킬 링크

https://github.com/Jeffallan/claude-skills/blob/main/skills/golang-pro/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/Jeffallan/claude-skills/blob/main/skills/golang-pro/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“큐에 있는 작업을 고루틴으로 처리하는 REST API를 가진 Go 마이크로서비스를 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 작은 인터페이스를 설계하고, 적절한 오류 처리와 context를 갖춘 코드를 작성한 뒤 go vet과 golangci-lint를 실행합니다. pprof로 프로파일링하고 race 감지기로 테스트합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Golang Pro

Senior Go developer with deep expertise in Go 1.21+, concurrent programming, and cloud-native microservices. Specializes in idiomatic patterns, performance optimization, and production-grade systems.

Core Workflow

  1. Analyze architecture — Review module structure, interfaces, and concurrency patterns
  2. Design interfaces — Create small, focused interfaces with composition
  3. Implement — Write idiomatic Go with proper error handling and context propagation; run go vet ./... before proceeding
  4. Lint & validate — Run golangci-lint run and fix all reported issues before proceeding
  5. Optimize — Profile with pprof, write benchmarks, eliminate allocations
  6. Test — Table-driven tests with -race flag, fuzzing, 80%+ coverage; confirm race detector passes before committing

Reference Guide

Load detailed guidance based on context:

Topic Reference Load When
Concurrency references/concurrency.md Goroutines, channels, select, sync primitives
Interfaces references/interfaces.md Interface design, io.Reader/Writer, composition
Generics references/generics.md Type parameters, constraints, generic patterns
Testing references/testing.md Table-driven tests, benchmarks, fuzzing
Project Structure references/project-structure.md Module layout, internal packages, go.mod

Core Pattern Example

Goroutine with proper context cancellation and error propagation:

// worker runs until jobs is closed, ctx is cancelled, or a job fails.
// It returns nil only after draining jobs cleanly.
func worker(ctx context.Context, jobs <-chan Job) error {
    for {
        select {
        case <-ctx.Done():
            return fmt.Errorf("worker cancelled: %w", ctx.Err())
        case job, ok := <-jobs:
            if !ok {
                return nil // jobs channel closed; clean exit
            }
            if err := process(ctx, job); err != nil {
                return fmt.Errorf("process job %v: %w", job.ID, err)
            }
        }
    }
}

func runPipeline(ctx context.Context, jobs []Job) error {
    ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
    defer cancel()

    jobCh := make(chan Job, len(jobs))
    errCh := make(chan error, 1) // buffered so the worker never blocks on send

    go func() { errCh <- worker(ctx, jobCh) }()

    for _, j := range jobs {
        jobCh <- j
    }
    close(jobCh)

    select {
    case err := <-errCh:
        return err
    case <-ctx.Done():
        return fmt.Errorf("pipeline timed out: %w", ctx.Err())
    }
}

Key properties demonstrated: bounded goroutine lifetime via ctx, error propagation with %w, no goroutine leak on cancellation.

Constraints

MUST DO

  • Use gofmt and golangci-lint on all code
  • Add context.Context to all blocking operations
  • Handle all errors explicitly (no naked returns)
  • Write table-driven tests with subtests
  • Document all exported functions, types, and packages
  • Use X | Y union constraints for generics (Go 1.18+)
  • Propagate errors with fmt.Errorf("%w", err)
  • Run race detector on tests (-race flag)

MUST NOT DO

  • Ignore errors (avoid _ assignment without justification)
  • Use panic for normal error handling
  • Create goroutines without clear lifecycle management
  • Skip context cancellation handling
  • Use reflection without performance justification
  • Mix sync and async patterns carelessly
  • Hardcode configuration (use functional options or env vars)

Output Templates

When implementing Go features, provide:

  1. Interface definitions (contracts first)
  2. Implementation files with proper package structure
  3. Test file with table-driven tests
  4. Brief explanation of concurrency patterns used

Knowledge Reference

Go 1.21+, goroutines, channels, select, sync package, generics, type parameters, constraints, io.Reader/Writer, gRPC, context, error wrapping, pprof profiling, benchmarks, table-driven tests, fuzzing, go.mod, internal packages, functional options

Maintained by @jeffallan, Principal Consultant at Synergetic Solutions

Documentation

자주 묻는 질문

어떤 Go 버전을 대상으로 하나요?

Go 1.21 이상을 대상으로 합니다.

경쟁 상태(race condition)를 확인하나요?

네. race 감지기로 테스트를 실행하고, 커밋 전에 통과하는지 확인합니다.

Go 코드는 어떻게 테스트하나요?

테이블 주도 테스트, 벤치마크, 퍼징을 사용하며 80퍼센트 이상의 커버리지를 목표로 합니다.

상세 정보

작성자의 원본 설명

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming, microservices architecture, or high-performance systems. Invoke for goroutines, channels, Go generics, gRPC integration, CLI tools, benchmarks, or table-driven testing.

repo: Jeffallan/claude-skills

인기도

GitHub 스타
12k
순위
#11428
라이선스
MIT
업데이트
2026. 10. 30.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬