Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

use-modern-go使用现代围棋

Agent Skill

use-modern-go 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

6,864

周安装

286

GitHub Stars

639

下载量

2,288
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/jetbrains/go-modern-guidelines --skill use-modern-go

简介

use-modern-go 用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 建议结合来源仓库和原始 README 核验具体用法和功能边界。

SKILL.md

Modern Go Guidelines

Detected Go Version

!grep -rh "^go " --include="go.mod". 2>/dev/null | cut -d' ' -f2 | sort | uniq -c | sort -nr | head -1 | xargs | cut -d' ' -f2 | grep. || echo unknown

How to Use This Skill

DO NOT search for go.mod files or try to detect the version yourself. Use ONLY the version shown above.

If version detected (not "unknown"):

  • Say: "This project is using Go X.XX, so I’ll stick to modern Go best practices and freely use language features up to and including this version. If you’d prefer a different target version, just let me know."
  • Do NOT list features, do NOT ask for confirmation

If version is "unknown":

  • Say: "Could not detect Go version in this repository"
  • Use AskUserQuestion: "Which Go version should I target?" → [1.23] / [1.24] / [1.25] / [1.26]

When writing Go code, use ALL features from this document up to the target version:

  • Prefer modern built-ins and packages (slices, maps, cmp) over legacy patterns
  • Never use features from newer Go versions than the target
  • Never use outdated patterns when a modern alternative is available

Features by Go Version

Go 1.0+

  • time.Since: time.Since(start) instead of time.Now().Sub(start)

Go 1.8+

  • time.Until: time.Until(deadline) instead of deadline.Sub(time.Now())

Go 1.13+

  • errors.Is: errors.Is(err, target) instead of err == target (works with wrapped errors)

Go 1.18+

  • any: Use any instead of interface{}
  • bytes.Cut: before, after, found:= bytes.Cut(b, sep) instead of Index+slice
  • strings.Cut: before, after, found:= strings.Cut(s, sep)

Go 1.19+

  • fmt.Appendf: buf = fmt.Appendf(buf, "x=%d", x) instead of []byte(fmt.Sprintf(...))
  • atomic.Bool/atomic.Int64/atomic.Pointer[T]: Type-safe atomics instead of atomic.StoreInt32
var flag atomic.Bool
flag.Store(true)
if flag.Load() { ... }

var ptr atomic.Pointer[Config]
ptr.Store(cfg)

Go 1.20+

  • strings.Clone: strings.Clone(s) to copy string without sharing memory
  • bytes.Clone: bytes.Clone(b) to copy byte slice
  • strings.CutPrefix/CutSuffix: if rest, ok:= strings.CutPrefix(s, "pre:"); ok {...}
  • errors.Join: errors.Join(err1, err2) to combine multiple errors
  • context.WithCancelCause: ctx, cancel:= context.WithCancelCause(parent) then cancel(err)
  • context.Cause: context.Cause(ctx) to get the error that caused cancellation

Go 1.21+

Built-ins:

  • min/max: max(a, b) instead of if/else comparisons
  • clear: clear(m) to delete all map entries, clear(s) to zero slice elements

slices package:

  • slices.Contains: slices.Contains(items, x) instead of manual loops
  • slices.Index: slices.Index(items, x) returns index (-1 if not found)
  • slices.IndexFunc: slices.IndexFunc(items, func(item T) bool {return item.ID == id})
  • slices.SortFunc: slices.SortFunc(items, func(a, b T) int {return cmp.Compare(a.X, b.X)})
  • slices.Sort: slices.Sort(items) for ordered types
  • slices.Max/slices.Min: slices.Max(items) instead of manual loop
  • slices.Reverse: slices.Reverse(items) instead of manual swap loop
  • slices.Compact: slices.Compact(items) removes consecutive duplicates in-place
  • slices.Clip: slices.Clip(s) removes unused capacity
  • slices.Clone: slices.Clone(s) creates a copy

maps package:

  • maps.Clone: maps.Clone(m) instead of manual map iteration
  • maps.Copy: maps.Copy(dst, src) copies entries from src to dst
  • maps.DeleteFunc: maps.DeleteFunc(m, func(k K, v V) bool {return condition})

sync package:

  • sync.OnceFunc: f:= sync.OnceFunc(func() {...}) instead of sync.Once + wrapper
  • sync.OnceValue: getter:= sync.OnceValue(func() T {return computeValue()})

context package:

  • context.AfterFunc: stop:= context.AfterFunc(ctx, cleanup) runs cleanup on cancellation
  • context.WithTimeoutCause: ctx, cancel:= context.WithTimeoutCause(parent, d, err)
  • context.WithDeadlineCause: Similar with deadline instead of duration

Go 1.22+

Loops:

  • for i:= range n: for i:= range len(items) instead of for i:= 0; i < len(items); i++
  • Loop variables are now safe to capture in goroutines (each iteration has its own copy)

cmp package:

  • cmp.Or: cmp.Or(flag, env, config, "default") returns first non-zero value
// Instead of:
name := os.Getenv("NAME")
if name == "" {
    name = "default"
}
// Use:
name := cmp.Or(os.Getenv("NAME"), "default")

reflect package:

  • reflect.TypeFor: reflect.TypeFor[T]() instead of reflect.TypeOf((*T)(nil)).Elem()

net/http:

  • Enhanced http.ServeMux patterns: mux.HandleFunc("GET /api/{id}", handler) with method and path params
  • r.PathValue("id") to get path parameters

Go 1.23+

  • maps.Keys(m) / maps.Values(m) return iterators
  • slices.Collect(iter) not manual loop to build slice from iterator
  • slices.Sorted(iter) to collect and sort in one step
keys := slices.Collect(maps.Keys(m))       // not: for k := range m { keys = append(keys, k) }
sortedKeys := slices.Sorted(maps.Keys(m))  // collect + sort
for k := range maps.Keys(m) { process(k) } // iterate directly

time package

  • time.Tick: Use time.Tick freely — as of Go 1.23, the garbage collector can recover unreferenced tickers, even if they haven't been stopped. The Stop method is no longer necessary to help the garbage collector. There is no longer any reason to prefer NewTicker when Tick will do.

Go 1.24+

  • t.Context() not context.WithCancel(context.Background()) in tests. ALWAYS use t.Context() when a test function needs a context.

Before:

func TestFoo(t *testing.T) {
    ctx, cancel := context.WithCancel(context.Background())
    defer cancel()
    result := doSomething(ctx)
}

After:

func TestFoo(t *testing.T) {
    ctx := t.Context()
    result := doSomething(ctx)
}
  • omitzero not omitempty in JSON struct tags. ALWAYS use omitzero for time.Duration, time.Time, structs, slices, maps.

Before:

type Config struct {
    Timeout time.Duration `json:"timeout,omitempty"` // doesn't work for Duration!
}

After:

type Config struct {
    Timeout time.Duration `json:"timeout,omitzero"`
}
  • b.Loop() not for i:= 0; i < b.N; i++ in benchmarks. ALWAYS use b.Loop() for the main loop in benchmark functions.

Before:

func BenchmarkFoo(b *testing.B) {
    for i := 0; i < b.N; i++ {
        doWork()
    }
}

After:

func BenchmarkFoo(b *testing.B) {
    for b.Loop() {
        doWork()
    }
}
  • strings.SplitSeq not strings.Split when iterating. ALWAYS use SplitSeq/FieldsSeq when iterating over split results in a for-range loop.

Before:

for _, part := range strings.Split(s, ",") {
    process(part)
}

After:

for part := range strings.SplitSeq(s, ",") {
    process(part)
}

Also: strings.FieldsSeq, bytes.SplitSeq, bytes.FieldsSeq.

Go 1.25+

  • wg.Go(fn) not wg.Add(1) + go func() {defer wg.Done();...}(). ALWAYS use wg.Go() when spawning goroutines with sync.WaitGroup.

Before:

var wg sync.WaitGroup
for _, item := range items {
    wg.Add(1)
    go func() {
        defer wg.Done()
        process(item)
    }()
}
wg.Wait()

After:

var wg sync.WaitGroup
for _, item := range items {
    wg.Go(func() {
        process(item)
    })
}
wg.Wait()

Go 1.26+

  • new(val) not x:= val; &x — returns pointer to any value. Go 1.26 extends new() to accept expressions, not just types. Type is inferred: new(0) → *int, new("s") → *string, new(T{}) → *T. DO NOT use x:= val; &x pattern — always use new(val) directly. DO NOT use redundant casts like new(int(0)) — just write new(0). Common use case: struct fields with pointer types.

Before:

timeout := 30
debug := true
cfg := Config{
    Timeout: &timeout,
    Debug:   &debug,
}

After:

cfg := Config{
    Timeout: new(30),   // *int
    Debug:   new(true), // *bool
}
  • errors.AsType[T](err) not errors.As(err, &target). ALWAYS use errors.AsType when checking if error matches a specific type.

Before:

var pathErr *os.PathError
if errors.As(err, &pathErr) {
    handle(pathErr)
}

After:

if pathErr, ok := errors.AsType[*os.PathError](err); ok {
    handle(pathErr)
}

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.65%
按下载量换算884

Claude

31.27%
按下载量换算715

Cursor

17.58%
按下载量换算402

Gemini CLI

8.95%
按下载量换算205

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/jetbrains/go-modern-guidelines --skill use-modern-go 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

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

来源信息

继续浏览同类 Skills