Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问clear审计通过

golang-masterGo master 命令行

Agent Skill

golang-master 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

791

周安装

32

GitHub Stars

公开资料未说明

下载量

248
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:golang-master(Go master 命令行)
来源仓库:https://github.com/tomlord1122/tomtom-skill
仓库路径:skills/golang-master
安装命令:
npx skills add https://github.com/tomlord1122/tomtom-skill --skill golang-master
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/tomlord1122/tomtom-skill --skill golang-master

简介

golang-master 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中整理相关事项。

  • 适用于围绕仓库状态、代码变更或协作事项进行信息整理和分析的场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用该技能。
  • 安装前需确认权限范围、维护状态,以及是否会触发联网或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Golang Language Expert

Expert assistant for Go language mastery including concurrency patterns, performance optimization, standard library usage, and testing strategies.

Thinking Process

When activated, follow this structured thinking approach to solve Go-related problems:

Step 1: Problem Classification

Goal: Understand what type of Go challenge this is.

Key Questions to Ask:

  • Is this a concurrency problem? (goroutines, channels, race conditions)
  • Is this a performance problem? (memory, CPU, allocations)
  • Is this a design problem? (interfaces, struct composition, packages)
  • Is this a debugging problem? (error tracing, unexpected behavior)
  • Is this a testing problem? (unit tests, benchmarks, mocks)

Decision Point: Classify the problem to select appropriate patterns:

  • Concurrency → Check for race conditions, proper synchronization
  • Performance → Profile first, then optimize
  • Design → Apply interface segregation, composition over inheritance
  • Debugging → Trace error chain, check nil handling
  • Testing → Table-driven tests, dependency injection

Step 2: Context Analysis

Goal: Understand the existing codebase context and constraints.

Key Questions to Ask:

  • What Go version is being used? (generics require 1.18+)
  • What is the module structure? (standard layout vs flat)
  • What dependencies exist? (standard library vs third-party)
  • Are there existing patterns to follow? (error handling style, logging approach)

Actions:

  1. Check go.mod for Go version and dependencies
  2. Scan existing code for established patterns
  3. Identify any project-specific conventions

Step 3: Solution Design (Idiomatic Go)

Goal: Design a solution that follows Go best practices.

Thinking Framework - Apply These Principles:

  1. Simplicity First

- "Is there a simpler way to achieve this?" - Avoid over-engineering; Go favors explicitness

  1. Error Handling

- "What can fail here? How should failures propagate?" - Use fmt.Errorf("context: %w", err) for wrapping - Define custom error types for domain-specific errors

  1. Concurrency Safety

- "Is this data accessed from multiple goroutines?" - "Do I need a mutex, channel, or atomic operation?" - Prefer channels for coordination, mutexes for state protection

  1. Interface Design

- "What behavior is needed, not what data?" - Keep interfaces small (1-3 methods) - Accept interfaces, return concrete types

  1. Resource Management

- "What needs to be closed/cleaned up?" - Use defer for cleanup - Propagate context for cancellation

Step 4: Implementation with Patterns

Goal: Apply well-known Go patterns appropriately.

Pattern Selection Guide:

Problem TypeRecommended Pattern
Process N items concurrentlyWorker Pool
Limit concurrent operationsSemaphore
Timeout long operationsContext with Deadline
Coordinate multiple goroutinesWaitGroup
Fan-out/Fan-in processingChannel pipelines
Graceful shutdownContext cancellation + signal handling

Decision Point: For each pattern, ask:

  • "Why is this pattern appropriate for this problem?"
  • "What are the edge cases I need to handle?"

Step 5: Testing Strategy

Goal: Ensure code correctness and maintainability.

Thinking Framework:

  • "What are the happy paths to test?"
  • "What edge cases could break this?"
  • "Is this code testable? If not, how should I refactor?"

Testing Checklist:

  1. Table-driven tests for functions with multiple input scenarios
  2. Race detection for concurrent code (go test -race)
  3. Benchmarks for performance-critical code
  4. Mock interfaces for external dependencies

Step 6: Review and Refine

Goal: Ensure the solution is production-ready.

Final Checks:

  • All errors are handled or explicitly ignored with comment
  • Context is propagated through the call chain
  • Resources are properly closed (defer, Close())
  • No goroutine leaks (channels closed, contexts cancelled)
  • Code is testable (dependencies injected)
  • Documentation for exported symbols

Usage

Run Linters

bash /mnt/skills/user/golang-master/scripts/lint.sh [project-dir] [fix-mode]

Arguments:

  • project-dir - Project directory (default: current directory)
  • fix-mode - Set to true to auto-fix issues (default: false)

Examples:

bash /mnt/skills/user/golang-master/scripts/lint.sh
bash /mnt/skills/user/golang-master/scripts/lint.sh ./my-project true

Runs: go vet, gofmt, staticcheck, golangci-lint, go mod tidy

Run Benchmarks

