go-data-structures

go-data-structures is a skill for Claude Code from muratmirgun/gophers. It costs 92 tokens per session (2,306 once invoked), scanned A, original, MIT.

A set of guidance for choosing and using Go's built-in data containers, such as slices, maps, arrays, and strings.

In plain words
What is it for?
Making implementation and performance decisions for ordered data, key-value data, sets, strings, buffers, and generic containers in Go 1.21 or newer.
Why use it?
It helps avoid common mistakes involving copying, memory allocation, appending values, and choosing the wrong container for a task.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; built for openclaw.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is Read [references/slices-and-maps.md](../../../skills/go-data-structures/references/slices-and-maps.md) for capacity growth, aliasing pitfalls, and 2-D slice pat.

Part of the gophers plugin — 26 skills, 4 agents shipped together

Good fit Making implementation and performance decisions for ordered data, key-value data, sets, strings, buffers, and generic containers in Go 1.21 or newer.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers
agentmods
npx agentmods add skills/muratmirgun/gophers/go-data-structures

Made for: Claude Code.

Or install gophers, the plugin that ships this one along with the rest of its 26 skills, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for go-data-structures

README.md
[![agentmods](https://agentmods.dev/badge/skills/muratmirgun/gophers/go-data-structures/github.svg)](https://agentmods.dev/skills/muratmirgun/gophers/go-data-structures)
Your own site
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-data-structures"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-data-structures/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for go-data-structures

Your own site · 80×15
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-data-structures"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-data-structures.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,306 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00092 $0.02306
Opus 5.5 $0.00037 $0.00922
Sonnet 5.5 $0.00018 $0.00461
Haiku 4.5 $0.00009 $0.00231

Measured 1mo ago against content hash 7a78729d0652, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

go-data-structures scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude-plugin/skills/go-data-structures/SKILL.md · 198 lines

How it starts

The opening of the file, as written. The whole thing — 198 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Data Structures

Pick the structure that fits the access pattern — not the most familiar one. Slices and maps are the workhorses; arrays, container types, and the slices/maps packages cover the rest. Understanding the header layout, growth costs, and copy semantics of each turns most performance questions into one-line decisions.

Core Rules

  1. Slices and maps are reference types — assigning copies the header, not the data. Use slices.Clone / maps.Clone for a true copy.
  2. Preallocate with make([]T, 0, n) and make(map[K]V, n) whenever the size is known or estimable.
  3. Always assign the result of append — the backing array may move.
  4. Use slices and maps packages (Go 1.21+) instead of hand-rolled helpers.
  5. map[K]struct{} is the canonical set — zero-byte values, no boolean ambiguity.
  6. strings.Builder for string building, bytes.Buffer when you need io.Reader/io.Writer.

Picking a Structure

What do you need?
├─ Ordered, fixed compile-time size      → [N]T  array
├─ Ordered, dynamic size                 → []T   slice
│  ├─ Known size               → make([]T, 0, n)
│  └─ JSON output must be []   → []T{} literal (not nil)
├─ Key/value lookup                      → map[K]V
│  ├─ Need a set            → map[K]struct{}
│  └─ Known size            → make(map[K]V, n)
├─ Priority queue / top-k                → container/heap
├─ Frequent middle insertion             → container/list
├─ Fixed-size rolling window             → container/ring
├─ Pure string building                  → strings.Builder
└─ Read+write of bytes                   → bytes.Buffer

Slice Internals

A slice is a 3-word header: pointer, length, capacity. Multiple slices can alias the same backing array — s[1:4] shares memory with s.

Capacity Growth

The exact algorithm has changed across versions; do not rely on it. As of recent Go:

  • len < 256 → capacity roughly doubles.
  • len ≥ 256 → grows by ~25%.
  • Each growth allocates a new backing array and copies — O(n) per growth.

Read the full file on GitHub · 198 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 198 lines · 92 tokens per session scan A 7a78729d0652

Subscribe to this mod's changes

go-data-structures is a skill published in the GitHub repository muratmirgun/gophers (9 stars, last pushed 2mo ago), licensed MIT. It adds 92 tokens to every session and 2,306 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

go

Use when writing Go services, CLIs, or libraries. Covers idiomatic error wrapping, goroutine and context discipline, interface design, table-driven tests, and the race detector. Trigger on "goroutine leak", "how should i wrap this error in go", "race detector is flagging this", "write table-driven tests for this". Do…

nimadorostkar/Claude-Skills-collection · 90 tokens

integrate-arcjet-guard-agent-framework-go

Integrate Arcjet Guard into Microsoft Agent Framework for Go (github.com/microsoft/agent-framework-go). Wrap a functool or MCP tool with GuardTool, guard every tool an agent can see and screen inbound text with GuardMiddleware, or guard any Go function with arcjet.GuardAction. Use when asked to add Arcjet to a Go…

arcjet/skills · 119 tokens

golang-pro

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…

Jeffallan/claude-skills · 95 tokens

programming

Applies strict, modern language practice (typed errors, exhaustive match, tests that can fail) for Python, Rust, TypeScript, and Go. Use for work on .py, .rs, .ts, or .go files.

code-yeongyu/oh-my-openagent · 51 tokens

authoring-go-sdk-tasks

Writes Airflow task logic in Go using the Airflow Go SDK. Use when the user wants to implement Airflow tasks in Go, asks about BundleProvider/RegisterDags, the bundlev1 Registry/Dag interfaces, registering Go tasks (AddTask/AddTaskWithName), dependency injection by parameter type (context.Context, sdk.TIRunContext…

astronomer/agents · 165 tokens

deploying-go-sdk-bundles

Builds, packs, and deploys compiled Airflow Go SDK bundles so the ExecutableCoordinator can run them. Use when the user wants to compile a Go task bundle, asks about go build, go tool airflow-go-pack, the AFBNDL01 self-contained executable bundle, packing or inspecting a bundle, placing it under executablesroot…

astronomer/agents · 146 tokens