golang-code-style

Revoir · 64
Indexé dans Registry

Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `sa

Verified installs0
Stars3.0K
Version1.0.0
Qualité82/100 · Solide
Confiance64/100 · Sandbox uniquement
Audit81/100 · Revue nécessaire

Profil de l’actif

Agents de code et de développement

Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.

Voir la catégorie

Scénario

Agents de code

I need a coding agent that can understand a repository, edit code, and review pull requests.

Adéquation Agent

Claude Code + OpenAI Agents + CLI

Compatible avec Codex, Claude Code, Cursor, CLI ou des Agents personnalisés.

Installer

Prêt

npx skills add samber/cc-skills-golang --skill golang-code-style

Maintenance

À jour

2 jours depuis le dernier push

Risque

Revue nécessaire

Dependency or permission surface needs review

Qualité GitHub

3.0K

82/100 Qualité · 72/100 Confiance

Tags de couverture

CodingAgents de codeAgents de codeagent-skill

Notes de revue

Dependency or permission surface needs review · Permission surface may require sandboxing

Carte d’adoption Agent

Confiance, audit et préparation à l’installation en un coup d’œil

Ces scores combinent les métadonnées publiques du dépôt, les signaux de revue OpenAgentSkill, la fraîcheur de maintenance et la préparation à l’installation. Ils servent à présélectionner et ne remplacent pas la revue humaine.

Qualité

Solide
82

Solid option that is likely worth shortlisting for production workflows.

Confiance

Sandbox uniquement
64

Candidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.

Audit

Revue nécessaire
81

Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.

Trust Score OpenAgentSkill v5

Revue humaine avant installation

Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.

CodexClaude CodeCursorOpenAgentSkill CLI

Stars

3.0K stars GitHub

Activité du dépôt

3.0K stars et 197 forks

Maintenance

2 jours depuis le dernier push

Licence

MIT

Installer

npx skills add samber/cc-skills-golang --skill golang-code-style

Sécurité d’installation

Chemin d’installation standard de package ou runtime

Surface de permissions

shell or command execution, filesystem or document access

Résultats Agent

Pas encore de données de résultats Agent

Documentation

Contexte README/SKILL.md solide

Résumé des risques

Revoir avant production

  • The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
  • Financial research output is not financial advice; require human review before any live investment decision.
  • Quality score needs review
  • Permission surface needs review: shell or command execution, filesystem or document access

Préparation à l’installation

Chemin d’installation disponible

  • Le chemin d’installation est disponible
  • La preuve du dépôt est disponible
  • La licence est déclarée
  • Pas encore de preuve de résultat Agent-Proven

Métadonnées lisibles par Agent

Données de décision lisibles par machine pour ce skill.

Utilisez ce bloc ou le JSON intégré pour décider si un Agent doit installer ce skill, choisir une alternative ou demander d’abord une revue humaine.

Ouvrir JSON

Tâches adaptées

  • workflows Agents de code
  • Équipes Claude Code
  • Équipes qui valorisent les signaux d’adoption GitHub
  • Inspect source files

Agents adaptés

CodexClaude CodeCursorOpenAgentSkill CLIOpenAI AgentsCLI

Décision d’installation

Commande
npx skills add samber/cc-skills-golang --skill golang-code-style
Politique
Revoir
Revue humaine
Oui

Confiance et risque

Confiance
64/100
Audit
81/100
Niveau de risque
Revue nécessaire

Boucle de résultat

Endpoint
/api/agent/outcome
ID d’événement
resolve
Résultats
5

Commande d’installation

npx skills add samber/cc-skills-golang --skill golang-code-style

Ne pas utiliser quand

  • Équipes qui nécessitent un SLA soutenu par le fournisseur
  • production agents without a repository review
  • The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
  • Indices de permissions à haut risque : exécution shell ou de commande
  • Dependency or permission surface needs review

Sécurité Agent v2

45/100 · Éviter l’installation automatique

ExpérimentalRevoir

Sparse or mixed signals. Useful for discovery, but not for autonomous installation.

Test manually in an isolated workspace and compare against safer alternatives.

Résoudre via API

Élevé

Exécution shell ou de commande

Les métadonnées de la skill font référence à des workflows de terminal, CLI, shell, sous-processus ou exécution de commande.

Moyen

Browser automation

Skill may drive a browser or interact with web pages.

Moyen

Accès réseau

La skill récupère probablement des pages distantes, API, dépôts ou services externes.

Moyen

Accès au système de fichiers

La skill peut lire ou écrire des fichiers de projet, documents, artefacts générés ou l’état local de l’espace de travail.

  • Indices de permissions à haut risque : exécution shell ou de commande
  • Dependency or permission surface needs review

Cibles d’installation

Installer ce skill dans votre workflow Agent

Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.

skill install

OpenAgentSkill CLI

Resolve policy, run the source installer safely, and report a verified install receipt.

$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install samber-golang-code-style

Plan de résolution Agent

Laissez un Agent vérifier la pertinence avant l’installation.

L’API Resolve renvoie la skill sélectionnée, des alternatives, la politique de sécurité, les notes d’audit, la cible d’installation et un prompt prêt à l’emploi.

Ouvrir le plan texte

L’Agent doit vérifier

  • Task fit and alternatives from Resolve API.
  • Audit score, trust score, and safety policy warnings.
  • Install target compatibility for Codex, Claude Code, Cursor, or CLI.

Copier le prompt

Task: Use golang-code-style in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-code-style%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/samber-golang-code-style/install
Install command: npx skills add samber/cc-skills-golang --skill golang-code-style
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.

Relais Agent

Donnez à l’Agent le chemin d’installation, pas un autre annuaire.

Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.

Ouvrir l’API d’installation

Prompt Agent

Use golang-code-style for this task. Review https://www.openagentskill.com/api/skills/samber-golang-code-style/install, then install with: npx skills add samber/cc-skills-golang --skill golang-code-style

Métadonnées Registry

Profil lisible par Agent pour la sélection automatique de skills.

L’API Registry fournit les signaux de décision, confiance, audit, cas d’usage et installation sans analyser l’interface.

Ouvrir Manifest

Adéquation Agent

95/100

Agents de code

Plateformes

Claude Code, OpenAI Agents

Rapport d’audit

Revue nécessaire · 81/100

Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.

Voir le rapport d’auditVoir le rapport d’évaluation

Panneau de décision Agent

Choix principal pour Agents de code

Use this as a leading candidate, then validate the README and install path in your own agent stack.

95
Préparation
Adopter
Étape

Rôle dans la pile

Choix principal

Pertinence principale

Agents de code

Libellé de confiance

Prêt pour la production

Chemin d’installation

Commande prête

À utiliser lorsque

  • workflows Agents de code
  • Équipes Claude Code
  • Équipes qui valorisent les signaux d’adoption GitHub

Preuves

  • 3,010 stars GitHub
  • recent repository activity
  • install command or GitHub repo available
  • profil qualité 82/100
  • 4 événements OpenAgentSkill

revoir d’abord

  • The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.

Chemin d’implémentation

  1. 1Installez-le dans un Agent en sandbox et exécutez une tâche de Agents de code de bout en bout.
  2. 2Compare output quality, latency, and failure behavior against at least one alternative.
  3. 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.

Profil de confiance

Sandbox uniquement

Candidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.

64
Trust Score OpenAgentSkill

Adoption GitHub

Validé

3.0K stars GitHub

Activité stars/forks

Info

3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuelles

Maintenance récente

Validé

2 jours depuis le dernier push

Clarté de licence

Validé

MIT

Signaux positifs

  • Revue IA approuvée
  • Le chemin d’installation est disponible
  • La preuve du dépôt est disponible
  • Dépôt maintenu récemment
  • Signal d’adoption GitHub significatif
  • La commande d’installation ne présente aucun motif de haut risque évident
  • La boucle de résultats est prête mais nécessite la première exécution réelle de l’Agent

Réviser avant installation

  • The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
  • Financial research output is not financial advice; require human review before any live investment decision.
  • Quality score needs review
  • Permission surface needs review: shell or command execution, filesystem or document access
  • Dependency/runtime risk: command execution surface, network or browser surface
  • Permission surface: shell or command execution, filesystem or document access
  • Pas encore de rapports de résultats Agent réels
  • Une revue humaine est requise avant une installation sans surveillance

Action recommandée

Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.

Profil qualité

Solide candidat pour les workflows Agent

Solid option that is likely worth shortlisting for production workflows.

82
Stars GitHub
3.0K
Actualité
il y a 2 jours
Prêt à installer
Oui
Licence
MIT
Réviser avant installation: The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.

Adéquation au workflow

Utilisez cette skill dans ces scénarios

Adéquation au workflow

Ajouter à un workflow complet

Liste d’alternatives

Comparer avant installation

Similar skills that may fit this task.

Tout comparer

Vue d’ensemble

--- name: golang-code-style description: "Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill)." user-invocable: true license: MIT compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang. metadata: author: samber version: "1.3.0" openclaw: emoji: "🎨" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent paths: - "**/*.go" ---

**Orchestration mode:** Fan out the sub-agents described in the "Parallelizing Code Style Reviews" section, each covering an independent style concern, when reviewing code style across a large codebase, and merge their findings. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.

> **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-code-style` skill takes precedence.

