golang-uber-fx

Wire Go services with uber-go/fx lifecycle hooks and modular composition.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/dashkan/pivox --skill golang-uber-fx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-uber-fx
Source: https://github.com/dashkan/pivox/tree/main/.agents/skills/golang-uber-fx
Command: npx skills add https://github.com/dashkan/pivox --skill golang-uber-fx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves brittle and error-prone Go application wiring by providing a structured dependency injection approach with lifecycle management for long-running services.

Core Features & Use Cases

  • Lifecycle-first boot and graceful shutdown: model startup and teardown with fx.Lifecycle hooks (OnStart/OnStop) instead of constructor side effects.
  • Modular composition with fx.Module: organize providers, invokes, and decorators into reusable units that scale with large codebases.
  • Robust DI ergonomics: use fx.Provide, fx.Invoke, fx.Annotate, value groups, named/grouped bindings, and signal-aware Run behavior.
  • Structured fx event logging and testing support: integrate fx.WithLogger and test wiring with fxtest, fx.Populate, and fx.Replace.

Quick Start

Have the AI generate an uber-go/fx composition root that wires constructors with fx.New, registers at least one fx.Invoke to force construction, and starts a server in an fx.Lifecycle OnStart hook while shutting it down in OnStop.

Frequently Asked Questions about golang-uber-fx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I wire Go services with dependency injection and graceful shutdown?

Wire Go services with dependency injection and graceful shutdown using uber-go/fx to model startup and teardown with fx.Lifecycle hooks instead of constructor side effects, ensuring services start in dependency order and stop cleanly on SIGINT/SIGTERM.

What's the best way to organize large Go dependency injection providers?

Organize large Go dependency injection providers using fx.Module to group providers, invokes, and decorators into reusable, scoped units that scale cleanly with large codebases while maintaining robust DI ergonomics.

How do I start an HTTP server in an fx.Lifecycle OnStart hook?

Start an HTTP server in an fx.Lifecycle OnStart hook by registering an fx.Invoke to force construction, then using fx.Hook to run the server in OnStart and shut it down in OnStop within the composition root.

Does uber-go/fx support structured logging and testing for DI wiring?

uber-go/fx supports structured logging and testing for DI wiring through fx.WithLogger for event logging and fxtest, fx.Populate, and fx.Replace to test application composition without running the full lifecycle.

Can I use fx.Annotate and value groups for multiple bindings in Go dependency injection?

You can use fx.Annotate and value groups for multiple bindings in Go dependency injection to provide named and grouped bindings, allowing flexible construction of components that depend on collections of similar services.

When do I need signal-aware execution for Go workers and daemons?

You need signal-aware execution for Go workers and daemons when long-running services must stop gracefully on SIGINT/SIGTERM, using fx signal-aware Run behavior to trigger fx.Lifecycle OnStop hooks for clean teardown.