From golang-boost
Composes a generic middleware chain using NewAnyErrorWrapper[T] for the Pub/Sub adapter ctx-loss workaround. Covers middleware order and manual chain building outside fn.Run.
How this skill is triggered — by the user, by Claude, or both
Slash command
/golang-boost:boost-extra-middlewareThis 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-middleware — the middlewares this skill composes.boost-bootstrap-adapter-pubsub — the canonical reason this skill is reached for (production workaround).extra/middleware.NewAnyErrorWrapper[T](ctx, name, ...mws) is the generic chain composer. It returns a wrapper that you can apply to any handler typed compatibly. fn.Run uses it internally; you reach for it directly only when you can't use fn.Run (e.g., the documented Pub/Sub adapter workaround).
import (
"github.com/xgodev/boost/extra/middleware"
"github.com/xgodev/boost/bootstrap/function"
)
wrp := middleware.NewAnyErrorWrapper[*cloudevents.Event](
ctx, "bootstrap", rec, lmi, pmi,
)
wrappedHandler := function.Wrapper[*cloudevents.Event](wrp, handle)
// then drive wrappedHandler manually (e.g., apubsub.NewSubscriber)
The middleware order arguments here mirror the order semantics from boost-bootstrap-middleware: outermost-to-innermost is rec, lmi, pmi.
boost-bootstrap-adapter-pubsub).fn.Run.Don't use when the canonical function.New + fn.Run works — fn.Run already calls this internally with the right arguments.
| Red flag | Fix |
|---|---|
Used in place of fn.Run without a // TODO(boost-upstream): comment explaining why | Either add the comment + tracking issue, or use fn.Run |
Different T parameter than the rest of the chain | All on *cloudevents.Event |
| Custom middleware order that breaks the recovery-outermost rule | Mirror boost-bootstrap-middleware's canonical order |
npx claudepluginhub xgodev/boost --plugin golang-boostGuides stacking of recovery, logger, and publisher middleware in Go event-driven services using the xgodev/boost bootstrap framework.
Provides idiomatic Go HTTP middleware for context propagation, structured slog logging, error handling, and panic recovery. Use when writing middleware, adding request tracing, or cross-cutting concerns.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.