# Go Code Style

Style rules that require human judgment — linters handle formatting, this skill handles clarity. For naming see `samber/cc-skills-golang@golang-naming` skill; for design patterns see `samber/cc-skills-golang@golang-design-patterns` skill; for struct/interface design see `samber/cc-skills-golang@golang-structs-interfaces` skill.

> "Clear is better than clever." — Go Proverbs

When ignoring a rule, add a comment to the code.

## Line Length & Breaking

No rigid line limit, but lines beyond ~120 characters MUST be broken. Break at **semantic boundaries**, not arbitrary column counts. Function calls with 4+ arguments MUST use one argument per line — even when the prompt asks for single-line code:

```go // Good — each argument on its own line, closing paren separate mux.HandleFunc("/api/users", func(w http.ResponseWriter, r *http.Request) { handleUsers( w, r, serviceName, cfg, logger, authMiddleware, ) }) ```

When a function signature is too long, the real fix is often **fewer parameters** (use an options struct) rather than better line wrapping. For multi-line signatures, put each parameter on its own line.

## Variable Declarations

SHOULD use `:=` for non-zero values, `var` for zero-value initialization. The form signals intent: `var` means "this starts at zero."

```go var count int // zero value, set later name := "default" // non-zero, := is appropriate var buf bytes.Buffer // zero value is ready to use ```

