baowk

Dilu Go Kit — AI skill for Claude Code

AI community

Go 微服务基础工具包(boot/log/mid/resp/store/registry/notify)— 内置 AI 辅助编程规范模板(Claude Code / Codex / Cursor / Windsurf / Copilot).

How to install Dilu Go Kit

This entry records only its repository, not the path inside it, so there is no exact command to give. Open baowk/dilu-go-kit and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Dilu Go Kit does

Go 微服务基础工具包(boot/log/mid/resp/store/registry/notify)— 内置 AI 辅助编程规范模板(Claude Code / Codex / Cursor / Windsurf / Copilot).

Alternatives in AI

  • Registry Broker Skills — AI agent skills for the Universal Registry - search, chat, and register 72,000+ agents across 14+ protocols 410 ★
  • AI Toolkit — Professional-grade AI coding toolkit: 94 skills, 44 agents, multi-platform (Claude, Cursor, Windsurf, Copilot 167 ★
  • Linggen Memory — Local-first semantic memory for AI assistants — one store your preferences, decisions and gotchas follow you i 108 ★

README

dilu-go-kit

Go 微服务基础工具包。提供统一的服务启动、日志、中间件、错误码、服务发现、远程配置和事件通知。

特性

  • boot — 一行启动服务(Config + DB + Redis + gRPC + 注册 + 远程配置 + 优雅关闭)
  • boot.Component — 统一后台任务启动、停止和反向关闭
  • buildinfo — 构建元数据、启动前 --version 输出和可选 HTTP 查询
  • log — 统一日志接口(slog 实现,traceId 自动注入,支持 console/file/both 输出)
  • mid — 核心中间件(Trace + Recovery + Logger + ErrorHandler + CORS + RateLimit)
  • contrib/mid/jwt — 可选 JWT 认证中间件(按需引入)
  • resp — 统一 HTTP 响应(Ok / Fail / Page / Error)+ 标准错误码
  • apperr — transport-neutral 业务错误及 HTTP/gRPC 安全映射
  • store — 数据访问层基础类型(ListOpts 分页)
  • contrib/stream/redis — Redis Stream 基础封装(发布、消费组、读取、ACK、死信)
  • stream tracing — 发布时注入 W3C trace context,消费时可恢复上游上下文
  • clientx — 服务客户端基础能力(重试、熔断、gRPC 错误码映射)
  • contrib/migrate/postgres — PostgreSQL SQL 迁移封装与 CLI(up/down/version/force/create)
  • registry — 厂商无关的服务注册与发现抽象
  • registry.Resolver — 客户端 Watch 缓存、RoundRobin/Random 负载均衡与可选版本/标签过滤
  • notify — 通用 HTTP 事件推送(支持 traceId 透传)
  • metrics — Prometheus HTTP/gRPC 指标(支持运行时服务名)
  • dependency metrics — 统一出站依赖请求计数和延迟指标
  • clientx.HTTPClient — HTTP 出站超时、幂等重试、熔断与 trace 透传
  • telemetry — 可选 OpenTelemetry tracing(OTLP HTTP + W3C 传播,默认 no-op)
  • diagnostics — 显式注册 pprof 运行时诊断接口(默认关闭)
  • Proto/Buf — 契约优先生成 Go、gRPC、HTTP Gateway 和 OpenAPI
  • cmd/dilu — AI 友好的服务与资源脚手架
  • grpcx.DialService — 注册中心服务名拨号 + 健康实例 round_robin
  • metadata — HTTP/gRPC 共用的 trace ID 元数据传播
  • registry.Registry — 注册发现抽象;具体后端通过 contrib 模块按需引入
  • contrib/ — 独立 Go module 的可选第三方扩展(etcd、Consul 等)

安装

要求 Go 1.27.0 或更高版本。

go get github.com/baowk/dilu-go-kit@latest

核心依赖版本和升级规则见 [`docs/conventions.md`](docs/conventions.md);根目录 `go.mod` 始终记录当前锁定版本。

服务组件可通过可选的 `DependsOn() []string` 声明启动依赖;框架会拓扑排序并检测未知依赖 和循环依赖。HTTP/gRPC 出站调用可使用 `metadata` 包传播统一的 trace ID,身份信息仍须在 认证成功后显式写入,不能直接信任外部请求头。

gRPC 服务可在配置中设置 `grpc.requestTimeout` 和 `grpc.maxConcurrent`;客户端可通过 `grpcx.DialOption{DefaultRequestTimeout: ...}` 设置默认 RPC deadline。Kubernetes 或 DNS 部署可直接使用