go-code-style

go-code-style is a skill for Claude Code from muratmirgun/gophers. It costs 94 tokens per session (1,924 once invoked), scanned A, original, MIT.

Go guidance for choosing and using data containers such as slices, maps, arrays, strings, and standard container helpers.

In plain words
What is it for?
Use it when storing ordered or keyed data, building strings, making sets, copying collections, preallocating memory, or using Go 1.21 collection packages.
Why use it?
It helps prevent accidental sharing, inefficient memory growth, incorrect append usage, and unsuitable choices for a given access pattern.

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/formatting-and-layout.md](../../../skills/go-code-style/references/formatting-and-layout.md) for line-breaking, multi-line signatures, file/dec.

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

Good fit Use it when storing ordered or keyed data, building strings, making sets, copying collections, preallocating memory, or using Go 1.21 collection packages.

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-code-style

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-code-style

README.md
[![agentmods](https://agentmods.dev/badge/skills/muratmirgun/gophers/go-code-style/github.svg)](https://agentmods.dev/skills/muratmirgun/gophers/go-code-style)
Your own site
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-code-style"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-code-style/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-code-style

Your own site · 80×15
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-code-style"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-code-style.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,924 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.00094 $0.01924
Opus 5.5 $0.00038 $0.00770
Sonnet 5.5 $0.00019 $0.00385
Haiku 4.5 $0.00009 $0.00192

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

Security

Grade A, and why

go-code-style 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 3mo 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-code-style/SKILL.md · 195 lines

How it starts

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

Go Code Style

gofmt handles the mechanical layout. This skill covers the decisions a formatter cannot make: where to break complexity, when to invert an if, when a switch beats an else if chain, and how to pick value vs pointer arguments. The rule of thumb is the Go Proverb: clear is better than clever.

Core Rules

  1. Run gofmt/goimports. No exceptions, no debates.
  2. Handle errors and edge cases first, return early, keep the happy path at minimum indentation.
  3. Eliminate unnecessary else when the if body ends in return/break/continue.
  4. Prefer switch over if/else if chains that compare the same value.
  5. Initialize slices and maps explicitly, never let a nil map reach a write.
  6. Pass small values; pass pointers when mutating or when the type is large (~128B+).

Style Priority Order

Apply in this order when two principles collide.

Priority Question Beats
1. Clarity Can a reader understand intent without extra context? everything else
2. Simplicity Is this the simplest expression of the idea? concision, consistency
3. Concision Does every line earn its place? consistency
4. Maintainability Will this be safe to modify? consistency
5. Consistency Does it match nearby code? —

A "consistent" piece of bad code is still bad code. Clarity wins.

Read references/formatting-and-layout.md for line-breaking, multi-line signatures, file/declaration order.

Control Flow

Early return: keep the happy path flat

func process(data []byte) (*Result, error) {
    if len(data) == 0 {
        return nil, errors.New("empty data")
    }
    parsed, err := parse(data)
    if err != nil {
        return nil, fmt.Errorf("parsing: %w", err)
    }
    return transform(parsed), nil
}

No unnecessary else

When the if body unconditionally exits (return/break/continue), drop the else. For assignments, prefer default-then-override:

Read the full file on GitHub · 195 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. 3mo ago First seen · 195 lines · 94 tokens per session scan A 0c432983045b

Subscribe to this mod's changes

go-code-style is a skill published in the GitHub repository muratmirgun/gophers (9 stars, last pushed 3mo ago), licensed MIT. It adds 94 tokens to every session and 1,924 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

go-code-style compared with skills from other repositories

go-code-style next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
go-code-stylemuratmirgun/gophersSkill93mo agoMITA94Claude Code
gonimadorostkar/Claude-Skills-collectionSkill426d agoMITA90Claude Code
integrate-arcjet-guard-agent-framework-goarcjet/skillsSkill64d agoApache-2.0A119Claude Code, Codex
go-tcp-server-reliabilitysayeed1999/agent-skillsSkill725d agoMITA52Claude Code
go-http-server-reliabilitysayeed1999/agent-skillsSkill725d agoMITA58Claude Code
golang-proJeffallan/claude-skillsSkill13ktodayMITA95Claude Code
programmingcode-yeongyu/oh-my-openagentSkill71ktodaynoneA90Claude Code, Codex