Community코딩 & 개발github.com

samber/golang-gopls

Go 언어를 위한 시맨틱 코드 인텔리전스를 `gopls`(공식 Go 언어 서버)를 통해 제공합니다. 정의 이동, 참조 찾기, 호출/구현 계층 구조, 워크스페이스 심볼 검색, 패키지 API 탐색, 진단, 안전한 이름 변경, 리팩터링(추출/인라인/채우기/재작성 코드 액션), 포맷팅 및 테스트 생성 등을 지원합니다. 에이전트는 gopls의 자체 MCP 서버(`go_*` 도구), Claude Code의 네이티브 `LSP` 도구, 또는 `gopls` CLI를 통해 접근할 수 있습니다. Go 코드 탐색 또는 리팩터링 시 사용하세요—정의로 이동, 이름 변경 전 호출 사이트 찾기, 파일/패키지의 의존성 이해, 편집 후 진단 실행, 또는 추출/인라인/이름 변경 작업에 적합합니다. 퍼블리시된 생태계(go.mod에 없는 패키지, 버전, 라이선스, 가져오기 정보)는 `samber/cc-skills-golang@golang-pkg-go-dev` 스킬(`godig`)을 참조하세요. 전체 트리 취약점 감사는 `samber/cc-skills-golang@golang-security` 스킬(`govulncheck`)을 참조하세요.

golang-gopls란 무엇인가요?

이 스킬은 Go 언어를 위한 시맨틱 코드 인텔리전스를 제공하는 `gopls`(Go 공식 언어 서버)를 다양한 방식으로 에이전트에 연결합니다. `gopls`는 텍스트 기반 검색(grep)과 달리 타입, 호출 그래프, 섀도잉, 구현 관계 등 코드의 '의미'를 이해하도록 돕습니다. 주요 접근 방식으로는 gopls 전용 MCP 서버(권장), Claude Code의 네이티브 LSP 도구, 그리고 gopls CLI가 있으며, MCP → 네이티브 LSP → CLI 순서로 우선 사용합니다. MCP 도구는 에이전트가 이름/경로로 생각하는 방식에 적합하고, 네이티브 LSP는 자동 진단을 제공하며, CLI는 최후의 보루입니다. 이 스킬은 로컬에 해석된 특정 빌드(go.mod와 go.sum에 고정된 의존성)에 대해서만 질문에 답하며, 정의 이동, 참조 검색, 호출/구현 계층, 워크스페이스 심볼 검색, 패키지 API 탐색, 문서화, 진단, 포맷팅, 안전한 이름 변경, 리팩터링(추출/인라인/재작성) 및 테스트 생성 등 포괄적인 기능을 제공합니다. 효율적인 워크플로우로 세션 시작 시 워크스페이스 감지와 취약점 검사를 먼저 수행하고, 이후 읽기 및 편집 워크플로우를 단계별로 진행합니다.

지원 대상✓Claude Code✓Codex CLI✓Cursor
npx skills add https://github.com/samber/cc-skills-golang/tree/main/skills/golang-gopls

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

페르소나: 당신은 질문이 해석된 빌드에 관한 것일 때마다 grep 대신 시맨틱 코드 인텔리전스를 사용하는 Go 엔지니어입니다 — grep은 텍스트를 찾고, gopls는 의미(타입, 호출 그래프, 섀도잉, 구현 관계)를 찾습니다.

의존성: gopls — go install golang.org/x/tools/gopls@latest (v0.20+) 명령으로 설치합니다. 네이티브 LSP 도구를 사용하려면 추가로 ENABLE_LSP_TOOL=1 환경 변수와 gopls-lsp@claude-plugins-official 마켓플레이스 플러그인이 필요합니다 (references/mcp.md 참조).

gopls는 공식 Go 언어 서버입니다. 이 서버는 특정 로컬에서 해석된 빌드 — 즉, go.sum에 정확히 고정된 모든 의존성(예: replace 지시문 포함)이 있는 당신의 워크스페이스 — 에 관한 질문에만 답변합니다. 아직 추가하지 않은 패키지(버전, 문서, 라이선스, CVE 등)에 관한 내용은 samber/cc-skills-golang@golang-pkg-go-dev 스킬(godig)을 참조하세요.

gopls에 접근하는 세 가지 방법

상호 교체 불가 — 이미 알고 있는 것과 필요한 결과에 따라 선택하세요:

  • gopls 자체 MCP 서버 (대부분의 작업에 선호) — 에이전트를 위해 특별히 제작됨: 도구는 원시 커서 위치 대신 이름, 파일 경로 및 퍼지 쿼리를 인자로 받습니다. 머신당 한 번 등록: claude mcp add gopls -- gopls mcp. stdio를 통해 헤드리스로 실행되며, 에디터가 연결되지 않고 디스크에 저장된 파일만 봅니다 — 에이전트 전용 워크플로우의 올바른 기본값입니다. 모든 도구는 references/mcp.md를 참조하세요.
  • 네이티브 LSP 도구 — Claude Code의 기본 제공 에디터 스타일 통합입니다. 기본적으로 꺼져 있음: ENABLE_LSP_TOOL=1 설정, gopls 설치, 공식 gopls-lsp@claude-plugins-official 마켓플레이스 플러그인을 설치하여 Go 언어 서버로 연결합니다. 작업(goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol, goToImplementation, 호출 계층 구조)은 line/character로 키가 지정되므로, 일반적으로 grep 또는 읽기 직후와 같이 이미 위치를 알고 있을 때 가장 유용합니다. 고유 가치: 편집 후마다 컴파일러 진단이 자동으로 컨텍스트에 푸시되므로 명시적 호출이 필요 없습니다.
  • gopls CLI — 동일한 엔진이며 gopls <command> <file:line:col> 형식으로 호출합니다. Go 팀은 이를 실험적이고 디버깅 전용으로 문서화합니다 — "효율적이지 않고, 완전하지 않으며, 유연하지 않고, 공식적으로 지원되지 않습니다." MCP나 네이티브 도구가 설정되지 않았거나 일회성 스크립트 검사에 사용하세요. 위치는 file:line:col (1-인덱스, UTF-8 바이트) 또는 file:#offset (0-인덱스)입니다. references/cli.md를 참조하세요.

선호 순서: MCP → 네이티브 LSP → CLI. MCP 도구는 에이전트가 생각하는 방식(커서 위치가 아닌 이름/경로 기준)과 일치합니다. 네이티브 도구는 무료 자동 진단을 추가합니다. CLI는 문서화된 최후의 보루입니다. 가능한 한 많이 연결하고 작업에 적합한 도구를 선택하세요 — 이미 line:col을 알고 있는 쿼리는 LSP를 통해 저렴하게 처리하고, "X는 어디 있나요" 쿼리는 go_search를 통해, 빠른 무인 검사는 CLI를 통해 저렴하게 처리합니다.

기능 → CLI → MCP → 네이티브 LSP

모든 기능의 전체 매핑(CLI 명령, MCP 도구, 네이티브 LSP 작업): references/matrix.md를 참조하세요.

사용 사례

  • 탐색 — 작성하지 않은 코드를 건드리기 전에 정의, 구현으로 이동하거나 호출 그래프를 추적합니다. 자세한 내용: references/features.md.
  • 코드 발견 — 워크스페이스의 형태 학습(go_workspace), 정확히 위치를 모르는 심볼을 퍼지 검색(go_search), 의존성 사용 전 공개 표면 읽기(go_package_api).
  • 문서화 — 타입/문서/크기 정보를 위한 호버, 함수 호출 시 서명 도움말, 렌더링된 패키지 문서 탐색(source.doc, pkg.go.dev가 볼 수 없는 내부 패키지 포함).
  • 진단 및 안전성 — 편집 후 컴파일러 및 분석기 오류 (go_diagnostics / LSP에서는 자동), 그리고 가벼운 go_vulncheck 도달 가능성 검사: 워크스페이스 감지 직후 기준선으로 한 번, go.mod 변경 후 다시 한 번.
  • 포맷팅 — 표준 gofmt에 해당하는 포맷팅 및 임포트 정리, 스크립트 가능 및 코드 액션 기반 모두 지원.
  • 리팩터링 — 안전한 이름 변경(인터페이스 만족을 깨는 변경을 차단), 추출/인라인, 그리고 전체 refactor.rewrite.* 계열(구조체/스위치 채우기, if 반전, 줄 분할/병합, 사용되지 않는 매개변수 제거, 구조체 태그 추가, 인터페이스 구현). 전체 카탈로그 및 주의사항: references/features.md.

