golang-structs-interfaces
Design Better Go Structs and Interfaces
Poor type boundaries make Go code harder to test, extend, and review. This skill applies focused interfaces, useful structs, safe assertions, and clear composition patterns.
Installer avec mon Agent
Copiez cette demande dans votre Agent. Elle contient la page Skill de référence et le manifeste.
Review the Skillstore skill "golang-structs-interfaces" from https://skillstore.io/skills/samber-golang-structs-interfaces.md and its manifest at https://skillstore.io/api/skills/samber-golang-structs-interfaces/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Votre Agent doit toujours présenter son plan et demander toute confirmation exigée par la politique de sécurité.
Ressources lisibles par les agents
Utilisez ces liens lorsquâun Agent IA, un crawler ou un script a besoin dâun contexte propre au lieu de lire toute la page.
Tester
Utilisation de « golang-structs-interfaces ». A service constructor accepts a storage dependency and currently returns an interface.
Résultat attendu:
Return the concrete service pointer and accept the consumer-owned storage interface. Callers retain access to the service API while tests can provide a small mock.
Utilisation de « golang-structs-interfaces ». A server embeds a data store but should expose only its HTTP behavior.
Résultat attendu:
Embed the HTTP handler when its methods should be promoted. Keep the data store as a named field so its internal methods remain private to the server implementation.
Utilisation de « golang-structs-interfaces ». A registry panics when used as its zero value.
Résultat attendu:
Initialize the internal map lazily in the mutating method. The zero value can then be declared directly and used without a constructor.
Audit de sécurité
SûrAll 77 static findings are false positives caused by Go raw-string syntax, struct tags, explanatory prose, evaluation text, or documentation URLs. The reviewed skill contains no evidence of runtime command execution, network access, system reconnaissance, data exfiltration, or prompt injection.
Facteurs de risque
âïž Commandes externes (50)
đ AccĂšs rĂ©seau (2)
Partager et citer ce rapport
Partagez le rapport dâĂ©valuation versionnĂ©, le badge neutre, la carte intĂ©grable et les citations. Skillstore prĂ©sente les preuves sans dĂ©cider si ce Skill est sĂ»r.
Copier le lien du rapport
https://skillstore.io/skills/samber-golang-structs-interfaces/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportBadge Markdown
[](https://skillstore.io/skills/samber-golang-structs-interfaces?utm_source=security_passport_badge)Badge HTML
<a href="https://skillstore.io/skills/samber-golang-structs-interfaces?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-structs-interfaces/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Carte intégrable
<iframe src="https://skillstore.io/embed/skills/samber-golang-structs-interfaces.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Citations académiques (APA · BibTeX · CFF)
Citation APA
samber. (2026). golang-structs-interfaces security audit report (audit version 1) [Author version 1.2.1]. Skillstore. https://skillstore.io/skills/samber-golang-structs-interfaces/audits/1Citation BibTeX
@techreport{samber-samber-golang-structs-interfaces-2026,
author = {samber},
title = {golang-structs-interfaces security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-structs-interfaces/audits/1},
note = {Author version 1.2.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-structs-interfaces security audit report (audit version 1)"
version: "1.2.1"
type: report
authors:
- name: "samber"
date-released: "2026-09-23"
url: "https://skillstore.io/skills/samber-golang-structs-interfaces/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-structs-interfaces:audit:1"
description: "Skillstore immutable audit report identifier"
Score Skillstore
Pourquoi ce score Niveau de confiance des preuves: MoyenCe que vous pouvez créer
Shape a New Go Package
Define focused interfaces, concrete constructors, and composable structs for a new package.
Review Existing Type Boundaries
Find oversized interfaces, premature abstractions, unsafe assertions, and inconsistent receivers.
Improve Testability Safely
Introduce consumer-owned interfaces and dependency injection where tests or multiple implementations justify them.
Essayez ces prompts
I have a Go package with one concrete dependency. Explain whether I need an interface, where it should live, and why.
Review this Go struct design and recommend embedding or a named field for each dependency. Explain which methods should be exposed.
Review these Go type assertions and type switches. Replace panic-prone assertions, handle nil values, and preserve optional behavior.
Audit this Go package for interface size, constructor return types, receiver consistency, struct tags, copy safety, and compile-time interface checks. Give prioritized changes with reasoning.
Bonnes pratiques
- Define the smallest interface at the point where the behavior is consumed.
- Prefer concrete returns, safe comma-ok assertions, and useful zero values.
- Run go vet, race tests, and focused round-trip tests after changing type design.
Ăviter
- Do not create interfaces only for hypothetical flexibility.
- Do not return interfaces from constructors when callers need the concrete API.
- Do not mix receiver styles or use unchecked assertions for recoverable input.
Foire aux questions
Where should a Go interface be defined?
Should constructors return interfaces?
When should I add an interface?
When should I embed a type?
Why use the comma-ok assertion form?
Should a Go receiver use a pointer or value?
Détails du développeur
Auteur
samberLicence
MIT
Version de lâauteur
v1.2.1
Révision Skillstore
r1
Réf
2aa351cb09c29b7287d263bd8ea81e9bee3b2a61
Récence de maintenance
30/09/2026
Utilisation
0 téléchargements · 0 vues
Structure de fichiers
đ evals/
đ evals.json
đ references/
đ struct-fields.md
đ type-assertions.md
đ SKILL.md