From golang-boost
Writes and reviews Go event-driven services using the boost NATS adapter. Covers subscriber wiring, queue groups, and the context.Background workaround for graceful shutdown.
How this skill is triggered — by the user, by Claude, or both
Slash command
/golang-boost:boost-bootstrap-adapter-natsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**REQUIRED BACKGROUND:**
REQUIRED BACKGROUND:
boost-bootstrap-function — handler typing rule.boost-bootstrap-middleware — recovery/logger/publisher chain.boost-extra-middleware — NewAnyErrorWrapper for the workaround.boost-bootstrap-adapter-pubsub — same shape, full workaround pattern documented there.import (
anats "github.com/xgodev/boost/bootstrap/function/adapter/contrib/nats-io/nats.go/v1"
"github.com/xgodev/boost/bootstrap/function"
)
fn, _ := function.New[*cloudevents.Event](rec, lmi, pmi)
fn.Run(ctx, handle, anats.New[*cloudevents.Event](conn))
Subscriptions are configured via boost.bootstrap.function.adapter.nats.subjects (comma-separated) and boost.bootstrap.function.adapter.nats.queueGroup. Override at deploy via BOOST_BOOTSTRAP_FUNCTION_ADAPTER_NATS_*.
bootstrap/function/adapter/contrib/nats-io/nats.go/v1/helper.go:44/46 and subscriber.go:62 hard-code context.Background(). SIGTERM does not gracefully drain.
Apply the same workaround pattern documented in boost-bootstrap-adapter-pubsub: bypass fn.Run, build the chain via extra/middleware.NewAnyErrorWrapper, drive anats.NewSubscriber with a signal-aware ctx, and add the // TODO(boost-upstream): annotation naming the offending file.
NATS queue groups distribute messages across N subscribers (load balancing). Configure via boost.bootstrap.function.adapter.nats.queueGroup. Without a queue group, every subscriber gets every message (broadcast).
| Red flag | Fix |
|---|---|
nats.Conn.Subscribe(...) directly from the upstream SDK | Use anats.NewSubscriber(...).Subscribe(ctx) or function.New + fn.Run |
Bypass of fn.Run without // TODO(boost-upstream): naming helper.go:44/subscriber.go:62 | Add the comment, OR accept ungraceful shutdown |
| Multiple NATS connections per process | Construct one *nats.Conn at startup, share |
Config tunables read via os.Getenv | Use BOOST_BOOTSTRAP_FUNCTION_ADAPTER_NATS_* overrides |
npx claudepluginhub xgodev/boost --plugin golang-boostProvides guidance on using the boost Pub/Sub adapter for Go event-driven services on GCP, including the canonical path and a production workaround for context loss on shutdown.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.