go-interfaces

go-interfaces is a skill for Claude Code, Codex from muratmirgun/gophers. It costs 68 tokens per session (2,088 once invoked), scanned A, original, MIT.

A guide to Go interfaces, which are small contracts describing the methods a type must provide, and to composing types from those contracts.

In plain words
What is it for?
Use it when introducing interfaces, dependency-injection seams, embedded types, pointer or value receivers, or compile-time implementation checks.
Why use it?
It helps avoid oversized or unnecessary abstractions, unclear ownership, receiver mismatches, and panics from unsafe type assertions.

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-interfaces
Any agent
npx skills add muratmirgun/gophers --skill go-interfaces
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-interfaces

README.md
[![agentmods](https://agentmods.dev/badge/skills/muratmirgun/gophers/go-interfaces.svg)](https://agentmods.dev/skills/muratmirgun/gophers/go-interfaces)
Your own site
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-interfaces"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-interfaces.svg" alt="Measured on agentmods" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,088 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.00068 $0.02088
Opus 5 $0.00034 $0.01044
Sonnet 5 $0.00014 $0.00418
Haiku 4.5 $0.00007 $0.00209

Measured 5d ago against content hash ebb229b793df, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

go-interfaces 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 5d 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-interfaces/SKILL.md · 186 lines

How it starts

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

Go Interfaces and Composition

Interfaces in Go are consumer contracts, not implementation hierarchies. They should be small, discovered late, and owned by the package that uses them — not the package that satisfies them.

Core Rules

  1. Accept interfaces, return concrete types. Consumers state what they need; producers expose what they have.
  2. Interfaces belong in the consumer package. Defining an interface next to its sole implementation is almost always wrong.
  3. Don't design with interfaces — discover them. Wait for a second implementation or a test mock to demand one.
  4. The bigger the interface, the weaker the abstraction. Aim for 1–3 methods; compose larger contracts from smaller ones.
  5. Receiver consistency: if any method needs a pointer receiver, give every method a pointer receiver.
  6. Verify satisfaction at compile time with var _ I = (*T)(nil) when the relationship must not break silently.
  7. Use the comma-ok idiom for every type assertion. A bare assertion panics on mismatch.

Decision: Should I Introduce an Interface?

Situation Verdict
Single implementation, no tests need to swap it No interface. Use the concrete type.
Second implementation appears (or is imminent) Extract an interface in the consumer package.
Test needs to fake an external dependency Define a small interface in the consumer; pass a fake.
You want to expose optional behaviour (Flusher, ReaderFrom) Define a tiny interface; check with _, ok := v.(Iface).
You want a stable plugin/SPI boundary Yes, but keep it minimal and version it explicitly.

Read references/consumer-owned-interfaces.md when migrating a producer-defined interface back to the consumer, or when designing a new package boundary.

Accept Interfaces, Return Concrete Types

// Good — consumer defines what it needs
package notify
type Sender interface { Send(to, body string) error }
type Service struct{ s Sender }
func NewService(s Sender) *Service { return &Service{s: s} }

// Good — producer returns a concrete type
package email
type Client struct{ /* ... */ }
func New(cfg Config) *Client { /* ... */ }
func (c *Client) Send(to, body string) error { /* ... */ }

Read the full file on GitHub · 186 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. 5d ago First seen · 186 lines · 68 tokens per session scan A ebb229b793df

Subscribe to this mod's changes

go-interfaces is a skill published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 24d ago), licensed MIT. It adds 68 tokens to every session and 2,088 once invoked, about $0.0003 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

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.

nimadorostkar/Claude-Skills-collection · 38 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

developing-genkit-go

Develop AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers.

google/skills · 60 tokens

programming

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

code-yeongyu/oh-my-openagent · 49 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