go-code-style

go-code-style is a skill for Claude Code, Codex 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 CodeCodex

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

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/muratmirgun/gophers/go-code-style
Any agent
npx skills add muratmirgun/gophers --skill go-code-style
Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers

Made for: Claude Code, Codex.

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00094 $0.01924
Opus 5 $0.00047 $0.00962
Sonnet 5 $0.00019 $0.00385
Haiku 4.5 $0.00009 $0.00192

Measured 3d ago against content hash 0c432983045b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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. 3d 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 (8 stars, last pushed 23d ago), licensed MIT. It adds 94 tokens to every session and 1,924 once invoked, about $0.0005 per session on Opus 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

django-reviewer

Review Django and Python changes for clarity, consistency, maintainability, ORM or DRF anti-patterns, and project conventions while preserving behavior. Use after Django code changes or when the user explicitly requests review. Report findings by default; apply refinements only when the user expresses explicit edit…

vintasoftware/django-ai-plugins · 69 tokens

gemini-api

Use when the user asks about using Gemini in an enterprise environment or explicitly mentions Vertex AI, Google Cloud, or Agent Platform. Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like multimodal inputs, tools, media…

google/skills · 83 tokens

earnings-recap

Generate a post-earnings analysis for any stock using Yahoo Finance data. Use when the user wants to review what happened after earnings, understand beat/miss results, see stock reaction, or get an earnings recap. Triggers: "AAPL earnings recap", "how did TSLA earnings go", "MSFT earnings results", "did NVDA beat…

himself65/finance-skills · 186 tokens

yfinance-data

Fetch financial and market data using the yfinance Python library. Use this skill whenever the user asks for stock prices, historical data, financial statements, options chains, dividends, earnings, analyst recommendations, or any market data. Triggers include: any mention of stock price, ticker symbol (AAPL, MSFT…

himself65/finance-skills · 161 tokens

skillshare-implement-feature

Implement a feature from a spec file or description using TDD workflow. Use this skill whenever the user asks to: add a new CLI command, implement a feature from a spec, build new functionality, add a flag, create a new internal package, or write Go code for skillshare. This skill enforces test-first development…

runkids/skillshare · 114 tokens

round-the-world

Round-the-world, Circle Pacific, and distance-based award products across alliances. Covers Star Alliance RTW, oneworld Explorer, Lufthansa M&M, Qantas, Cathay, JAL, Aeroplan, and Iberia charts.

borski/travel-hacking-toolkit · 51 tokens