### Slice & Map Initialization

Slices and maps MUST be initialized explicitly, never nil. Nil maps panic on write; nil slices serialize to `null` in JSON (vs `[]` for empty slices), surprising API consumers.

```go users := []User{} // always initialized m := map[string]int{} // always initialized users := make([]User, 0, len(ids)) // preallocate when capacity is known m := make(map[string]int, len(items)) // preallocate when size is known ```

Do not preallocate speculatively — `make([]T, 0, 1000)` wastes memory when the common case is 10 items.

### Composite Literals

Composite literals MUST use field names — positional fields break when the type adds or reorders fields:

```go srv := &http.Server{ Addr: ":8080", ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, } ```

## Control Flow

### Reduce Nesting

Errors and edge cases MUST be handled first (early return). Keep the happy path at minimal indentation:

```go func process(data []byte) (*Result, error) { if len(data) == 0 { return nil, errors.New("empty data") }

parsed, err := parse(data) if err != nil { return nil, fmt.Errorf("parsing: %w", err) }

return transform(parsed), nil } ```

### Eliminate Unnecessary `else`

When the `if` body ends with `return`/`break`/`continue`, the `else` MUST be dropped. Use default-then-override for simple assignments — assign a default, then override with independent conditions or a `switch`:

```go // Good — default-then-override with switch (cleanest for mutually exclusive overrides) level := slog.LevelInfo switch { case debug: level = slog.LevelDebug case verbose: level = slog.LevelWarn }

// Bad — else-if chain hides that there's a default if debug { level = slog.LevelDebug } else if verbose { level = slog.LevelWarn } else { level = slog.LevelInfo } ```

### Complex Conditions & Init Scope

When an `if` condition has 3+ operands, MUST extract into named booleans — a wall of `||` is unreadable and hides business logic. Keep expensive checks inline for short-circuit benefit. [Details](./references/details.md)

```go // Good — named booleans make intent clear isAdmin := user.Role == RoleAdmin isOwner := resource.OwnerID == user.ID isPublicVerified := resource.IsPublic && user.IsVerified if isAdmin || isOwner || isPublicVerified || permissions.Contains(PermOverride) { allow() } ```

