/matex-skills:Matex-Setup-Feature-Flagsfrom matex-skills
Manages feature flags in Matex using pkg/core/feature: Register/Enabled/Set/Configure, config.yaml feature section, and FEATURE_ environment variables. Supports runtime toggling without recompilation.
Ships in matex-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
用 pkg/core/feature。它是进程内的开关:按名字读布尔值,不用改代码、不用重新编译。
var newCheckout = feature.Flag{Name: "new-checkout", Default: false}
func init() { feature.Register(newCheckout) } // 或放在 Setup 里
func (s *Service) checkout(ctx context.Context, in *In) (*Out, error) {
if newCheckout.Enabled() { // 不要缓存到 struct 字段,翻转后要立即生效
return s.checkoutV2(ctx, in)
}
return s.checkoutV1(ctx, in)
}
feature:
new-checkout: true
FEATURE_NEW_CHECKOUT=on go run ./cmd/<service> # 名字大写、非字母数字变 _
管理接口里(记得加鉴权):
feature.Set("new-checkout", false) // 运行时最高优先级,立即生效
feature.Set > 环境变量 FEATURE_<NAME> > feature: 配置段 > Register 的 Default。
没注册过的名字默认关闭;环境变量接受 1/true/on/yes、0/false/off/no。
verticle.Run 启动时自动把 feature: 段交给 feature.Configure,不需要自己接。
Setup 里算一次存起来 —— 那样 Set 只对重启生效。new-checkout),和配置、环境变量保持可互相推导。Set 接口必须鉴权(结合 pkg/core/auth)。Set。go test ./pkg/core/feature ./examples/feature
参考 examples/feature(配置选择路径、运行时翻转、环境变量覆盖,均有测试)。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
15 skills in this plugin
/Matex-Add-DomainMatex Add Domain在 matex 脚手架中新增一个业务域(handler/service/dao + 路由注册 + 装配 + 测试)。当用户说"新增 domain / 加一个业务域 / 新增模块 / add domain / new domain / 建一个 xx 服务"时使用。/Matex-Setup-Audit-LogMatex Setup Audit Log在 matex 中记录审计日志:pkg/core/audit 的 Record/Event(actor/action/resource/result/detail),默认写结构化日志,可用 SetSink 落库或投递到只追加的存储。当用户说"审计 / 审计日志 / audit log / 操作记录 / 谁改了什么 / 合规 / 不可否认 / access log"时使用。/Matex-Setup-AuthMatex Setup Auth在 matex 中接入认证与授权:配置 auth 段、验签 Bearer token、按路由分级保护、读取当前主体。当用户说"加认证 / 加鉴权 / 接 auth / setup auth / JWT / OIDC / 登录校验 / token 校验 / 权限控制 / RBAC"时使用。/Matex-Setup-CacheMatex Setup Cache在 matex 中接入缓存模式:cache-aside 回源、并发 miss 合并(防击穿)、TTL 抖动(防雪崩)、写后失效。当用户说"加缓存 / 缓存模式 / cache-aside / 防击穿 / 防雪崩 / 缓存击穿 / 缓存穿透 / 缓存一致性 / setup cache"时使用。/Matex-Setup-CronMatex Setup Cron在 matex 中加定时任务:固定周期 / cron 表达式 / 一次性任务,多副本下用 redis 选主保证每个周期(槽)只跑一次。当用户说"定时任务 / 定时器 / cron / cron 表达式 / 周期任务 / 后台任务 / 跑批 / 一次性任务 / one-shot / 延迟执行 / 选主 / leader election / 只能跑一次 / schedule"时使用。/Matex-Setup-DatabaseMatex Setup Database在 matex 中接入 SQL 数据库(PostgreSQL / MySQL / SQLite):配置 db 段、写迁移、写 DAO、跑测试。当用户说"接数据库 / 配 postgres / 配 mysql / 配 sqlite / setup database / 加数据库 / 连数据库 / 写表 / 迁移 / DAO"时使用。npx claudepluginhub smallnest/matex --plugin matex-skills