효율적인 워크플로우

다음 Read/Edit 워크플로우는 중복 쿼리와 반만 적용된 편집을 피하기 위한 순서를 인코딩합니다 — 라운드 트립을 절약하기 위해 각 단계를 선택 사항이 아닌 필수로 취급하세요.

  • 세션 시작 — go_workspace를 한 번 호출하여 이것이 Go 워크스페이스인지 감지합니다. 그렇다면 즉시 기준선 go_vulncheck를 수행하여 워크스페이스가 이미 가지고 있는 취약점을 표면화합니다. 이는 무조건적이며, 이후 편집 워크플로우의 의존성 변경 후 검사와는 별개입니다.

읽기 워크플로우 (무언가를 건드리기 전에 이해하기):

  1. go_workspace — 레이아웃(모듈/워크스페이스/GOPATH); 아직 실행되지 않았다면 위의 세션 시작 검사와 동일한 호출입니다.
  2. go_search — 타입/함수/변수를 이름으로 퍼지 위치 찾기.
  3. go_file_context — 모든 Go 파일을 처음 읽은 직후, 해당 파일이 자신의 패키지에서 가져오는 내용을 확인합니다. 해당 파일의 의존성이 변경되면 다시 실행합니다.
  4. go_package_api — 모든 파일을 읽지 않고 서드파티 의존성 또는 형제 패키지의 공개 표면을 확인합니다.

편집 워크플로우 (진단이 깨끗해질 때까지 반복):

  1. 먼저 읽기(위 워크플로우).
  2. 정의를 수정하기 전에 go_symbol_references — 영향 범위를 판단한 후 일치하는 편집이 필요한 모든 참조 파일을 읽습니다.
  3. 계획된 모든 편집(참조 사이트 편집 포함)을 다음 단계로 넘어가기 전에 수행합니다.
  4. 변경된 모든 파일에 대해 go_diagnostics — 각 수정 후 필수이며, 선택적 정리 패스가 아닙니다.
  5. 보고된 오류 수정: 제안된 퀵픽스 diff를 적용하기 전에 검토한 후 진단을 다시 실행하여 수정이 적용되었는지 확인합니다. 작업과 관련 없는 힌트/정보 진단은 무시합니다. 진단 메시지는 주변 소스를 그대로 인용하기보다 의역할 수 있습니다.
  6. go.mod 의존성이 변경된 경우에만 전체 워크스페이스에 대해 go_vulncheck 실행 — 진단이 깨끗해진 후에, 그 전이 아닙니다.
  7. go test <변경된-패키지-경로> 실행 — 명시적으로 요청하지 않는 한 ./...는 사용하지 마십시오.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

samber/golang-benchmark

Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with Prometheus runtime metrics. Also use when the developer needs deep analysis on a specific performance indicator - this skill provides the measurement methodology, while `samber/cc-skills-golang@golang-performance` provides the optimization patterns.

samber/golang-cli

Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli. For cobra-specific APIs → See `samber/cc-skills-golang@golang-spf13-cobra` skill; for viper configuration layering → See `samber/cc-skills-golang@golang-spf13-viper` skill.

samber/golang-code-style

Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill).

samber/golang-concurrency

Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singleflight, worker pools, or fan-out/fan-in pipelines. Also triggers when you detect goroutine leaks, race conditions, channel ownership issues, or need to choose between channels and mutexes.

samber/golang-context

Idiomatic context.Context usage in Golang — propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values, context.WithoutCancel for background work outliving requests. Apply when designing context propagation across layers, debugging leaked or unexpired contexts, choosing between context.Background/TODO/WithoutCancel, or storing values in context. Not for code that merely accepts ctx as first parameter.

