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
Supply asset profile
Coding and developer agents
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
Coding agents
I need a coding agent that can understand a repository, edit code, and review pull requests.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add yzfly/skills --skill golang-data-structures
Maintenance
fresh
Pushed today
Risk
Needs review
Dependency or permission surface needs review
GitHub quality
12
58/100 Quality · 67/100 Trust
Coverage tags
Review notes
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 adoption scorecard
Trust, audit, and install readiness at a glance
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Do not auto-installTrust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Human review before install
Choose a stronger alternative or inspect the source manually before any install attempt.
Stars
12 GitHub stars
Repo activity
12 stars, 2 forks
Maintenance
Pushed today
License
MIT
Install
npx skills add yzfly/skills --skill golang-data-structures
Install safety
standard package or runtime install path
Permission surface
shell or command execution, network or browser access
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Review before production
- 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
Install readiness
Install path available
- Install path is available
- Repository evidence is available
- License is declared
- No Agent Proven outcome evidence yet
Agent-readable metadata
Machine-readable decision data for this skill.
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
- RAG and knowledge workflows
- Claude Code teams
- builders willing to evaluate younger projects
- Chunk documents
Suited agents
Install decision
- Command
- npx skills add yzfly/skills --skill golang-data-structures
- Policy
- review
- Human review
- yes
Trust and risk
- Trust
- 59/100
- Audit
- 73/100
- Risk level
- Needs review
Outcome loop
- Endpoint
- /api/agent/outcome
- Event ID
- resolve
- Outcomes
- 5
Install command
npx skills add yzfly/skills --skill golang-data-structuresDo not use when
- teams that need a vendor-supported 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.
- No OpenAgentSkill engagement data yet
Alternative
Frontend Design
171.1K Stars
npx skills add anthropics/skills --skill frontend-design
Alternative
Taste Skill: Anti-Slop Frontend
79.4K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
Alternative
Canvas Design
171.1K Stars
npx skills add anthropics/skills --skill canvas-design
Alternative
Anthropic Brand Guidelines
171.1K Stars
npx skills add anthropics/skills --skill brand-guidelines
Agent safety v2
49/100 · Avoid automatic install
Sparse or mixed signals. Useful for discovery, but not for autonomous installation.
Test manually in an isolated workspace and compare against safer alternatives.
high
Shell or command execution
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Network access
Skill likely fetches remote pages, APIs, repositories, or external services.
- High-risk permission hints: Shell or command execution
- Dependency or permission surface needs review
Install targets
Install this skill in your agent workflow
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this 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 resolve plan
Let an agent verify fit before installing.
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20golang-data-structures%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/yzfly-golang-data-structures/install
Agent should check
- Task fit and alternatives from Resolve API.
- Audit score, trust score, and safety policy warnings.
- Install target compatibility for Codex, Claude Code, Cursor, or CLI.
Copy prompt
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 handoff
Give an agent the install path, not another directory page.
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/yzfly-golang-data-structures/install
LLM text format
/api/skills/yzfly-golang-data-structures/install?format=text
Find alternatives
/api/skills/search?q=golang-data-structures&limit=3
Agent prompt
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 metadata
Agent-readable profile for automatic skill selection.
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/yzfly-golang-data-structures
LLM text
/api/registry/manifest/yzfly-golang-data-structures?format=text
Install alias
/api/registry/install/yzfly-golang-data-structures
Recommend
/api/registry/recommend?task=Use%20golang-data-structures%20in%20an%20agent%20workflow&limit=3
Agent fit
RAG and knowledge
Use-case tags
Platforms
Claude Code
Audit report
Needs review · 73/100
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Needs validation for RAG and knowledge
Do a manual repository review before adding this to an agent workflow.
Role in stack
Needs validation
Primary fit
RAG and knowledge
Trust label
Needs manual review
Install path
Command ready
Use when
- RAG and knowledge workflows
- Claude Code teams
- builders willing to evaluate younger projects
Evidence
- recent repository activity
- install command or GitHub repo available
- 58/100 quality profile
review first
- 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.
- No OpenAgentSkill engagement data yet
Implementation path
- 1Install it in a sandbox agent and run one RAG and knowledge task end to end.
- 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.
Trust profile
Do not auto-install
Trust Score v5 found insufficient evidence for agent installation. Treat this as discovery material, not an executable recommendation.
GitHub adoption
FIX12 GitHub stars
Stars/forks activity
FIX12 stars, 2 forks; issue activity unavailable in current metadata
Recent maintenance
PASSPushed today
License clarity
PASSMIT
Good signals
- AI review approved
- Install path is available
- Repository evidence is available
- Recently maintained repository
- Install command has no obvious high-risk pattern
- Outcome loop is ready but needs first real agent run
Review before install
- 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
- No real agent outcome reports yet
- Human review required before unattended installation
Recommended action
Choose a stronger alternative or inspect the source manually before any install attempt.
Quality profile
Promising candidate for agent workflows
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Use this skill in these scenarios
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.
Workflow fit
Add it to a complete workflow
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.
Alternative shortlist
Compare before you install
Similar skills that may fit this task.
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.
Overview
--- 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)
Technical details
- Version
- 1.0.0
- License
- MIT
- Last updated
- Aug 23, 2026
- Published
- Aug 23, 2026
Decision snapshot
Needs validation
recent repository activity
Audit
Install review
Install and adoption review
- Security
- 74/100
- Maintenance
- 100/100
- Install
- 92/100
Agent-proven evidence
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
- Success rate
- —
- Recent failure
- —
- Outcomes
- 0
- Output quality
- —
- Failed
- 0
- Not relevant
- 0
- Installs
- 0
- Risk blocked
- 0
- Setup needed
- 0
- Production
- 0
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Add to agent workflow
Free and open source. Review the report before installing into production agents.
Growth loop
Share kit
Scenario-led draft for golang-data-structures, ready for a manual X post.
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
Optional reply with install command
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
Listing source
Registry indexed
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
- Creator
- yzfly
- Source
- yzfly/skills
- Indexed by
- OpenAgentSkill community index
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
Claim this skill listing
This Registry indexed listing is attributed to yzfly but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Add the evidence badges to your README
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](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)Author
yzfly
@yzfly
Tags
Platform fit
Health signals
- GitHub stars
- 12
- Quality score
- 31/100
- Last GitHub push
- Aug 23, 2026
- Framework hints
- Unknown
- OpenAgentSkill views
- 0
- Install copies
- 0
- Outbound clicks
- 0
Community signal
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Trust & safety
Do not auto-install
- GitHub adoption12 GitHub starsFIX
- Stars/forks activity12 stars, 2 forks; issue activity unavailable in current metadataFIX
- Recent maintenancePushed todayPASS
- License clarityMITPASS
- README/SKILL.md completenessMetadata includes enough usage and workflow contextPASS
- Dependency/runtime riskcommand execution surface, external package install surfaceCHECK
Related skills
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