agentsclimarketplace

Golang

Skill DigitalPine/claude-skills/plugins/golang/skills/golang

Setup, audit, and modernize Go projects with 2025 best practices. Startup-friendly with two tiers - quick start (5 minutes, minimal friction) or full setup (production-ready). Use when creating new Go projects or improving existing ones.From its SKILL.md

Install
npx -y skills add DigitalPine/claude-skills --skill golang

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 6 commands, including `go mod init github.com/yourorg/myproject` and 5 more.

SKILL.md

6.6 KB, ~1.8k tokens by cl100k_base, as published. Nobody here has run it

Go Project Setup & Audit

Philosophy

Fast by default, comprehensive when needed.

Most Go projects start as a single main.go. That's fine. Add structure when you feel pain, not before. This skill offers two tiers:

TierWhenTimeLinters
Quick StartNew idea, CLI tool, prototype2 min5 essential
Full SetupGrowing codebase, team project10 min40+ comprehensive

Start with Quick Start. Graduate to Full Setup when:

  • Multiple people contributing
  • Codebase exceeds ~5k lines
  • You're shipping to production users

When to Use

  • "Create a new Go project"
  • "Set up a Go CLI/API/library"
  • "Audit this Go project"
  • "Add linting to my Go project"

Quick Start (Recommended for New Projects)

5 steps, 2 minutes, ready to code:

1. Initialize

mkdir myproject && cd myproject
go mod init github.com/yourorg/myproject

2. Add Essential Tooling

go get -tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
go install github.com/air-verse/air@latest  # Hot reload

3. Copy Minimal Configs

Copy from assets/ to project root:

  • .golangci.minimal.yml.golangci.yml
  • Makefile.minimalMakefile
  • .gitignore
  • air.toml (optional, for hot reload)

Update local-prefixes in .golangci.yml to your module path.

4. Create Entry Point

// main.go
package main

import (
    "log/slog"
    "os"
)

func main() {
    if err := run(); err != nil {
        slog.Error("fatal", "error", err)
        os.Exit(1)
    }
}

func run() error {
    slog.Info("starting")
    // Your code here
    return nil
}

5. Verify

make lint  # Should pass
make test  # Should pass (no tests yet is fine)
make dev   # Hot reload running

Done. Start coding.

Full Setup (Growing Projects)

When Quick Start isn't enough, upgrade:

Structure Upgrade

mkdir -p cmd/myproject internal/{handler,service,config}
mv main.go cmd/myproject/

See references/structure.md for when each directory makes sense.

Linter Upgrade

Replace .golangci.yml with assets/.golangci.yml (full config).

Build Upgrade

Replace Makefile with assets/Makefile (or Taskfile.yml).

Audit Mode

For existing projects, check these in order:

Critical (Fix Now)

CheckCommandFix
No lintingls .golangci.ymlAdd config from assets/
Errors ignoredgrep -r "err :=" | grep -v "if err"Handle or explicitly ignore
No testsfind . -name "*_test.go"Add tests for critical paths

Important (Fix Soon)

CheckIssueFix
go.mod version< go 1.22Update, get loop variable fix
tools.go existsPre-1.24 patternMigrate to tool directive
Bare error returnsreturn err with no contextWrap: fmt.Errorf("op: %w", err)
Using log packageNo structureSwitch to slog

Nice to Have

CheckFix
No MakefileAdd from assets/
No .gitignoreAdd from assets/
Flat structure at >3k LOCConsider cmd/internal/

Quick Reference

NeedReference
"Should I add internal/?"references/structure.md
"What linters matter?"references/linting.md
"How to wrap errors?"references/errors.md
"Testing patterns?"references/testing.md
"What's new in Go 1.25?"references/go-1.25.md

Decision Shortcuts

Web framework?

  • stdlib net/http + chi router (simple, idiomatic)
  • Skip frameworks until you outgrow chi

Database?

  • sqlc (type-safe, generates code from SQL)
  • sqlx if you want more flexibility

Config?

  • os.Getenv() + .env file for dev
  • envconfig if you need struct binding

Logging?

  • slog (stdlib, structured, fast enough)

Assets Summary

FilePurposeWhen
.golangci.minimal.yml5 essential lintersQuick Start
.golangci.yml40+ lintersFull Setup
Makefile.minimalrun/test/lint/devQuick Start
MakefileAll targetsFull Setup
Taskfile.ymlYAML alternativePreference
.gitignoreStandard ignoresAlways
air.tomlHot reload configDevelopment

Anti-Patterns (Don't Do These)

MistakeWhyDo Instead
Create cmd/internal/pkg day 1Over-engineeringStart flat
Enable all linters immediatelyFriction kills velocityStart with 5
Custom error types earlyYAGNIUse fmt.Errorf
Global loggerHard to testInject via struct/context
tools.go fileOutdated (pre-Go 1.24)Use tool directive

The Only Rules

  1. Don't ignore errors - Handle or explicitly _ = fn()
  2. Wrap with context - fmt.Errorf("operation: %w", err)
  3. Run the linter - make lint before commit
  4. Write some tests - At least for the tricky parts

Everything else is optional until it isn't.

Containerization

Cross-Compilation (Recommended on Apple Silicon)

Go's built-in cross-compilation is simpler and more reliable than Docker multi-stage builds on Apple Silicon:

# Build for Linux from Mac
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o app-linux-amd64 .

# Build for multiple platforms
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o app-amd64 .
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o app-arm64 .

Why native cross-compilation?

  • Docker buildx QEMU emulation segfaults with Go 1.24+ on Apple Silicon
  • Go's cross-compiler is fast and reliable
  • No Docker needed for the compilation step

Dockerfile Pattern (Pre-Built Binary)

FROM alpine:latest
WORKDIR /app
COPY app-linux-amd64 ./app
RUN chmod +x ./app && addgroup -S app && adduser -S app -G app
USER app
CMD ["./app"]

Build and push:

docker buildx build --platform linux/amd64 -t myregistry/myapp:latest --push .

When to Use Multi-Stage Builds

Multi-stage Docker builds (compile inside Docker) still work for:

  • CI/CD on Linux runners
  • ARM64-to-ARM64 builds on Apple Silicon
  • When you need reproducible builds without local Go installation

But avoid multi-stage with --platform linux/amd64 on Apple Silicon Macs.

Version Info

  • Go: 1.25 (latest stable)
  • golangci-lint: v2.8+ (uses formatters section for goimports)
  • Skill Updated: January 2026

What ships with it: 12 files

45.5 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.