go-binary-size

go-binary-size is a skill for Claude Code from eduardo-sl/go-agent-skills. It costs 147 tokens per session (1,957 once invoked), scanned A, original, MIT.

A measurement-based guide for making compiled Go programs and their container images smaller. It examines the runtime, dependencies, compiler settings, embedded files, and other sources of size.

In plain words
What is it for?
It is for shrinking command-line tools, release binaries, and container images. It covers linker flags, inlining, CGO, build tags, embedded assets, and dependency analysis.
Why use it?
It replaces guesswork with before-and-after measurements, so you can see which changes actually save space. It also keeps size reductions tied to checks that the program still works.

Skill for Claude Code

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

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is CGO_ENABLED=1 go build -trimpath -o /tmp/base ./cmd/app.

Part of the go-agent-skills plugin — 35 skills shipped together

Good fit It is for shrinking command-line tools, release binaries, and container images. It covers linker flags, inlining, CGO, build tags, embedded assets, and dependency analysis.

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/eduardo-sl/go-agent-skills
agentmods
npx agentmods add skills/eduardo-sl/go-agent-skills/go-binary-size

Made for: Claude Code.

Or install go-agent-skills, the plugin that ships this one along with the rest of its 35 skills.

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-binary-size

README.md
[![agentmods](https://agentmods.dev/badge/skills/eduardo-sl/go-agent-skills/go-binary-size/github.svg)](https://agentmods.dev/skills/eduardo-sl/go-agent-skills/go-binary-size)
Your own site
<a href="https://agentmods.dev/skills/eduardo-sl/go-agent-skills/go-binary-size"><img src="https://agentmods.dev/badge/skills/eduardo-sl/go-agent-skills/go-binary-size/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-binary-size

Your own site · 80×15
<a href="https://agentmods.dev/skills/eduardo-sl/go-agent-skills/go-binary-size"><img src="https://agentmods.dev/badge/skills/eduardo-sl/go-agent-skills/go-binary-size.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 147 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,957 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 181
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
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.00147 $0.01957
Opus 5.5 $0.00059 $0.00783
Sonnet 5.5 $0.00029 $0.00391
Haiku 4.5 $0.00015 $0.00196

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

Security

Grade A, and why

go-binary-size 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 22d 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.

skills/(workflow)/go-binary-size/SKILL.md · 217 lines

How it starts

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

Go Binary Size

A stock Go binary carries the runtime, the garbage collector, full symbol and line tables, and every transitively reachable package. 8-15 MiB for a small CLI is normal. Most of it is removable, but only with measurement — guessing which dependency is heavy is almost always wrong.

Procedure

Never apply a flag without a before and after number.

  1. Build a baseline and record its size.
  2. Find where the bytes are.
  3. Apply one change class at a time, measuring after each.
  4. Verify the binary still runs and its tests still pass.
  5. Report the table of change → bytes saved → cost.

1. Measure First

# Baseline, reproducible
CGO_ENABLED=1 go build -trimpath -o /tmp/base ./cmd/app
ls -l /tmp/base

# Which packages and symbols cost the most
go tool nm -size -sort size /tmp/base | head -40

# Package-level attribution (third-party, more readable)
go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
gsa --web /tmp/base

go version -m /tmp/app prints the module list and build settings baked into the binary — useful to confirm which flags a release actually used.

Also measure compressed size when the artifact ships in a container layer or a release archive. Stripping wins less after gzip; removing a dependency wins more.

gzip -c /tmp/base | wc -c

2. Strip Symbols and DWARF — the largest single win

go build -ldflags="-s -w" -trimpath -o /tmp/stripped ./cmd/app

Typically 25-35% off the raw size.

What this costs, precisely:

  • ✅ Panic messages and goroutine stack traces still work. The runtime uses its own pclntab, which -s -w does not remove.
  • ❌ dlv and gdb can no longer resolve source lines. Do not ship stripped binaries to an environment where you plan to attach a debugger.
  • ⚠️ Some profiling and crash-reporting tools that symbolise externally will degrade. net/http/pprof in-process is unaffected.

Keep an unstripped copy of every release build for post-mortem work.

Add -buildvcs=false when the VCS stamp is not needed. It saves little, but it also removes commit metadata from a distributed artifact.

Read the full file on GitHub · 217 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. 22d ago Changed · +1 lines · +9 tokens per session 3bf1993aef45
  2. 2mo ago First seen · 216 lines · 138 tokens per session scan A b096ec9e8d15

Subscribe to this mod's changes

go-binary-size is a skill published in the GitHub repository eduardo-sl/go-agent-skills (86 stars, last pushed 22d ago), licensed MIT. It adds 147 tokens to every session and 1,957 once invoked, about $0.0006 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-30.

Related

go-binary-size compared with skills from other repositories

go-binary-size next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
go-binary-sizeeduardo-sl/go-agent-skillsSkill8622d agoMITA147Claude Code
audit-release-go-versionopenshift-eng/ai-helpersSkill122yesterdayApache-2.0A68Claude Code
go-install-skilljiushiwon/wg-skillsSkill134yesterdayApache-2.0A48Claude Code, Codex
go-containerslaurigates/claude-pluginsSkill59yesterdayMITB47Claude Code
kubernetes-operator-developmentd-padmanabhan/agent-engineering-handbookSkill20yesterdayMITA72Claude Code, Codex
go-deploynixopus/nixopusSkill1.5k5d agononeA41Claude Code, Codex
golang-k8s-agentAwish021/opencodeSkill114mo agoMITA39Claude Code, Codex