Logo di Go Style Guide

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.

Panoramica

Pubblicato damadflojo
Repositorygo-style-agent-skill
Nome della skillgo-style-guide
Stelle
41
Fork
3
File inclusi
10
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 10

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da madflojo su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Go Style Guide in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/madflojo/go-style-agent-skill/tree/main/skills/go-style-guide
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Go Style Guide in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Go Style Guide non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Go Style Guide non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Go Style Guide su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Go Style Guide è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Go Style Guide in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/madflojo/go-style-agent-skill/tree/main/skills/go-style-guide. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Go Style Guide?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Go Style Guide?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Go Style Guide: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Go Style Guide è gratuita?

Sì. È pubblicata su GitHub da madflojo con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