This skill helps design Go interfaces with registry, middleware, and hooks for Beluga AI v2, enabling extensible contracts and runtime customization.
npx playbooks add skill lookatitude/beluga-ai --skill go-interfaces
type ChatModel interface {
Generate(ctx context.Context, msgs []schema.Message, opts ...GenerateOption) (*schema.AIMessage, error)
Stream(ctx context.Context, msgs []schema.Message, opts ...GenerateOption) iter.Seq2[schema.StreamChunk, error]
BindTools(tools []tool.Tool) ChatModel
ModelID() string
}
type Hooks struct {
BeforeGenerate func(ctx context.Context, msgs []schema.Message) (context.Context, []schema.Message, error)
AfterGenerate func(ctx context.Context, resp *schema.AIMessage, err error) (*schema.AIMessage, error)
OnError func(ctx context.Context, err error) error
}
func ComposeHooks(hooks ...Hooks) Hooks { /* chain: each receives output of previous */ }
func(T) Ttype Middleware func(ChatModel) ChatModel
func ApplyMiddleware(model ChatModel, mws ...Middleware) ChatModel {
for i := len(mws) - 1; i >= 0; i-- { model = mws[i](model) }
return model
}
See go-framework skill.
if br, ok := r.(BatchRetriever); ok { ... }type MyAgent struct { agent.BaseAgent; ... }Before<Action> (modify input), After<Action> (modify output), On<Event> (observe/modify).Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.