samber/golang-continuous-integration

CI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use when setting up or improving Go project CI, configuring GitHub Actions workflows, adding linters or security scanners, automating dependency updates, or adding quality gates.

samber/golang-database

Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use when writing, reviewing, or debugging Golang code that interacts with PostgreSQL, MariaDB, MySQL, or SQLite; for database testing; or for questions about database/sql, sqlx, or pgx. Does NOT generate database schemas or migration SQL.

samber/golang-data-structures

Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals.

samber/golang-dependency-injection

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture, setting up dependency injection, refactoring tightly coupled code, managing singletons or service factories, or when the user asks about inversion of control, service containers, or wiring dependencies in Go. For a specific DI library, → See `samber/cc-skills-golang@golang-google-wire`, `samber/cc-skills-golang@golang-uber-dig`, `samber/cc-skills-golang@golang-uber-fx`, or `samber/cc-skills-golang@golang-samber-do` skills.

samber/golang-dependency-management

Dependency management strategies for Golang projects — go.mod management, installing/upgrading packages, Minimal Version Selection, vulnerability scanning, outdated dependency tracking, binary size analysis, Dependabot/Renovate setup, conflict resolution, and go.work workspaces. Use when adding, removing, or upgrading Go dependencies, auditing vulnerabilities, resolving version conflicts, or setting up automated dependency updates.

samber/golang-design-patterns

Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.

samber/golang-documentation

Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discussing documentation best practices. Triggers for both libraries and applications/CLIs.

samber/golang-error-handling

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; for slog handler ecosystem → See `samber/cc-skills-golang@golang-samber-slog` skill.

samber/golang-google-wire

Compile-time dependency injection in Golang using google/wire — wire.NewSet, wire.Build, wire.Bind (interface→concrete), wire.Struct, wire.Value, wire.InterfaceValue, wire.FieldsOf, cleanup functions, //go:build wireinject injector files, and generated wire_gen.go. Apply when using or adopting google/wire, when the codebase imports `github.com/google/wire`, or when wiring an application graph at compile time via `wire.Build`. For runtime DI with reflection, see `samber/cc-skills-golang@golang-uber-dig` skill.

samber/golang-graphql

Implements GraphQL APIs in Golang using gqlgen or graphql-go. Apply when building GraphQL servers, designing schemas, writing resolvers, handling subscriptions, or integrating GraphQL with existing Go HTTP services. Also apply when the codebase imports `github.com/99designs/gqlgen` or `github.com/graph-gophers/graphql-go`.

samber/golang-grpc

Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or working with streaming RPCs.

samber/golang-how-to

Golang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from samber/cc-skills-golang, often multiple at once: writing a gRPC service loads golang-grpc + golang-testing + golang-error-handling; debugging a panic loads golang-troubleshooting + golang-safety; auditing security loads golang-security + golang-lint + golang-safety. Also: disambiguates competing clusters when two skills seem to overlap (performance vs benchmark vs troubleshooting, samber/lo vs mo vs ro, DI cluster, safety vs security), and configures the project's agent-config file (CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules, or Copilot instructions) to force-trigger skills in a project (/golang-how-to configure).

samber/golang-lint

Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lint, go vet, staticcheck, or revive.

samber/golang-modernize

Modernize Golang code to use recent language features, standard library improvements, and idiomatic patterns. Trigger proactively when writing or reviewing Go code and old-style patterns are detected, or when encountering a deprecation warning. Also use when the user explicitly asks for modernization, a Go version upgrade, or a CI/tooling refresh.

samber/golang-naming

Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters, functional options, acronyms, test functions, and subtest names. Use this skill when writing new Go code, reviewing or refactoring, choosing between naming alternatives (New vs NewTypeName, isConnected vs connected, ErrNotFound vs NotFoundError, StatusReady vs StatusUnknown at iota 0), debating Go package names (utils/helpers anti-patterns), or asking about Go naming best practices. Also trigger when the user mentions MixedCaps vs snake_case, ALL_CAPS constants, Get-prefix on getters, or error string casing. Do NOT use for general Go implementation questions that don't involve naming decisions.

관련 스킬