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.
自分のエージェントでインストール
このリクエストをエージェントにコピーしてください。正規の Skill ページとマニフェストが含まれています。
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.エージェントは引き続き計画を提示し、セキュリティポリシーで必要な確認を求める必要があります。
エージェントが読めるリソース
AI エージェント、クローラー、スクリプトがページ全体ではなく整理されたコンテキストを必要とする場合は、これらのリンクを使ってください。
テストする
「golang-structs-interfaces」を使用しています。 A service constructor accepts a storage dependency and currently returns an interface.
期待される結果:
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.
「golang-structs-interfaces」を使用しています。 A server embeds a data store but should expose only its HTTP behavior.
期待される結果:
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.
「golang-structs-interfaces」を使用しています。 A registry panics when used as its zero value.
期待される結果:
Initialize the internal map lazily in the mutating method. The zero value can then be declared directly and used without a constructor.
セキュリティ監査
安全All 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.
リスク要因
⚙️ 外部コマンド (50)
🌐 ネットワークアクセス (2)
このレポートを共有・引用
バージョン付き評価レポート、中立的なバッジ、埋め込みカード、引用を共有できます。Skillstore は証拠を報告しますが、この Skill が安全かどうかは判断しません。
レポートリンクをコピー
https://skillstore.io/skills/samber-golang-structs-interfaces/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdownバッジ
[](https://skillstore.io/skills/samber-golang-structs-interfaces?utm_source=security_passport_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>埋め込みカード
<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>学術引用 (APA · BibTeX · CFF)
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/1BibTeX形式の引用
@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"
Skillstore スコア
このスコアの理由 証拠の信頼度: 中作成できるもの
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.
これらのプロンプトを試す
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.
ベストプラクティス
- 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.
回避
- 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.
よくある質問
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?
開発者情報
作成者
samberライセンス
MIT
作者バージョン
v1.2.1
Skillstore リビジョン
r1
参照
2aa351cb09c29b7287d263bd8ea81e9bee3b2a61
メンテナンスの新しさ
2026/9/30
利用状況
0 ダウンロード · 0 閲覧
ファイル構成