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

go-ops继续行动

Agent Skill

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

总安装

445

周安装

18

GitHub Stars

17

下载量

140
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/0xdarkmatter/claude-mods --skill go-ops

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 适合在代码变更管理和协作事项整理等场景中使用。
  • 可帮助 Agent 围绕仓库状态进行信息梳理和下一步操作建议。
  • 使用时需区分只读查询与写入操作的安全边界。go-ops 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 安装前应确认 token 权限和维护状态,避免触发未授权操作。

SKILL.md

Go Operations

Comprehensive Go skill covering idiomatic patterns, concurrency, and production practices.

Module Quick Start

# New module
go mod init github.com/user/project

# Add dependency
go get github.com/lib/pq@latest

# Tidy (remove unused, add missing)
go mod tidy

# Vendor dependencies
go mod vendor

# Workspace (multi-module)
go work init ./api ./shared
go work use ./cli

Error Handling Decision Tree

What kind of error?
│
├─ Known, expected condition (e.g. "not found")
│  └─ Sentinel error: var ErrNotFound = errors.New("not found")
│     └─ Caller checks: errors.Is(err, ErrNotFound)
│
├─ Need to carry structured data (status code, field name)
│  └─ Custom error type: type ValidationError struct { Field, Message string }
│     └─ Implement Error() string
│     └─ Caller checks: errors.As(err, &validErr)
│
├─ Adding context to an existing error
│  └─ Wrap: fmt.Errorf("load config: %w", err)
│     └─ Preserves original for Is/As checks
│
├─ Truly unrecoverable (corrupted state, programmer bug)
│  └─ panic("invariant violated: ...")
│     └─ Almost never in library code
│
└─ Multiple errors from concurrent work
   └─ errors.Join(err1, err2) or multierr package

Error Wrapping Convention

// Add context at each layer, don't repeat the function name
func LoadUser(id int) (*User, error) {
    row, err := db.Query("SELECT ...", id)
    if err != nil {
        return nil, fmt.Errorf("load user %d: %w", id, err)
    }
    // ...
}

Concurrency Decision Tree

What's the concurrency pattern?
│
├─ Run N independent tasks, collect results
│  └─ errgroup.Group (cancels on first error)
│
├─ Fire-and-forget background work
│  └─ go func() with context for cancellation
│     └─ ALWAYS handle the error or log it
│
├─ Producer/consumer pipeline
│  └─ Channels (buffered for throughput)
│     └─ Close channel when producer is done
│
├─ Rate-limited concurrent work
│  └─ Semaphore: make(chan struct{}, maxConcurrency)
│
├─ Shared mutable state
│  └─ sync.Mutex or sync.RWMutex
│     └─ Prefer channels if the state is simple
│
├─ One-time initialization
│  └─ sync.Once
│
└─ Wait for N goroutines to finish (no error collection)
   └─ sync.WaitGroup

errgroup Quick Start

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

g, ctx := errgroup.WithContext(ctx)
g.SetLimit(10) // max 10 concurrent goroutines

for _, url := range urls {
    g.Go(func() error {
        return fetch(ctx, url)
    })
}

if err := g.Wait(); err != nil {
    return fmt.Errorf("fetch urls: %w", err)
}

Deep dive: Load ./references/concurrency.md for worker pools, fan-out/fan-in, pipeline patterns, context best practices.

Interface Design

Accept interfaces, return structs.
// Good: function accepts interface
func Process(r io.Reader) error { ... }

// Good: return concrete type
func NewServer(cfg Config) *Server { ... }

// Bad: returning interface (hides implementation, prevents extension)
func NewServer(cfg Config) ServerInterface { ... }

Common Stdlib Interfaces

InterfaceMethodsUse For
io.ReaderRead([]byte) (int, error)Any byte source
io.WriterWrite([]byte) (int, error)Any byte sink
io.CloserClose() errorResource cleanup
fmt.StringerString() stringString representation
errorError() stringError values
sort.InterfaceLen, Less, SwapCustom sorting
http.HandlerServeHTTP(w, r)HTTP handlers
encoding.BinaryMarshalerMarshalBinary() ([]byte, error)Binary encoding

Functional Options Pattern

type Option func(*Server)

func WithPort(port int) Option {
    return func(s *Server) { s.port = port }
}

func WithTimeout(d time.Duration) Option {
    return func(s *Server) { s.timeout = d }
}

func NewServer(opts ...Option) *Server {
    s := &Server{port: 8080, timeout: 30 * time.Second} // defaults
    for _, opt := range opts {
        opt(s)
    }
    return s
}