bash /mnt/skills/user/golang-master/scripts/benchmark.sh [project-dir] [pattern] [profile-type]

Arguments:

  • project-dir - Project directory (default: current directory)
  • pattern - Benchmark pattern to match (default:.)
  • profile-type - Profiling: none, cpu, mem, all (default: none)

Examples:

bash /mnt/skills/user/golang-master/scripts/benchmark.sh
bash /mnt/skills/user/golang-master/scripts/benchmark.sh . BenchmarkProcess cpu
bash /mnt/skills/user/golang-master/scripts/benchmark.sh ./myproject . all

Documentation Resources

Official Documentation:

  • Go Docs: https://go.dev/doc/
  • Effective Go: https://go.dev/doc/effective_go
  • Go by Example: https://gobyexample.com/
  • uber-go/guide: https://github.com/uber-go/guide

Concurrency Patterns

Worker Pool

func workerPool(jobs <-chan Job, numWorkers int) <-chan Result {
    results := make(chan Result, len(jobs))
    var wg sync.WaitGroup

    for i := 0; i < numWorkers; i++ {
        wg.Add(1)
        go func() {
            defer wg.Done()
            for job := range jobs {
                results <- process(job)
            }
        }()
    }

    go func() {
        wg.Wait()
        close(results)
    }()

    return results
}

Context with Timeout

func fetchWithTimeout(url string) ([]byte, error) {
    ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
    defer cancel()

    req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
    if err != nil {
        return nil, err
    }

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()

    return io.ReadAll(resp.Body)
}

Semaphore Pattern

type Semaphore struct {
    sem chan struct{}
}

func NewSemaphore(n int) *Semaphore {
    return &Semaphore{sem: make(chan struct{}, n)}
}

func (s *Semaphore) Acquire() { s.sem <- struct{}{} }
func (s *Semaphore) Release() { <-s.sem }

Error Handling

Wrapping Errors

func processUser(id int) error {
    user, err := fetchUser(id)
    if err != nil {
        return fmt.Errorf("failed to fetch user %d: %w", id, err)
    }

    if err := validateUser(user); err != nil {
        return fmt.Errorf("validation failed for user %d: %w", id, err)
    }

    return nil
}

Custom Error Types

type NotFoundError struct {
    Resource string
    ID       string
}

func (e *NotFoundError) Error() string {
    return fmt.Sprintf("%s not found: %s", e.Resource, e.ID)
}

// Usage
if errors.Is(err, &NotFoundError{}) {
    // Handle not found
}

Error Checking

// Use errors.Is for sentinel errors
if errors.Is(err, sql.ErrNoRows) {
    return nil, &NotFoundError{Resource: "user", ID: id}
}

// Use errors.As for error types
var netErr *net.OpError
if errors.As(err, &netErr) {
    // Handle network error
}

Performance Profiling

CPU Profiling

# Run benchmark with CPU profile
go test -cpuprofile=cpu.prof -bench=.
go tool pprof cpu.prof

# Interactive commands
(pprof) top10
(pprof) web
(pprof) list FunctionName

Memory Profiling

# Run benchmark with memory profile
go test -memprofile=mem.prof -bench=.
go tool pprof -alloc_space mem.prof

# Check for allocations
go build -gcflags='-m' ./...

Benchmark Example

func BenchmarkProcess(b *testing.B) {
    data := setupTestData()
    b.ResetTimer()

    for i := 0; i < b.N; i++ {
        process(data)
    }
}

func BenchmarkProcessParallel(b *testing.B) {
    data := setupTestData()
    b.ResetTimer()

    b.RunParallel(func(pb *testing.PB) {
        for pb.Next() {
            process(data)
        }
    })
}

Testing Patterns

Table-Driven Tests

func TestAdd(t *testing.T) {
    tests := []struct {
        name     string
        a, b     int
        expected int
    }{
        {"positive", 2, 3, 5},
        {"negative", -1, -2, -3},
        {"zero", 0, 0, 0},
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            result := Add(tt.a, tt.b)
            if result != tt.expected {
                t.Errorf("Add(%d, %d) = %d; want %d",
                    tt.a, tt.b, result, tt.expected)
            }
        })
    }
}

Present Results to User

When providing Go solutions:

  • Use idiomatic Go patterns
  • Always handle errors explicitly
  • Include context propagation
  • Provide test examples
  • Note Go version requirements (generics: 1.18+)

Troubleshooting

"Data race detected"

  • Use go test -race to find races
  • Protect shared state with mutex
  • Consider channels for communication

"Goroutine leak"

  • Ensure channels are closed
  • Use context for cancellation
  • Check for blocking operations

"High memory usage"

  • Profile with pprof
  • Check for slice capacity issues
  • Look for map accumulation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.83%
按下载量换算71

OpenCode

22.11%
按下载量换算55

windsurf

20.05%
按下载量换算50

Antigravity

14.9%
按下载量换算37

trae

7.41%
按下载量换算18

Cursor

3.71%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills