정보
이 스킬은 Go 1.21-1.23+의 새로운 언어 기능(제네릭, log/slog, errors.Join, slices/maps 패키지 등)을 활용하여 Go 코드를 현대화합니다. `interface{}` 같은 레거시 패턴을 리팩터링하거나 range-over-func 및 반복자 같은 기능을 도입하려는 경우에 특별히 사용하세요. 일반적인 스타일, 오류 처리 철학, 로깅 아키텍처와는 관련이 없으며, 해당 사항은 별도의 전용 스킬을 사용하십시오.
빠른 설치
Claude Code
추천npx skills add eduardo-sl/go-agent-skills -a claude-code/plugin add https://github.com/eduardo-sl/go-agent-skillsgit clone https://github.com/eduardo-sl/go-agent-skills.git ~/.claude/skills/go-modernizeClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Go Modernize
Go evolves. Code written for Go 1.16 should not look the same as code targeting
Go 1.22+. Modernize incrementally — update go.mod, then adopt new patterns.
Detailed reference material, loaded on demand:
references/generics.md— replacinginterface{}with type parameters, constraints, generic containers, when NOT to use generics.references/stdlib-migrations.md— before/after examples for slog, errors.Join, slices/maps helpers, range-over-int, and iterators.
Read a reference file only when the summary below is not enough.
Modernization Procedure
-
Check the
godirective ingo.mod— it caps which features you can use. -
Run the official modernize analyzer first — it finds and fixes the mechanical migrations automatically:
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...If the command is unavailable in your environment, apply the table below manually instead.
-
Scan the table below for the judgment-based migrations the analyzer does not cover (generics, iterators, logger replacement) and apply them case by case.
-
Run
go build ./...and the test suite after each group of changes.
Feature Table by Go Version
| Go Version | Feature | Action |
|---|---|---|
| 1.13+ | errors.Is, errors.As | Replace == error comparisons |
| 1.13+ | http.NewRequestWithContext | Replace http.NewRequest |
| 1.16+ | embed | Replace go-bindata / packr |
| 1.18+ | Generics | Replace interface{} utility functions |
| 1.20+ | errors.Join | Replace manual error accumulation |
| 1.21+ | log/slog | Replace log for structured logging |
| 1.21+ | slices, maps | Replace hand-written slice/map utilities |
| 1.21+ | min, max builtins | Replace math.Min/math.Max (float64-only) |
| 1.22+ | Range over int | Replace for i := 0; i < n; i++ |
| 1.23+ | Range over func | Replace callback-based iteration |
Key Migrations at a Glance
Generics — type-safe utilities (Go 1.18+)
// ❌ Before — loses type safety
func Contains(slice []interface{}, target interface{}) bool { /* ... */ }
// ✅ After — type-safe generic
func Contains[T comparable](slice []T, target T) bool { /* ... */ }
Use generics for container types (Set[T], Result[T]) and utility
functions. Do NOT use them where a single concrete type works, or as a
substitute for interfaces in runtime polymorphism.
Details and constraint patterns: references/generics.md.
Structured logging (Go 1.21+)
// ❌ Before
log.Printf("processing order %s for user %s", orderID, userID)
// ✅ After
slog.Info("processing order",
slog.String("order_id", orderID),
slog.String("user_id", userID),
)
Keep zap/zerolog only if you need their performance for high-throughput logging; for most services slog is sufficient.
errors.Join (Go 1.20+)
var errs []error
for _, item := range items {
if err := validate(item); err != nil {
errs = append(errs, err)
}
}
if err := errors.Join(errs...); err != nil {
return fmt.Errorf("validation: %w", err)
}
errors.Join preserves the chain — errors.Is/errors.As work on each
joined error. Never accumulate error strings manually.
slices and maps helpers (Go 1.21+)
found := slices.Contains(items, target) // not a manual loop
slices.SortFunc(users, func(a, b User) int { // not sort.Slice
return cmp.Compare(a.Name, b.Name)
})
keys := slices.Collect(maps.Keys(m)) // not a manual key loop
clone := maps.Clone(m) // not a manual copy loop
Range over int (Go 1.22+) and iterators (Go 1.23+)
for i := range n { process(i) } // not for i := 0; i < n; i++
for i, v := range slices.Backward(items) { // stdlib iterators
fmt.Printf("%d: %v\n", i, v)
}
Custom iter.Seq/iter.Seq2 iterators replace callback-based iteration —
full worked example in references/stdlib-migrations.md.
Context-aware HTTP requests (Go 1.13+, often missed)
// ❌ Before — request without context
req, err := http.NewRequest(http.MethodGet, url, nil)
// ✅ After — context propagated
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
Verification Checklist
go.modversion matches the features used in the codebase- No
interface{}whereanyor type parameters would be clearer log/slogused instead oflog.Printffor structured loggingerrors.Joinused instead of manual error string concatenationslices.Contains,slices.SortFunc,maps.Clonereplace hand-written loops- Range over int (
for i := range n) used where applicable http.NewRequestWithContextused instead ofhttp.NewRequest- No
sort.Slice— useslices.SortFuncwithcmp.Compare - Generics used for type-safe containers and utilities, not overused for trivial cases
- Third-party dependencies evaluated against stdlib alternatives added in recent Go versions
GitHub 저장소
자주 묻는 질문
go-modernize Skill이란 무엇인가요?
go-modernize은(는) eduardo-sl이(가) 만든 Claude Skill입니다. Skill은 Claude가 필요할 때 불러오는 지침과 리소스를 묶어 추가 프롬프트 없이 go-modernize 관련 작업을 수행할 수 있게 합니다.
go-modernize은(는) 어떻게 설치하나요?
이 페이지의 설치 명령을 사용하세요. go-modernize을(를) Claude Code 플러그인으로 추가하거나 저장소를 skills 디렉터리에 복제한 다음 Claude를 다시 시작해 Skill을 불러옵니다.
go-modernize은(는) 어떤 카테고리에 속하나요?
go-modernize은(는) 개발 카테고리에 속합니다.
go-modernize은(는) 무료로 사용할 수 있나요?
네. go-modernize은(는) AIMCP에 등록되어 있으며 무료로 설치할 수 있습니다.
연관 스킬
qmd는 BM25, 벡터 임베딩, 재순위화를 결합한 하이브리드 검색을 통해 로컬 파일을 색인화하고 검색할 수 있는 로컬 검색 및 색인화 CLI 도구입니다. 명령줄 사용과 Claude 통합을 위한 MCP(Model Context Protocol) 모드를 모두 지원합니다. 이 도구는 임베딩에 Ollama를 사용하고 색인을 로컬에 저장하여 터미널에서 직접 문서나 코드베이스를 검색하는 데 이상적입니다.
이 스킬은 각 독립적인 작업마다 새로운 하위 에이전트를 배치하고 작업 사이에 코드 리뷰를 진행하여 구현 계획을 실행합니다. 이 리뷰 프로세스를 통해 품질 게이트를 유지하면서 빠른 반복 작업을 가능하게 합니다. 동일한 세션 내에서 대부분 독립적인 작업을 진행할 때 내장된 품질 검증과 함께 지속적인 진행을 보장하기 위해 사용하세요.
mcporter 스킬은 개발자가 Claude에서 직접 Model Context Protocol(MCP) 서버를 관리하고 호출할 수 있도록 합니다. 이 스킬은 사용 가능한 서버를 나열하고, 인수를 사용해 해당 서버의 도구를 호출하며, 인증 및 데몬 생명주기를 처리하는 명령어를 제공합니다. 개발 워크플로우에서 MCP 서버 기능을 통합하고 테스트할 때 이 스킬을 사용하세요.
이 스킬은 A2A 프로토콜을 사용하여 Vertex AI ADK 에이전트를 배포하고 오케스트레이션하며, AgentCard 검색, 작업 제출, 코드 실행 샌드박스 및 메모리 뱅크와 같은 지원 도구를 관리합니다. Python, Java 또는 Go 언어로 순차, 병렬 또는 루프 오케스트레이션 패턴을 갖춘 다중 에이전트 시스템 구축을 가능하게 합니다. Google Cloud에서 ADK 에이전트 배포 또는 에이전트 워크플로우 오케스트레이션을 요청받았을 때 사용하세요.