// Usage
srv := NewServer(WithPort(9090), WithTimeout(5*time.Second))

Deep dive: Load ./references/interfaces-generics.md for generics, type constraints, embedding, type assertions.

Testing Quick Reference

// Table-driven test
func TestAdd(t *testing.T) {
    tests := []struct {
        name     string
        a, b     int
        expected int
    }{
        {"positive", 1, 2, 3},
        {"zero", 0, 0, 0},
        {"negative", -1, -2, -3},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got := Add(tt.a, tt.b)
            if got != tt.expected {
                t.Errorf("Add(%d, %d) = %d, want %d", tt.a, tt.b, got, tt.expected)
            }
        })
    }
}
# Run tests
go test ./...

# With coverage
go test -cover -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

# Run specific test
go test -run TestAdd ./pkg/math/

# Benchmarks
go test -bench=. -benchmem ./...

# Race detector
go test -race ./...

# Fuzz testing
go test -fuzz=FuzzParse ./...

Deep dive: Load ./references/testing.md for mocking with interfaces, httptest, testcontainers, golden files.

Common Gotchas

GotchaWhyFix
Nil slice vs empty slicevar s []int is nil, s:= []int{} is empty. json.Marshal gives null vs []Use make([]int, 0) or []int{} if JSON matters
Goroutine leakGoroutine blocked on channel with no reader/writerUse context.WithCancel, always provide exit path
Defer in loopDeferred calls don't run until function returnsWrap loop body in a closure or use explicit cleanup
Interface nil pitfall(*MyType)(nil) assigned to error interface is not == nilReturn nil explicitly, not a nil typed pointer
Range variable captureLoop var reused (pre-Go 1.22)Use go func(v T) {...}(v) or upgrade to Go 1.22+
String concatenation in loopO(n^2) allocationUse strings.Builder
sync.WaitGroup Add after GoRace conditionCall wg.Add(1) before go func()
Unbuffered channel deadlockSend/receive must happen concurrentlyUse buffered channel or separate goroutines
map not safe for concurrent useRace condition, may crashUse sync.Mutex or sync.Map

Project Structure

project/
├── cmd/
│   ├── api/main.go           # Entry points
│   └── worker/main.go
├── internal/                  # Private packages
│   ├── handler/
│   ├── service/
│   └── repository/
├── pkg/                       # Public packages (optional)
├── go.mod
├── go.sum
├── Makefile                   # or justfile
└── .golangci.yml

Deep dive: Load ./references/project-structure.md for workspace mode, build tags, ldflags, linting config.

Performance Quick Reference

# CPU profile
go test -cpuprofile=cpu.prof -bench=. ./...
go tool pprof cpu.prof

# Memory profile
go test -memprofile=mem.prof -bench=. ./...
go tool pprof -alloc_space mem.prof

# Trace
go test -trace=trace.out ./...
go tool trace trace.out

# Escape analysis
go build -gcflags='-m' ./...
OptimizationWhenPattern
Pre-allocate slicesKnown sizemake([]T, 0, n)
strings.BuilderString concatenationvar b strings.Builder
sync.PoolFrequent alloc/free of same typepool.Get() / pool.Put()
Struct field alignmentMemory-sensitiveGroup fields by size (largest first)
Buffer reuseI/O-heavybufio.NewReaderSize(r, 64*1024)

Deep dive: Load ./references/performance.md for pprof walkthrough, benchmarking patterns, escape analysis.

Reference Files

Load these for deep-dive topics. Each is self-contained.

ReferenceWhen to Load
./references/concurrency.mdGoroutines, channels, context, sync primitives, worker pools, pipelines
./references/error-handling.mdError wrapping, sentinel errors, custom types, multi-error, panic/recover
./references/testing.mdTable tests, mocking, httptest, benchmarks, fuzz, testcontainers, golden files
./references/interfaces-generics.mdInterface design, embedding, type assertions, generics, type constraints
./references/project-structure.mdStandard layout, go.mod, workspaces, build tags, ldflags, golangci-lint
./references/performance.mdpprof, trace, benchmarks, escape analysis, sync.Pool, struct alignment

See Also

  • docker-ops - Multi-stage builds for Go binaries (scratch/distroless)
  • ci-cd-ops - Go CI pipelines, caching go modules, goreleaser
  • testing-ops - Cross-language testing strategies

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.87%
按下载量换算52

Claude

31.58%
按下载量换算44

Cursor

18.72%
按下载量换算26

Gemini CLI

9.76%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills