Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By BizShukv2.0.0MIT
Go development toolkit for github.com/bizshuk/gosdk — bundles 2 Go-focused skills (dev, review) and the assertive `golang-refactor` agent that auto-invokes them to rewrite code breaking SOLID, MVC, naming, error handling, context propagation, or performance conventions. Triggers: refactor, review, audit, clean up, restructure, improve, profile memory, build a bubbletea TUI.
Claude hands work to one, or you mention it with @.
Go 語言通用開發工具包 (Shared SDK),提供設定管理、HTTP 服務骨架、程式碼產生器、版本管理、通用通知、編碼轉換等可重用模組,作為 Go 專案的基礎函式庫使用。
本 repo 同時是 Claude Code plugin:除了作為 Go 函式庫被 import,也可安裝為 Claude Code plugin 取得 2 個 Go 專用 skills 與 golang-refactor agent。安裝方式見最下方 Claude Code Plugin.
統一管理應用程式設定來源,支援 .env、YAML、JSON(讀取接受 JSONC:註解與 trailing commas;檔名仍為 .json)及 embed.FS 四種格式,透過 Viper 實現階層式設定合併。各格式採用雙檔案載入模式:固定讀取 base 檔案(.env、config.yaml、settings.json),再合併同名 .local 覆寫檔(.env.local、config.local.yaml、settings.local.json),不再依賴 PROFILE 環境變數。OS 環境變數(UPPER(key),無前綴)只補上設定檔沒有的 key:任何設定檔都勝過它,它只勝過 WithDefaultValue。DB 連線另由獨立的 db 套件負責(見下一節),不在 config/ 範圍。寫回 settings.json 時仍輸出標準 JSON(註解不會被保留)。
領域流程 (Domain Flow):
config.Default()(可加 WithAppName("myapp") 等 option)啟動設定載入;搜尋目錄固定為 .、./conf、~/.config/<appName>;app 目錄可用 WithConfigDir("~/.config/myapp") 強制指定,XDG_CONFIG_HOME 因此不再左右設定位置EnvConfig.Load() 讀取 .env → .env.local 並合併至全域 ViperYamlConfig.Load() 讀取 config.yaml → config.local.yaml 並合併至全域 ViperJsonConfig.Load() 讀取 settings.json → settings.local.json 並合併至全域 Viperviper.AutomaticEnv()),優先權在所有設定檔之下、WithDefaultValue 之上viper.GetString() 或 viper.Unmarshal() 取得設定值核心實體 (Key Entities): Config 介面, EnvConfig, YamlConfig, JsonConfig, FSConfig
相關處理器 (Related Handlers): config.Default(), GetAppConfigDir(), WithAppName(), WithConfigDir(), WithDefaultValue(), SetConfigDir(), NewEnvConfig(), NewYamlConfig(), NewJsonConfig(), NewFSConfig()
一個服務連一個資料庫。driver 與位址全由設定決定:DB_DRIVER (mysql | sqlite) 選 driver,DB_DSN 給連線字串,程式碼不依「哪個 key 有值」挑 driver。gorm 行為也由設定開關:DB_LOG(預設 false,丟棄 gorm log)與 DB_TRANSLATE_ERROR(預設 true,driver 錯誤轉成 gorm.ErrDuplicatedKey 等 sentinel)。需要額外的資料庫連線時,以 suffix _<NAME> 區分:每個 <KEY>_<NAME> 未設定時沿用 <KEY>,唯獨 DB_DSN_<NAME> 不沿用主連線位址 (mysql 必填)。
領域流程 (Domain Flow):
config.Default() 載入設定db.Init() 依 DB_DRIVER / DB_DSN 開啟主資料庫並設為 db.Default singleton;重複呼叫回傳 error~/.config/<app_name>/data/default.db;mysql 的 DSN 必填db.Open("<name>") 開啟,由呼叫端持有並自行 Close()Service.Target() 標示連到哪裡:mysql 遮掉密碼,sqlite 為實際檔案路徑核心實體 (Key Entities): db.Service struct, db.Default singleton, DB_DRIVER / DB_DSN / DB_LOG / DB_TRANSLATE_ERROR key 與其 _<NAME> 變體
相關處理器 (Related Handlers): db.Init(), db.Open(name), db.Key(base, name), db.Default.DB(), db.Default.Target(), db.Default.Close()
基於 Gin 框架提供 HTTP 服務骨架,包含預設路由註冊、health check 端點、ping/pong 端點、stats 資訊端點,以及 Correlation ID 請求追蹤與 Helmet 安全性標頭中介層。設計為可嵌入其他 Go 專案的服務基礎模組。
領域流程 (Domain Flow):
main() 依序執行:config.Default() → log.Init() → 資料庫連線 → HTTPServer()HTTPServer() 建立 gin.Default() 引擎,掛載 mw.CorrelationID() 與 mw.Helmet() 中介層router.Default(s) 註冊 /stats 路由,回傳版本、Profile、設定檔路徑及 Correlation IDrouter.HealthRouterGroup(s) 透過 gin-healthcheck 套件提供 /healthz 端點router.PingRouterGroup(s) 提供 /ping/ 端點,回應 {"message": "pong"}server.host:server.port 設定值(預設 :8080)核心實體 (Key Entities): Stats 結構, CorrelationHeader 常數
相關處理器 (Related Handlers): HTTPServer(), router.Default(), StatsHandler(), HealthRouterGroup(), PingRouterGroup(), mw.CorrelationID(), mw.GetCorrelationID(), mw.Helmet()
提供兩個 CLI 工具:stringer 為增強版常數列舉產生器,從 Go AST 解析常數定義並自動產生 String()、List()、ValueList()、Map()、ValueMap() 五個方法;gotmpl 為模板渲染引擎,透過 Cobra CLI 讀取 YAML 設定,以 stdlib text/template 搭配自訂 FuncMap 渲染嵌入的 Go 模板。
領域流程 (Domain Flow) — stringer:
-type、-output、-trimprefix、-linecomment、-tags 等參數Generator.ParsePackage() 使用 golang.org/x/tools/go/packages 載入目標套件語法樹File.GenDecl() 遍歷 AST 常數宣告,收集符合目標型別的 Value 清單Generator.Generate() 根據連續序列數量選擇 buildOneRun / buildMultipleRuns / buildMap 策略產生 String() 方法GeneratorEx.generate() 額外呼叫 buildListFn / buildValueListFn / buildMapFn / buildValueMapFn 產生四個輔助函式Generator.Format() 格式化並輸出至指定檔案領域流程 (Domain Flow) — gotmpl:
--config 參數,透過 Viper 讀取 YAML 設定TemplateLoader 結構TemplateLoader.Load() 從 embed.FS 載入 .tmpl 模板TmplFuncSample 提供的模板函式進行渲染,輸出至 stdout核心實體 (Key Entities): Generator, GeneratorEx, File, Package, Value, TemplateLoader
相關處理器 (Related Handlers): Generator.ParsePackage(), Generator.Generate(), GeneratorEx.generate(), SplitIntoRuns(), File.GenDecl(), TemplateLoader.Load()
提供 versioning CLI 工具,用於管理專案的語義版本號(Semantic Versioning)。從 version 檔案讀取與寫入版本資訊,支援 major、minor、patch 三個子命令分別遞增對應的版本號碼。設計為 CI/CD 流程中的版本自動化工具。
領域流程 (Domain Flow):
Generated from the plugin's indexed repository (bizshuk/gosdk) — no native marketplace selected
npx claudepluginhub p/bizshuk-gosdkBuilt from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground