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

go-performance-review进行绩效评估

Agent Skill

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

总安装

1,137

周安装

46

GitHub Stars

56

下载量

357
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/eduardo-sl/go-agent-skills --skill go-performance-review

简介

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

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

SKILL.md

Go Performance Review

Profile first, optimize second. Never optimize without a benchmark proving the problem.

1. Allocation Reduction

Prefer strconv over fmt for primitive conversions:

// ✅ Good — zero allocations for simple conversions
s := strconv.Itoa(42)
s := strconv.FormatFloat(3.14, 'f', 2, 64)

// ❌ Bad — fmt.Sprintf allocates
s := fmt.Sprintf("%d", 42)

Avoid unnecessary string-to-byte conversions:

// ✅ Good — use strings.Builder for concatenation
var b strings.Builder
for _, s := range parts {
    b.WriteString(s)
}
result := b.String()

// ❌ Bad — repeated concatenation allocates on every +
result := ""
for _, s := range parts {
    result += s
}

Preallocate slices and maps when size is known:

// ✅ Good — single allocation
users := make([]User, 0, len(ids))
for _, id := range ids {
    users = append(users, getUser(id))
}

// ✅ Good — map with capacity hint
lookup := make(map[string]User, len(users))

// ❌ Bad — repeated growing
var users []User // starts at 0, grows via doubling

Use sync.Pool for frequently allocated, short-lived objects:

var bufPool = sync.Pool{
    New: func() interface{} {
        return new(bytes.Buffer)
    },
}

func process(data []byte) string {
    buf := bufPool.Get().(*bytes.Buffer)
    defer func() {
        buf.Reset()
        bufPool.Put(buf)
    }()

    buf.Write(data)
    return buf.String()
}

2. Hot Path Optimizations

Avoid interface conversions in tight loops:

// ✅ Good — concrete type in loop
func sum(vals []int64) int64 {
    var total int64
    for _, v := range vals {
        total += v
    }
    return total
}

// ❌ Bad — interface{} causes boxing/unboxing
func sum(vals []interface{}) int64 { ... }

Avoid reflect in performance-critical paths:

If you need reflection-like behavior at scale, use code generation (go generate, stringer, protocol buffers).

Reduce pointer chasing:

// ✅ Good — contiguous memory, cache-friendly
type Points struct {
    X []float64
    Y []float64
}

// ❌ Slower — pointer chasing per element
type Points []*Point

3. Map Performance

// ✅ Use capacity hints
m := make(map[string]int, expectedSize)

// ✅ For read-heavy concurrent access, use sync.Map
// But ONLY when keys are stable — sync.Map has higher overhead
// for writes than a mutex-protected map.

// ✅ For fixed key sets, consider using a slice with index mapping
// instead of a map.

4. Benchmarking

ALWAYS write benchmarks before and after optimization:

func BenchmarkFoo(b *testing.B) {
    // Setup outside the loop
    input := generateInput()

    b.ResetTimer()
    for i := 0; i < b.N; i++ {
        result = Foo(input) // assign to package-level var to prevent elision
    }
}

// Package-level var prevents compiler from eliminating the call
var result string

Run benchmarks with memory profiling:

go test -bench=BenchmarkFoo -benchmem -count=5 ./...

Compare before/after with benchstat:

go test -bench=. -count=10 > old.txt
# make changes
go test -bench=. -count=10 > new.txt
benchstat old.txt new.txt

5. Profiling

CPU profiling:

go test -cpuprofile=cpu.prof -bench=BenchmarkFoo .
go tool pprof cpu.prof

Memory profiling:

go test -memprofile=mem.prof -bench=BenchmarkFoo .
go tool pprof -alloc_space mem.prof

HTTP server profiling (import net/http/pprof):

import _ "net/http/pprof"

// Access at http://localhost:6060/debug/pprof/
go func() {
    log.Println(http.ListenAndServe("localhost:6060", nil))
}()

6. High-Throughput Logging

log/slog is the right default for most services. But when benchmarks show logging is a bottleneck (high-frequency hot paths, >100k log lines/sec), consider zero-allocation loggers.

When slog is not enough:

// slog allocates per log call — fine for most services
slog.Info("request handled",
    slog.String("method", method),
    slog.Int("status", status),
)

// In hot paths where benchmarks prove logging is a bottleneck,
// use zap's zero-allocation core:
logger, _ := zap.NewProduction()
logger.Info("request handled",
    zap.String("method", method),
    zap.Int("status", status),
)
// zap avoids allocations by using a field pool and typed fields

Decision tree:

ScenarioLogger
General service logginglog/slog (stdlib, zero dependencies)
High-frequency hot path (>100k lines/sec)go.uber.org/zap (zero-alloc)
Extreme throughput with JSONgithub.com/rs/zerolog (zero-alloc JSON)

Best of both worlds — use zap as slog backend:

// Use slog API everywhere, backed by zap's performance
zapLogger, _ := zap.NewProduction()
slogHandler := zapslog.NewHandler(zapLogger.Core(), nil)
logger := slog.New(slogHandler)

// Code uses standard slog API — can swap backend without changing callers
logger.Info("request handled",
    slog.String("method", method),
    slog.Int("status", status),
)

Logging anti-patterns in hot paths:

// ❌ Bad — logging inside tight loop
for _, item := range millions {
    slog.Info("processing item", slog.String("id", item.ID))
    process(item)
}

// ✅ Good — sample or batch log
for i, item := range millions {
    process(item)
    if i%10000 == 0 {
        slog.Info("progress", slog.Int("processed", i), slog.Int("total", len(millions)))
    }
}

// ✅ Good — log summary after loop
slog.Info("batch complete", slog.Int("count", len(millions)))

NEVER switch loggers without a benchmark proving the need. slog is fast enough for the vast majority of Go services.

7. Common Anti-Patterns

Anti-PatternFix
fmt.Sprintf for simple int→stringstrconv.Itoa
String concatenation in loopstrings.Builder
Slice without preallocationmake([]T, 0, n)
Map without capacity hintmake(map[K]V, n)
regexp.Compile inside functionCompile once at package level
json.Marshal in hot pathUse code-gen (easyjson, sonic)
Logging in tight loopBatch or sample
defer in very tight inner loopManual cleanup (rare, benchmark first)

Important Caveat

Most Go code is not performance-critical. Readability and correctness ALWAYS take priority over micro-optimizations. Only apply these patterns when:

  1. A benchmark proves this code path is a bottleneck
  2. The optimization is significant (>10% improvement)
  3. The resulting code remains readable and maintainable

Premature optimization is still the root of all evil, even in Go.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Claude

34.1%
按下载量换算122

Codex

33.52%
按下载量换算120

Cursor

18.56%
按下载量换算66

Gemini CLI

9.6%
按下载量换算34

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills