golang-data-structures
Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy sem
供给资产档案
编程与开发 Agent
代码审查、仓库分析、测试、CI、GitHub、DevOps 与开发工作流 Skill。
场景
编程 Agent
我需要一个能理解仓库、修改代码并审查 Pull Request 的编程 Agent。
适配 Agent
Claude Code + CLI + Codex
适用于 Codex、Claude Code、Cursor、CLI 或自定义 Agent。
安装
就绪
npx skills add yzfly/skills --skill golang-data-structures
维护状态
新鲜
今天有推送
风险
需审查
Dependency or permission surface needs review
GitHub 质量
12
58/100 质量 · 67/100 信任
覆盖标签
审查说明
Dependency or permission surface needs review · The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
Agent 采用评分卡
一眼查看信任、审计与安装准备度
这些分数综合公开仓库元数据、OpenAgentSkill 审查信号、维护新鲜度与安装准备度。它用于候选筛选,不替代人工审查。
质量
有潜力有用的候选项,但采用前应与替代方案比较。
信任
Do not auto-installTrust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.
审计
需审查对安装准备度、安全元数据、维护情况与采用风险的机器可读审查。
OpenAgentSkill 信任评分 v5
安装前需人工审查
Choose a stronger alternative or inspect the source manually before any install attempt.
Stars
12 个 GitHub Stars
仓库活跃度
12 个 Star,2 个 Fork
维护状态
今天有推送
许可证
MIT
安装
npx skills add yzfly/skills --skill golang-data-structures
安装安全性
标准软件包或运行时安装路径
权限范围
shell or command execution, network or browser access
Agent 结果
暂未有 Agent 结果数据
文档
README/SKILL.md 上下文充分
风险摘要
生产前审查
- The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
- Low GitHub adoption signal
- Quality score needs review
- GitHub adoption: 12 GitHub stars
安装准备度
安装路径可用
- 安装路径可用
- 仓库证据可用
- 已声明许可证
- 暂无 Agent 验证结果证据
Agent 可读元数据
这个 Skill 的机器可读决策数据。
使用此区块或内嵌 JSON 判断 Agent 是否应安装该 Skill、选择替代方案,或先请求人工审查。
适用任务
- RAG and knowledge 工作流
- Claude Code 团队
- builders willing to evaluate younger projects
- Chunk documents
适用 Agent
安装决策
- 命令
- npx skills add yzfly/skills --skill golang-data-structures
- 策略
- 审查
- 人工审查
- 是
信任与风险
- 信任
- 59/100
- 审计
- 73/100
- 风险级别
- 需审查
结果闭环
- 端点
- /api/agent/outcome
- 事件 ID
- resolve
- 结果
- 5
不适用场景
- 需要厂商支持 SLA 的团队
- production agents without a repository review
- Low GitHub adoption signal
- The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
- 暂未有 OpenAgentSkill 使用反馈数据
替代 Skill
Frontend Design
171.1K Stars
npx skills add anthropics/skills --skill frontend-design
替代 Skill
Taste Skill: Anti-Slop Frontend
79.4K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
替代 Skill
Canvas Design
171.1K Stars
npx skills add anthropics/skills --skill canvas-design
替代 Skill
Anthropic Brand Guidelines
171.1K Stars
npx skills add anthropics/skills --skill brand-guidelines
Agent 安全 v2
49/100 · 避免自动安装
Sparse or mixed signals. Useful for discovery, but not for autonomous installation.
Test manually in an isolated workspace and compare against safer alternatives.
高
Shell 或命令执行
Skill 元数据引用了终端、CLI、Shell、子进程或命令执行工作流。
中
网络访问
Skill 可能访问远程页面、API、仓库或外部服务。
- 高风险权限提示:Shell 或命令执行
- Dependency or permission surface needs review
安装目标
在你的 Agent 工作流中安装此 Skill
通过公开安装端点获取命令、安全清单、目标提示词和该 Skill 的规范链接。
OpenAgentSkill CLI
Resolve policy, run the source installer safely, and report a verified install receipt.
$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install yzfly-golang-data-structuresAgent 解析计划
让 Agent 在安装前验证匹配度。
Resolve API 返回首选 Skill、替代方案、安全策略、审计说明、安装目标和可直接执行的提示词,无需抓取此页面。
打开 JSON
/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve 文本
/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
安装交接
/api/skills/yzfly-golang-data-structures/install
Agent 应检查
- 从 Resolve API 检查任务匹配与替代方案。
- 检查审计评分、信任评分和安全策略警告。
- 检查 Codex、Claude Code、Cursor 或 CLI 的安装目标兼容性。
复制提示词
Task: Use golang-data-structures in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/yzfly-golang-data-structures/install
Install command: npx skills add yzfly/skills --skill golang-data-structures
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent 交接
把安装路径交给 Agent,而不是再给一个目录页。
通过公开安装端点获取命令、安全清单、目标提示词和该 Skill 的规范链接。
安装交接
/api/skills/yzfly-golang-data-structures/install
LLM 文本格式
/api/skills/yzfly-golang-data-structures/install?format=text
寻找替代方案
/api/skills/search?q=golang-data-structures&limit=3
Agent 提示词
Use golang-data-structures for this task. Review https://www.openagentskill.com/api/skills/yzfly-golang-data-structures/install, then install with: npx skills add yzfly/skills --skill golang-data-structuresRegistry 元数据
用于自动选择 Skill 的 Agent 可读档案。
本页通过 Registry API 提供相同的决策、信任、审计、场景和安装信号,让 Agent 无需抓取界面即可排序。
Agent 决策面板
Needs validation for RAG and knowledge
在将它加入 Agent 工作流前先人工审查仓库。
栈中角色
需要验证
主要匹配
RAG and knowledge
信任标签
需要人工审查
安装路径
命令已就绪
适用场景
- RAG and knowledge 工作流
- Claude Code 团队
- builders willing to evaluate younger projects
证据
- 仓库近期活跃
- 已提供安装命令或 GitHub 仓库
- 58/100 质量档案
先审查
- Low GitHub adoption signal
- The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
- 暂未有 OpenAgentSkill 使用反馈数据
实施路径
- 1在沙盒 Agent 中安装它,并端到端完成一次RAG and knowledge任务。
- 2Compare output quality, latency, and failure behavior against at least one alternative.
- 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.
信任档案
Do not auto-install
Trust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.
GitHub 采用度
修复12 个 GitHub Stars
Star/Fork 活跃度
修复12 个 Star,2 个 Fork; 当前元数据中没有议题活跃度信息
近期维护
通过今天有推送
许可证清晰度
通过MIT
积极信号
- AI 审查已通过
- 安装路径可用
- 仓库证据可用
- 近期维护的仓库
- 安装命令未发现明显高风险模式
- 结果闭环已就绪,但需要首次真实 Agent 运行
安装前审查
- The skill references other skills (golang-safety, golang-concurrency, golang-design-patterns) that are not included in this submission, which may reduce standalone completeness.
- Low GitHub adoption signal
- Quality score needs review
- GitHub adoption: 12 GitHub stars
- Stars/forks activity: 12 stars, 2 forks; issue activity unavailable in current metadata
- Dependency/runtime risk: command execution surface, external package install surface
- 暂未有真实 Agent 结果报告
- 无人值守安装前需要人工审查
建议操作
Choose a stronger alternative or inspect the source manually before any install attempt.
质量档案
有潜力 适用于 Agent 工作流的候选
有用的候选项,但采用前应与替代方案比较。
工作流匹配
在这些场景使用此 Skill
Search private knowledge
RAG and knowledge
I need my agent to build a RAG workflow over documents and retrieve reliable context.
Build and ship code
Coding agents
I need a coding agent that can understand a repository, edit code, and review pull requests.
Operate web apps
Browser automation
I need my agent to control a browser, fill forms, and verify web app workflows.
工作流匹配
加入完整工作流
Ingest, retrieve, and cite
RAG knowledge base
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Operate and verify web apps
Browser QA agent
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Inspect, patch, and verify code
Coding review agent
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
替代方案短名单
安装前对比
可能适合该任务的相近 Skill。
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
Taste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
Canvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
Anthropic Brand Guidelines
Apply Anthropic official brand colors, typography, and visual standards to appropriate Anthropic-related artifacts.
概览
--- name: golang-data-structures description: "Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals." user-invocable: true license: MIT compatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang. metadata: author: samber version: "1.1.1" openclaw: emoji: "🗃️" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent ---
**Persona:** You are a Go engineer who understands data structure internals. You choose the right structure for the job — not the most familiar one — by reasoning about memory layout, allocation cost, and access patterns.
# Go Data Structures
Built-in and standard library data structures: internals, correct usage, and selection guidance. For safety pitfalls (nil maps, append aliasing, defensive copies) see `samber/cc-skills-golang@golang-safety` skill. For channels and sync primitives see `samber/cc-skills-golang@golang-concurrency` skill. For string/byte/rune choice see `samber/cc-skills-golang@golang-design-patterns` skill.
## Best Practices Summary
1. **Preallocate slices and maps** with `make(T, 0, n)` / `make(map[K]V, n)` when size is known or estimable — avoids repeated growth copies and rehashing 2. **Arrays** SHOULD be preferred over slices only for fixed, compile-time-known sizes (hash digests, IPv4 addresses, matrix dimensions) 3. **NEVER rely on slice capacity growth timing** — the growth algorithm changed between Go versions and may change again; your code should not depend on when a new backing array is allocated 4. **Use `container/heap`** for priority queues, **`container/list`** only when frequent middle insertions are needed, **`container/ring`** for fixed-size circular buffers 5. **`strings.Builder`** MUST be preferred for building strings; **`bytes.Buffer`** MUST be preferred for bidirectional I/O (implements both `io.Reader` and `io.Writer`) 6. Generic data structures SHOULD use the **tightest constraint** possible — `comparable` for keys, custom interfaces for ordering 7. **`unsafe.Pointer`** MUST only follow the 6 valid conversion patterns from the Go spec — NEVER store in a `uintptr` variable across statements 8. **`weak.Pointer[T]`** (Go 1.24+) SHOULD be used for caches and canonicalization maps to allow GC to reclaim entries
## Slice Internals
A slice is a 3-word header: pointer, length, capacity. Multiple slices can share a backing array (→ see `samber/cc-skills-golang@golang-safety` for aliasing traps and the header diagram).
### Capacity Growth
- < 256 elements: capacity doubles - > = 256 elements: grows by ~25% (`newcap += (newcap + 3*256) / 4`) - Each growth copies the entire backing array — O(n)
### Preallocation
```go // Exact size known users := make([]User, 0, len(ids))
// Approximate size known results := make([]Result, 0, estimatedCount)
// Pre-grow before bulk append (Go 1.21+) s = slices.Grow(s, additionalNeeded) ```
### `slices` Package (Go 1.21+)
Key functions: `Sort`/`SortFunc`, `BinarySearch`, `Contains`, `Compact`, `Grow`. For `Clone`, `Equal`, `DeleteFunc` → see `samber/cc-skills-golang@golang-safety` skill.
**[Slice Internals Deep Dive](./references/slice-internals.md)** — Full `slices` package reference, growth mechanics, `len` vs `cap`, header copying, backing array aliasing.
## Map Internals
Maps are hash tables with 8-entry buckets and overflow chains. They are reference types — assigning a map copies the pointer, not the data.
### Preallocation
```go m := make(map[string]*User, len(users)) // avoids rehashing during population ```
### `maps` Package Quick Reference (Go 1.21+)
| Function | Purpose | | ----------------- | ---------------------------- | | `Collect` (1.23+) | Build map from iterator | | `Insert` (1.23+) | Insert entries from iterator | | `All` (1.23+) | Iterator over all entries | | `Keys`, `Values` | Iterators over keys/values |
For `Clone`, `Equal`, sorted iteration → see `samber/cc-skills-golang@golang-safety` skill.
**[Map Internals Deep Dive](./references/map-internals.md)** — How Go maps store and hash data, bucket overflow chains, why maps never shrink (and what to do about it), comparing map performance to alternatives.
## Arrays
Fixed-size, value types. Copied entirely on assignment. Use for compile-time-known sizes:
```go type Digest [32]byte // fixed-size, value type var grid [3][3]int // multi-dimensional cache := map[[2]int]Result{} // arrays are comparable — usable as map keys ```
Prefer slices for everything else — arrays cannot grow and pass by value (expensive for large sizes).
## container/ Standard Library
| Package | Data Structure | Best For | | --- | --- | --- | | `container/list` | Doubly-linked list | LRU caches, frequent middle insertion/removal | | `container/heap` | Min-heap (priority queue) | Top-K, scheduling, Dijkstra | | `container/ring` | Circular buffer | Rolling windows, round-robin | | `bufio` | Buffered reader/writer/scanner | Efficient I/O with small reads/writes |
Container types use `any` (no type safety) — consider generic wrappers. **[Container Patterns, bufio, and Examples](./references/containers.md)** — When to use each container type, generic wrappers to add type safety, and `bufio` patterns for efficient I/O.
## strings.Builder vs bytes.Buffer
Use `strings.Builder` for pure string concatenation (avoids copy on `String()`), `bytes.Buffer` when you need `io.Reader` or byte manipulation. Both support `Grow(n)`. **[Details and comparison](./references/containers.md)**
## Generic Collections (Go 1.18+)
Use the tightest constraint possible. `comparable` for map keys, `cmp.Ordered` for sorting, custom interfaces for domain-specific ordering.
```go type Set[T comparable] map[T]struct{}
func (s Set[T]) Add(v T) { s[v] = struct{}{} } func (s Set[T]) Contains(v T) bool { _, ok := s[v]; return ok } ```
**[Writing Generic Data Structures](./references/generics.md)** — Using Go 1.18+ generics for type-safe containers, understanding constraint satisfaction, and building domain-specific generic types.
## Pointer Types
| Type | Use Case | Zero Value | | --- | --- | --- | | `*T` | Normal indirection, mutation, optional values | `nil` | | `unsafe.Pointer` | FFI, low-level memory layout (6 spec patterns only) | `nil` | | `weak.Pointer[T]` (1.24+) | Caches, canonicalization, weak references | N/A |
**[Pointer Types Deep Dive](./references/pointers.md)** — Normal pointers, `unsafe.Pointer` (the 6 valid spec patterns), and `weak.Pointer[T]` for GC-safe caches that don't prevent cleanup.
## Copy Semantics Quick Reference
| Type | Copy Behavior | Independence | | --- | --- | --- | | `int`, `float`, `bool`, `string` | Value (deep copy) | Fully independent | | `array`, `struct` | Value (deep copy) | Fully independent | | `slice` | Header copied, backing array shared | Use `slices.Clone` | | `map` | Reference copied | Use `maps.Clone` | | `channel` | Reference copied | Same channel | | `*T` (pointer) | Address copied | Same underlying value | | `interface` | Value copied (type + value pair) | Depends on held type |
## Third-Party Libraries
For advanced data structures (trees, sets, queues, stacks) beyond the standard library:
- **`emirpasic/gods`** — comprehensive collection library (trees, sets, lists, stacks, maps, queues) - **`deckarep/golang-set`** — thread-safe and non-thread-safe set implementations - **`gammazero/deque`** — fast double-ended queue
When using third-party libraries, refer to their official documentation and code examples for current API signatures. Context7 can help as a discoverability platform.
## Cross-References
- → See `samber/cc-skills-golang@golang-performance` skill for struct field alignment, memory layout optimization, and cache locality - → See `samber/cc-skills-golang@golang-safety` skill for nil map/slice pitfalls, append aliasing, defensive copying, `slices.Clone`/`Equal` - → See `samber/cc-skills-golang@golang-concurrency` skill for channels, `sync.Map`, `sync.Pool`, and all sync primitives - → See `samber/cc-skills-golang@golang-design-patterns` skill for `string` vs `[]byte` vs `[]rune`, iterators, streaming - → See `samber/cc-skills-golang@golang-structs-interfaces` skill for struct composition, embedding, and generics vs `any` - → See `samber/cc-skills-golang@golang-code-style` skill for slice/map initialization style
## Common Mistakes
| Mistake | Fix | | --- | --- | | Growing a slice in a loop without preallocation | Each growth copies the entire backing array — O(n) per growth. Use `make([]T, 0, n)` or `slices.Grow` | | Using `container/list` when a slice would suffice | Linked lists have poor cache locality (each node is a separate heap allocation). Benchmark first | | `bytes.Buffer` for pure string building | Buffer's `String()` copies the underlying bytes. `strings.Builder` avoids this copy | | `unsafe.Pointer` stored as `uintptr` across statements | GC can move the object between statements — the `uintptr` becomes a dangling reference | | Large struct values in maps (copying overhead) | Map access copies the entire value. Use `map[K]*V` for large value types to avoid the copy |
## References
- [Go Data Structures (Russ Cox)](https://research.swtch.com/godata) - [The Go Memory Model](https://go.dev/ref/mem) - [Effective Go](https://go.dev/doc/effective_go)
技术详情
- 版本
- 1.0.0
- 许可证
- MIT
- 最近更新
- 2026年8月23日
- 发布时间
- 2026年8月23日
决策摘要
需要验证
仓库近期活跃
Agent 验证证据
Agent 验证证据
来自解析、审查、安装和一次小范围运行后的结果报告。
- 成功率
- —
- 近期失败
- —
- 结果
- 0
- 输出质量
- —
- 失败
- 0
- 不相关
- 0
- 安装次数
- 0
- 风险拦截
- 0
- 需要配置
- 0
- 生产环境
- 0
暂时没有 Agent 结果数据。首次 Agent 执行可以通过 /api/agent/outcome 报告成功、需要设置、风险拦截、失败或不相关。
增长闭环
分享工具包
为 golang-data-structures 准备的场景化草稿,可手动发布到 X。
golang-data-structures: Golang data structures — slices (internals, capacity growth, preallocation, slices package),... 12 stars https://www.openagentskill.com/skills/yzfly-golang-data-structures?ref=x
可选:带安装命令的回复
Listing + install path for golang-data-structures: https://www.openagentskill.com/skills/yzfly-golang-data-structures?ref=x Install: npx skills add yzfly/skills --skill golang-data-structures
收录来源
Registry 收录
此列表来自公开来源,维护者认领获批前不会标记为官方。
- 创作者
- yzfly
- 收录方
- OpenAgentSkill 社区索引
归属链接指向公开仓库或创作者主页。创作者可认领列表以更新所有权信号。
认领此 Skill所有者认领
认领此 Skill 页面
这条 Registry 收录 列表归属于 yzfly,但尚未标记为官方。认领后可增加已验证所有者信号,使后续发布、安装和审计更新更值得信赖。
创作者外链工具包
将证据徽章加入你的 README
在开发者评估仓库的位置展示规范页面、当前信任与审计信号,以及真实的 Agent 验证证据。
[](https://www.openagentskill.com/skills/yzfly-golang-data-structures)
[](https://www.openagentskill.com/skills/yzfly-golang-data-structures)
[](https://www.openagentskill.com/skills/yzfly-golang-data-structures/audit)
[](https://www.openagentskill.com/skills/yzfly-golang-data-structures)作者
yzfly
@yzfly
平台适配
健康信号
- GitHub Stars
- 12
- 质量评分
- 31/100
- 最近 GitHub 推送
- 2026年8月23日
- 框架提示
- 未知
- OpenAgentSkill 浏览量
- 0
- 复制安装命令
- 0
- 跳转点击
- 0
社区信号
告诉我们这个 Skill 是否对你的 Agent 工作流有帮助。汇总反馈会持续改善排序。
信任与安全
Do not auto-install
- GitHub 采用度12 个 GitHub Stars修复
- Star/Fork 活跃度12 个 Star,2 个 Fork; 当前元数据中没有议题活跃度信息修复
- 近期维护今天有推送通过
- 许可证清晰度MIT通过
- README/SKILL.md 完整度元数据包含足够的用法与工作流上下文通过
- 依赖与运行时风险command execution surface, external package install surface检查
相关 Skill
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
171.1K StarsTaste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
79.4K StarsCanvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
171.1K StarsAnthropic Brand Guidelines
Apply Anthropic official brand colors, typography, and visual standards to appropriate Anthropic-related artifacts.
171.1K Stars