golang-code-style
改善 Go 程式碼風格
Go 程式碼即使通過格式檢查,仍然可能難以閱讀。這項技能會引導 Claude、Codex 和 Claude Code 做出更清晰的風格選擇。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "golang-code-style" from https://skillstore.io/skills/samber-golang-code-style.md and its manifest at https://skillstore.io/api/skills/samber-golang-code-style/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「golang-code-style」。 一個 Go handler 有巢狀驗證,並針對空結果回傳 nil slices。
預期結果:
- 使用 early return,讓驗證失敗在 happy path 之前結束。
- 針對沒有結果的成功案例,回傳已初始化的空 slices。
- 讓主要的回應建構邏輯維持較淺的縮排。
正在使用「golang-code-style」。 一個 service 函式接受許多分開的設定參數。
預期結果:
建議將相關輸入分組到 options struct 中,並將 context 放在第一個參數,主要 dependency 放在靠前位置。
正在使用「golang-code-style」。 審查詢問 string 是否需要指標參數。
預期結果:
除非 nil 具有意義,或函式必須修改參照值,否則建議以值傳遞 string。
安全審計
安全Static alerts were reviewed in context and adjudicated as false positives. Backtick matches are Markdown code spans, fenced Go examples, and eval prompt strings rather than shell execution. The only URL is homepage metadata, and no prompt injection or malicious intent was found.
風險因素
⚙️ 外部命令 (74)
🌐 網路存取 (1)
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/samber-golang-code-style/audits/3?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/samber-golang-code-style?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/samber-golang-code-style?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-code-style/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/samber-golang-code-style.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-code-style security audit report (audit version 3) [Author version 1.2.0]. Skillstore. https://skillstore.io/skills/samber-golang-code-style/audits/3BibTeX 引用
@techreport{samber-samber-golang-code-style-2026,
author = {samber},
title = {golang-code-style security audit report (audit version 3)},
institution = {Skillstore},
year = {2026},
number = {3},
url = {https://skillstore.io/skills/samber-golang-code-style/audits/3},
note = {Author version 1.2.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-code-style security audit report (audit version 3)"
version: "1.2.0"
type: report
authors:
- name: "samber"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/samber-golang-code-style/audits/3"
identifiers:
- type: other
value: "skillstore:samber-golang-code-style:audit:3"
description: "Skillstore immutable audit report identifier"
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
審查 Go Pull Request
在合併前找出控制流程、宣告、函式形狀與檔案組織中的可讀性問題。
設定團隊風格標準
為自動化 linter 較難強制執行的風格決策,建立實用檢查清單。
引導 AI 程式碼編輯
當 prompt 要求精簡程式碼、巢狀分支或過多參數時,讓產生的 Go 程式碼保持可讀。
試試這些提示
審查我的 Go 檔案是否具備可讀風格。聚焦於行長、變數宣告、early return,以及已初始化的空集合。
為了清晰度重構這個 Go 函式。保留行為、降低巢狀層級、移除不必要的 else 區塊,並說明風格變更。
為這個 repository 建立精簡的 Go 程式碼風格檢查清單。使其符合現有模式,並註明 linter 無法強制執行的規則。
使用獨立的風格關注點審查這個 Go codebase。回報控制流程、函式設計、集合初始化與檔案組織方面的發現。
最佳實務
- 將這項技能與 gofmt、gofumpt 和 goimports 搭配,用於機械式格式化。
- 在風格重構前,先要求保留行為的編輯。
- 當 repository 慣例與通用風格指引衝突時,採用 repository 慣例。
避免
- 使用這項技能取代測試、linter 或編譯器檢查。
- 不考慮可讀性,機械式套用每一項指引。
- 要求屬於連結技能範圍的命名或文件規則。
常見問題
這項技能會自動格式化 Go 程式碼嗎?
它可以審查現有的 Go 程式碼嗎?
它會取代 linter 嗎?
它涵蓋命名規則嗎?
它能協助大型 repository 嗎?
它是 Claude Code 專用的嗎?
開發者詳細資訊
作者
samber授權
MIT
作者版本
v1.2.0
Skillstore 修訂
r1
引用
e397ce5a135369cd6def89cb6400d013e2f68f2f
維護新鮮度
2026/7/18
使用量
2 次下載 · 0 次瀏覽
檔案結構