본문으로 건너뛰기
cccskills
무료GitHub에 공개

go-programming-expert

Expert-level skill for Go programming (Go 1.25+). Covers high-performance microservices, concurrency patterns, sqlc, net/http, Gin/Echo/Fiber, gRPC, and testing in English and Indonesian.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md9.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Go Programming Expert (Go 1.25 Edition)

English | Bahasa Indonesia


<a name="english"></a>

English

Orchestration & Integration

Connects and orchestrates with relevant domain skills like brainstorming, zero-to-prod-orchestrator, and session-memory-manager to ensure cohesive execution.

Description

Expert-level Go development for building high-performance microservices, APIs, and CLI tools. Covers Go 1.25 features (range-over-func iterators, generic type aliases, weak pointers), structured logging with slog, net/http with the new ServeMux patterns, Gin/Echo/Fiber frameworks, sqlc for type-safe SQL, gRPC, and production testing patterns.

Trigger Conditions

  • Writing Go 1.24+ / 1.25+ microservices or APIs.
  • Implementing concurrency patterns with goroutines, channels, and sync primitives.
  • Using structured logging with log/slog.
  • Building HTTP servers with net/http ServeMux (Go 1.22+) or Gin/Echo/Fiber.
  • Writing type-safe SQL with sqlc or using GORM.
  • Implementing gRPC services with protobuf.
  • Writing Go tests with the standard testing package + testify.

Go 1.25 — Key Features

Range-Over-Func (Go 1.22 → Stable in 1.24/1.25)

Range over custom iterators — enables functional-style collection operations:

// Define an iterator function
func Fibonacci() iter.Seq[int] {
    return func(yield func(int) bool) {
        a, b := 0, 1
        for {
            if !yield(a) {
                return
            }
            a, b = b, a+b
        }
    }
}

// Range over it naturally
for n := range Fibonacci() {
    if n > 100 {
        break
    }
    fmt.Println(n)
}

Generic Type Aliases (Go 1.24/1.25)

// Type alias with generic parameters
type Set[T comparable] = map[T]struct{}
type Result[T any] = struct{ Value T; Err error }

// Usage
var s Set[string] = make(map[string]struct{})

Weak Pointers (Go 1.24/1.25)

import "weak"

// Weak pointer — does not prevent GC collection
ptr := weak.Make(&myStruct{})
if val := ptr.Value(); val != nil {
    // Still alive
}

Structured Logging with log/slog

package main

import (
    "log/slog"
    "os"
)

func main() {
    // Production JSON logger
    logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
        Level: slog.LevelInfo,
        AddSource: true, // include file:line
    }))
    slog.SetDefault(logger)

    slog.Info("server started", "port", 8080, "env", "production")
    slog.Error("database connection failed", "error", err, "host", dbHost)
    
    // Grouped context
    reqLogger := logger.WithGroup("request").With(
        "trace_id", traceID,
        "user_id", userID,
    )
    reqLogger.Info("handler called", "method", r.Method, "path", r.URL.Path)
}

HTTP Server — net/http ServeMux (Go 1.22+)

Go 1.22 upgraded the standard ServeMux with method-based routing and path parameters — reducing the need for external routers:

package main

import (
    "encoding/json"
    "net/http"
    "log/slog"
)

func main() {
    mux := http.NewServeMux()

    // Method + path pattern matching (Go 1.22+)
    mux.HandleFunc("GET /api/users", listUsers)
    mux.HandleFunc("POST /api/users", createUser)
    mux.HandleFunc("GET /api/users/{id}", getUser)  // path params
    mux.HandleFunc("DELETE /api/users/{id}", deleteUser)

    slog.Info("starting server", "addr", ":8080")
    http.ListenAndServe(":8080", mux)
}

func getUser(w http.ResponseWriter, r *http.Request) {
    id := r.PathValue("id")  // Extract path parameter
    user := map[string]string{"id": id, "name": "Gopher"}
    w.Header().Set("Content-Type", "application/json")
    json.NewEncoder(w).Encode(user)
}

Type-Safe SQL with sqlc

# Install sqlc
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

# sqlc.yaml
version: "2"
sql:
  - engine: "postgresql"
    queries: "queries/"
    schema: "schema/"
    gen:
      go:
        package: "db"
        out: "internal/db"
        emit_json_tags: true
        emit_interface: true
-- queries/users.sql
-- name: GetUser :one
SELECT * FROM users WHERE id = $1 LIMIT 1;

-- name: ListUsers :many
SELECT * FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2;

-- name: CreateUser :one
INSERT INTO users (name, email) VALUES ($1, $2) RETURNING *;
// Generated type-safe Go code (used in handlers)
user, err := queries.GetUser(ctx, userID) // Fully typed!
users, err := queries.ListUsers(ctx, db.ListUsersParams{Limit: 20, Offset: 0})

Concurrency Patterns

errgroup for Parallel Work

import "golang.org/x/sync/errgroup"

g, ctx := errgroup.WithContext(context.Background())

g.Go(func() error { return fetchA(ctx) })
g.Go(func() error { return fetchB(ctx) })

if err := g.Wait(); err != nil {
    // First error from any goroutine
    return fmt.Errorf("parallel fetch: %w", err)
}

Worker Pool Pattern

