Go Style Guide logo

Go Style Guide

Community
madflojo
go-style-guide

Provides Go (Golang) engineering guidance for designing packages, services, and CLIs. Use whenever the task involves Go implementation, refactors, code reviews, API design, package layout, interfaces, constructors/config, error handling, logging, dependency or framework selection, HTTP/service wiring, concurrency/lifecycle, tests, benchmarks, godoc, or maintainability decisions.

Overview

Publishermadflojo
Repositorygo-style-agent-skill
Skill namego-style-guide
Stars
41
Forks
3
Bundled files
10
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by madflojo on GitHub. Read the source before you install it.

Installation

Install the Go Style Guide AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/madflojo/go-style-agent-skill/tree/main/skills/go-style-guide
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/madflojo/go-style-agent-skill.git /tmp/go-style-agent-skill
mkdir -p .claude/skills
cp -r /tmp/go-style-agent-skill/skills/go-style-guide .claude/skills/go-style-guide
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Go Style Guide in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Go Style Guide on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Go Style Guide is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Go (Golang) Style Guide Skill

This skill defines practical Go engineering conventions for humans, coding agents, and production-ready systems.

Use this skill whenever you are working with Go: new code, refactors, reviews, architecture decisions, package design, or test strategy.


TL;DR

  • Design for testability first; inject dependencies and keep logic pure.
  • Prefer Config in -> concrete struct out; validate, default, and document important runtime knobs.
  • Errors are contracts: use sentinels for durable branching; wrap the rest with %w or errors.Join.
  • Keep packages reusable: no hidden globals, no default logging, no surprise side effects.
  • Prefer the standard library before adding dependencies; third-party packages must earn their weight through meaningful, maintained, adopted abstraction.
  • Coverage is a signal, not proof; test edge cases and misuse paths, not just happy paths.
  • Follow "accept interfaces, return structs"; consumers usually define interfaces, shared contract packages are a special case.
  • Keep main.go thin; follow existing repo layout conventions rather than forcing one directory shape.
  • Benchmark hot paths before claiming wins, and run concurrency code with -race.
  • Maintain contracts such as function signatures, config shape, error behavior, and doc comments; they are as important as the code itself.

House Style Disclaimer

This is intentionally opinionated. It favors consistency and long-term maintainability over accommodating every Go style preference. If the target repo has clear local conventions, those conventions usually win.


Compatibility

Examples assume modern Go and use standard-library features such as errors.Join and log/slog. Apply the guide within the constraints of the target repository's supported Go version.


Execution Protocol

Follow this workflow when using the skill for implementation work:

  1. Inspect the repository first. Read existing package layout, constructors, tests, and error conventions before proposing new APIs or moving files.

  2. Define the contract before coding. Decide the package boundary, config shape, concrete return type, sentinel errors, dependency seams, and context or shutdown expectations up front.

  3. Write or update tests early when practical. Start with table-driven unit tests, add fuzz tests for parsing or other input-heavy code, and add benchmarks for performance-sensitive paths.

  4. Implement the smallest maintainable change. Follow the repository's existing layout, keep main.go thin, and avoid introducing new abstractions without a clear boundary.

  5. Run the finishing checks. Format with gofmt (and goimports if the repo uses it), run the relevant go test targets, run go test -race when concurrency is involved, and run benchmarks when claiming performance improvements.

  6. Verify the human-facing contract. Make sure docs, comments, config defaults, and error behavior match the code you are shipping.


Quick Rules Table

TopicRuleReference
TestabilityDesign for confidence, not coverage percentages; test edge and misuse casesreferences/TESTING.md
ConstructorsConfig in -> concrete struct out; validate + default in New; use Config.Validate() when config logic growsreferences/CONFIG.md
ErrorsUse sentinels for durable branching; wrap with %w or errors.Join; keep recover at app boundariesreferences/ERRORS.md
LoggingPackages do not log by default; hot-path logging is a performance decisionreferences/LOGGING.md
DependenciesStandard library first; add third-party packages only when they provide meaningful, maintained valuereferences/LAYOUT.md
Interfaces"Accept interfaces, return structs"; consumers usually define interfacesreferences/INTERFACES.md
DocumentationWrite idiomatic godoc and durable comments; never add agent-context commentsreferences/DOCUMENTATION.md
LayoutKeep packages shallow, avoid junk drawers, and follow repo conventionsreferences/LAYOUT.md
Entry Pointsmain.go is wiring onlyreferences/LAYOUT.md
BenchmarksBenchmark hot paths; use b.ReportAllocs() and compare runs with benchstatreferences/BENCHMARKS.md
TestingTable-driven, stdlib-first, defensive against misuse, and fuzz-heavy where inputs are complexreferences/TESTING.md
ConcurrencyEvery goroutine needs a shutdown path; use context.Context, -race, and jitter where neededreferences/CONCURRENCY.md
ReviewsUse the checklist when reviewing Go changesreferences/REVIEW-CHECKLIST.md