Scope variables to `if` blocks when only needed for the check:

```go if err := validate(input); err != nil { return err } ```

### Switch Over If-Else Chains

When comparing the same variable multiple times, prefer `switch`:

```go switch status { case StatusActive: activate() case StatusInactive: deactivate() default: panic(fmt.Sprintf("unexpected status: %d", status)) } ```

## Function Design

- Functions SHOULD be **short and focused** — one function, one job. - Functions SHOULD have **≤4 parameters**. Beyond that, use an options struct (see `samber/cc-skills-golang@golang-design-patterns` skill). - **Parameter order**: `context.Context` first, then inputs, then output destinations. - Naked returns help in very short functions (1-3 lines) where return values are obvious, but become confusing when readers must scroll to find what's returned — name returns explicitly in longer functions.

```go func FetchUser(ctx context.Context, id string) (*User, error) func SendEmail(ctx context.Context, msg EmailMessage) error // grouped into struct ```

### Prefer `range` for Iteration

SHOULD use `range` over index-based loops. Use `range n` (Go 1.22+) for simple counting.

```go for _, user := range users { process(user) } ```

## Value vs Pointer Arguments

Pass small types (`string`, `int`, `bool`, `time.Time`) by value. Use pointers when mutating, for large structs (~128+ bytes), or when nil is meaningful. [Details](./references/details.md)

## Code Organization Within Files

- **Group related declarations**: type, constructor, methods together - **Order**: package doc, imports, constants, types, constructors, methods, helpers - **One primary type per file** when it has significant methods - **Blank imports** (`_ "pkg"`) register side effects (init functions). Restricting them to `main` and test packages makes side effects visible at the application root, not hidden in library code - **Dot imports** pollute the namespace and make it impossible to tell where a name comes from — never use in library code - **Unexport aggressively** — you can always export later; unexporting is a breaking change. → See `samber/cc-skills-golang@golang-gopls` skill to unexport safely — its rename updates every call site atomically and refuses the change when lowercasing a method would break interface satisfaction, a breakage grep/sed silently ships.

## String Handling

Use `strconv` for simple conversions (faster), `fmt.Sprintf` for complex formatting. Use `%q` in error messages to make string boundaries visible. Use `strings.Builder` for loops, `+` for simple concatenation.

## Type Conversions

Prefer explicit, narrow conversions. Use generics over `any` when a concrete type will do:

```go func Contains[T comparable](slice []T, target T) bool // not []any ```

## Philosophy

- **"A little copying is better than a little dependency"** - **Use `slices` and `maps` standard packages**; for filter/group-by/chunk, use `github.com/samber/lo` - **"Reflection is never clear"** — avoid `reflect` unless necessary - **Don't abstract prematurely** — extract when the pattern is stable - **Minimize public surface** — every exported name is a commitment

## Parallelizing Code Style Reviews

When reviewing code style across a large codebase, use up to 5 parallel sub-agents, each targeting an independent style concern (e.g. control flow, function design, variable declarations, string handling, code organization).

## Enforce with Linters

Many rules are enforced automatically: `gofmt`, `gofumpt`, `goimports`, `gocritic`, `revive`, `wsl_v5`. → See the `samber/cc-skills-golang@golang-lint` skill.

## Cross-References

- → See the `samber/cc-skills-golang@golang-naming` skill for identifier naming conventions - → See the `samber/cc-skills-golang@golang-structs-interfaces` skill for pointer vs value receivers, interface design - → See the `samber/cc-skills-golang@golang-design-patterns` skill for functional options, builders, constructors - → See the `samber/cc-skills-golang@golang-lint` skill for automated formatting enforcement - → See `samber/cc-skills-golang@golang-continuous-integration` skill for automated AI-driven code review in CI using these guidelines - → See `samber/cc-skills-golang@golang-refactoring` skill for mechanically applying guard-clause conversion, function extraction, and options-struct migration safely across many call sites once a review surfaces violations at scale

Détails techniques

Version
1.0.0
Licence
MIT
Dernière mise à jour
20 août 2026
Publié
20 août 2026

Instantané de décision

Choix principal

95
Prêt
Adopter
Étape

3,010 stars GitHub

Audit