func workerPool(jobs <-chan Job, results chan<- Result, numWorkers int) {
    var wg sync.WaitGroup
    for range numWorkers {
        wg.Add(1)
        go func() {
            defer wg.Done()
            for job := range jobs {
                results <- process(job)
            }
        }()
    }
    wg.Wait()
    close(results)
}

Testing Best Practices

package user_test

import (
    "testing"
    "github.com/stretchr/testify/assert"
    "github.com/stretchr/testify/require"
)

func TestGetUser(t *testing.T) {
    t.Parallel() // Always parallelize independent tests

    // Table-driven tests
    tests := []struct{
        name   string
        userID string
        want   *User
        wantErr bool
    }{
        {"valid user", "user-123", &User{ID: "user-123"}, false},
        {"not found", "missing", nil, true},
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            t.Parallel()
            got, err := GetUser(context.Background(), tt.userID)
            if tt.wantErr {
                require.Error(t, err)
                return
            }
            require.NoError(t, err)
            assert.Equal(t, tt.want.ID, got.ID)
        })
    }
}

<a name="bahasa-indonesia"></a>

Bahasa Indonesia

Integrasi Orkestrasi

Terhubung dan mengorkestrasi skill domain yang relevan seperti brainstorming, zero-to-prod-orchestrator, dan session-memory-manager untuk memastikan eksekusi yang kohesif.

Deskripsi

Panduan Go tingkat ahli untuk membangun microservices, API, dan CLI tool berkinerja tinggi. Mencakup fitur Go 1.25 (range-over-func, generic type alias, weak pointer), structured logging dengan slog, ServeMux net/http dengan pola baru (Go 1.22+), framework Gin/Echo/Fiber, sqlc untuk SQL type-safe, gRPC, dan pola pengujian produksi.

Kondisi Pemicu

  • Menulis microservices atau API Go 1.24+/1.25+.
  • Mengimplementasikan pola konkurensi dengan goroutine, channel, dan primitif sync.
  • Menggunakan structured logging dengan log/slog.
  • Membangun HTTP server dengan ServeMux net/http (Go 1.22+) atau Gin/Echo/Fiber.
  • Menulis SQL type-safe dengan sqlc atau GORM.
  • Mengimplementasikan layanan gRPC dengan protobuf.

Go 1.25 — Fitur Utama

Range-Over-Func (Stabil di 1.24/1.25)

Go 1.24/1.25 menstabilkan range over iterator function — memungkinkan koleksi gaya fungsional yang idiomatis tanpa mengekspos slice internal.

Generic Type Alias

Go 1.24/1.25 memungkinkan alias tipe dengan parameter generic, meningkatkan komposibilitas tipe.

Weak Pointer

weak.Make() membuat pointer lemah yang tidak mencegah GC mengumpulkan objek — berguna untuk cache.

Structured Logging dengan log/slog

Paket log/slog bawaan Go (sejak 1.21) mendukung output JSON terstruktur, level log, dan pengelompokan atribut. Gunakan sebagai standar logging di semua proyek Go baru.

HTTP Server — net/http ServeMux (Go 1.22+)

ServeMux Go 1.22 mendukung pencocokan berdasarkan metode HTTP dan parameter path — mengurangi kebutuhan router eksternal untuk API sederhana.

SQL Type-Safe dengan sqlc

sqlc menghasilkan kode Go yang fully typed dari query SQL dan skema database — menghilangkan kebutuhan ORM untuk sebagian besar kasus.

Pola Konkurensi

errgroup

Gunakan errgroup.WithContext() dari golang.org/x/sync/errgroup untuk menjalankan goroutine paralel dan mengumpulkan error pertama secara aman.

Worker Pool

Gunakan pola worker pool dengan channel untuk memproses pekerjaan secara paralel dengan jumlah goroutine yang terkendali.

Best Practices Pengujian

  • Gunakan t.Parallel() untuk semua test independen.
  • Gunakan table-driven tests untuk menguji banyak skenario dengan kode minimal.
  • Gunakan testify/assert dan testify/require untuk assertion yang ekspresif.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

Expert guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan ahli komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

Expert guide for AI-assisted coding workflows — agentic code generation, multi-agent code swarms, self-healing CI/CD, automated PR review, spec-to-code pipelines, codebase knowledge graphs, and human-in-the-loop approval gates / Panduan ahli untuk workflow pengkodean berbasis AI — generasi kode agentic, code swarm multi-agen, CI/CD self-healing, review PR otomatis, pipeline spec-to-code, knowledge graph codebase, dan gate persetujuan human-in-the-loop.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

Expert guide for autonomous Machine-to-Machine (M2M) agent settlement, dual-rail fiat & stablecoin micro-clearing, dynamic budget envelopes, and cryptographic agent invoicing / Panduan ahli settlement otonom antar-agen (M2M), kliring mikro dual-rail fiat & stablecoin, pagu anggaran dinamis, dan penagihan agen kriptografis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

Expert guide for long-term episodic memory integration (Mem0 v2, Letta/MemGPT, Zep v2), memory tier architecture, pgvector HNSW storage, and unified context management for autonomous AI agents / Panduan ahli untuk integrasi memori episodik jangka panjang (Mem0 v2, Letta/MemGPT, Zep v2), arsitektur tier memori, penyimpanan pgvector HNSW, dan manajemen konteks terpadu untuk agen AI otonom.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug802026년 10월 19일 업데이트

roedyrustam의 스킬 모두 보기

이 스킬의 문제 신고