Common Pitfalls

  • Returning interfaces by default instead of concrete types.
  • Treating coverage percentages as proof of correctness.
  • Logging in reusable packages instead of returning errors.
  • Adding frameworks or helper libraries when the standard library is already clear enough.
  • Passing global app config through packages rather than local Config.
  • Leaving critical runtime knobs on dangerous defaults.
  • Forcing a house directory layout onto repos that already have clear conventions.
  • Loading every reference document before you know which topic the task touches.
  • Shipping changes that claim performance wins without benchmarks or concurrency safety without -race.

Core Guidance

Load reference files only when the task needs that topic's detail.

  • App packages own dependency wiring, lifecycle, error policy, logging, and metrics policy.
  • Reusable packages return errors, define local Config or Opts, accept initialized dependencies, and avoid hidden logging or global state.
  • Dependency choices should start with the standard library. Reach for a third-party package only when it solves a real problem, is actively maintained, and earns its transitive cost.
  • Services usually keep cmd/<appname>/main.go thin. Follow established repo layout over forcing pkg/, internal/, or any house shape.
  • Libraries usually keep packages shallow and domain-focused.
  • Constructors prefer New(cfg Config) (*T, error), explicit defaults, validation, concrete returns, and immutable normalized config.
  • Interfaces should be small, boundary-driven, and usually consumer-defined.
  • Tests should be table-driven, stdlib-first, defensive, and run with -race for concurrency-sensitive code.
  • Performance claims need benchmarks.
  • Docs, comments, config defaults, error behavior, and signatures are part of the contract.

Reference Loading

Load only the references needed for the active task:

  • Read references/CONFIG.md for constructors, Config structs, defaults, validation, degraded modes, or logging injection.
  • Read references/INTERFACES.md for interface boundaries, driver patterns, mocks/fakes, or concrete return decisions.
  • Read references/ERRORS.md for sentinel errors, wrapping, typed errors, recover placement, or constructor failures.
  • Read references/LOGGING.md for package logging, slog, log levels, async error surfaces, or payload safety.
  • Read references/TESTING.md for table-driven tests, fuzzing, testdata, integration gates, test helpers, or assertion choices.
  • Read references/CONCURRENCY.md for goroutines, context propagation, graceful shutdown, mutex/atomic/channel choices, jitter, or race testing.
  • Read references/LAYOUT.md for package layout, file naming, main.go, dependency hygiene, struct field layout, or export rules.
  • Read references/DOCUMENTATION.md for package docs, godoc, examples, deprecations, internal comments, or field docs.
  • Read references/BENCHMARKS.md for benchmark shape, allocation reporting, concurrent benchmarks, IO benchmarks, or benchstat.
  • Read references/REVIEW-CHECKLIST.md when reviewing a Go PR or doing a final self-check.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Go Style Guide AI skill do?

Provides Go (Golang) engineering guidance for designing packages, services, and CLIs. Use whenever the task involves Go implementation, refactors, code reviews, API design, package layout, interfaces, constructors/config, error handling, logging, dependency or framework selection, HTTP/service wiring, concurrency/lifecycle, tests, benchmarks, godoc, or maintainability decisions.

Why use Go Style Guide on TypingMind?

Because you install it once and use it with any model. Go Style Guide is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Go Style Guide in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/madflojo/go-style-agent-skill/tree/main/skills/go-style-guide. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Go Style Guide?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Go Style Guide?

As many as you like. As long as a model supports skills, you can use Go Style Guide with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Go Style Guide AI skill free?

Yes. It is published on GitHub by madflojo under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