Revue d’installation

Revue d’installation et d’adoption

81
Revue nécessaire
Sécurité
74/100
Maintenance
100/100
Installer
92/100
Ouvrir l’audit completVoir le rapport d’évaluation

Preuves validées par Agent

Preuves validées par Agent

Rapports après resolve, revue, installation et une exécution limitée.

0
Validé
Needs first agent runAuto-installation: revoir d’abordDernier: Inconnu
Taux de réussite
Échec récent
Résultats
0
Qualité de sortie
Échecs
0
Non pertinent
0
Installations
0
Bloqué par le risque
0
Configuration requise
0
Production
0

Aucune donnée de résultat Agent pour l’instant. La première exécution peut signaler succès, besoin de configuration, blocage de risque, échec ou non-pertinence via /api/agent/outcome.

Installer

Ajouter au workflow Agent

Gratuit et open source. Examinez le rapport avant l’installation dans des Agents de production.

Boucle de croissance

Kit de partage

X

Brouillon guidé par scénario pour golang-code-style, prêt pour une publication manuelle sur X.

Note du curateur
golang-code-style: Golang code style conventions — line length and breaking, variable declarations, control flow...

3.0K stars

https://www.openagentskill.com/skills/samber-golang-code-style?ref=x
Ouvrir le brouillon X
Réponse facultative avec commande d’installation
Listing + install path for golang-code-style:
https://www.openagentskill.com/skills/samber-golang-code-style?ref=x

Install: npx skills add samber/cc-skills-golang --skill golang-code-style

Source de la fiche

Indexé par Registry

Revendiable

Cette fiche a été indexée à partir de sources publiques et n’est pas marquée officielle tant qu’une revendication de mainteneur n’est pas approuvée.

Créateur
samber
Indexé par
Index communautaire OpenAgentSkill

L’attribution renvoie au dépôt public ou au profil du créateur. Les créateurs peuvent revendiquer la fiche pour mettre à jour les signaux de propriété.

Revendiquer ce skill

Revendication du propriétaire

Revendiquer cette fiche de skill

Cette fiche Indexé par Registry est attribuée à samber, mais n’est pas encore marquée officielle. Revendiquez-la pour ajouter un signal de propriétaire vérifié et rendre les futures mises à jour de lancement, d’installation et d’audit plus fiables.

Kit de backlinks créateur

Ajoutez les badges de preuve à votre README

Affichez la fiche canonique, les signaux actuels de confiance et d’audit, ainsi que de vraies preuves Agent-Proven là où les développeurs évaluent le dépôt.

[![Listed on OpenAgentSkill](https://www.openagentskill.com/api/badge/samber-golang-code-style?metric=listed&label=Listed)](https://www.openagentskill.com/skills/samber-golang-code-style)
[![OpenAgentSkill Trust](https://www.openagentskill.com/api/badge/samber-golang-code-style?metric=trust&label=Trust)](https://www.openagentskill.com/skills/samber-golang-code-style)
[![OpenAgentSkill Audit](https://www.openagentskill.com/api/badge/samber-golang-code-style?metric=audit&label=Audit)](https://www.openagentskill.com/skills/samber-golang-code-style/audit)
[![Agent Proven](https://www.openagentskill.com/api/badge/samber-golang-code-style?metric=proven&label=Agent%20Proven)](https://www.openagentskill.com/skills/samber-golang-code-style)

Auteur

S

samber

@samber

Adéquation plateforme

Signaux de santé

Stars GitHub
3.0K
Score de qualité
48/100
Dernier push GitHub
20 août 2026
Indications de framework
Inconnu
Vues OpenAgentSkill
4
Copies d’installation
0
Clics sortants
0

Signal de communauté

Indiquez si ce skill semble utile à votre workflow Agent. Les retours agrégés améliorent le classement au fil du temps.

Confiance et sécurité

Sandbox uniquement

64
  • Adoption GitHub3.0K stars GitHubValidé
  • Activité stars/forks3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuellesInfo
  • Maintenance récente2 jours depuis le dernier pushValidé
  • Clarté de licenceMITValidé
  • Complétude README/SKILL.mdLes métadonnées incluent suffisamment de contexte d’usage et de workflowValidé
  • Risque dépendances/runtimecommand execution surface, network or browser surfaceVérifier