golang-uber-fx

Automate Go application wiring and lifecycle management with uber-go/fx.

Updated May 19, 2026
One-click install
npx skills add https://github.com/monforje/.opencode --skill golang-uber-fx-monforje
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-uber-fx
Source: https://github.com/monforje/.opencode/tree/main/skills/cc-skills-golang/skills/golang-uber-fx
Command: npx skills add https://github.com/monforje/.opencode --skill golang-uber-fx-monforje

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go.uber.org/fx, go.uber.org/dig, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating modular, long-running Go applications with effective dependency injection and lifecycle management.

Core Features & Use Cases

  • Dependency Injection: Offers a reflection-based DI container for seamless component integration.
  • Lifecycle Management: Facilitates lifecycle hooks for graceful shutdown and state management.
  • Modular Composition: Enables modular design through fx.Module for maintainable codebases.
  • Use Case: Ideal for developing services like HTTP servers, workers, and daemons where boot order, graceful shutdown, and modular composition are crucial.

Quick Start

Use the golang-uber-fx skill to wire up your Go application using uber-go/fx's DI and lifecycle features.

Frequently Asked Questions about golang-uber-fx

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

FAQPage Schema
How do I manage dependency injection and graceful shutdown in a Go application?

Dependency injection and graceful shutdown in a Go application are managed using uber-go/fx, which provides a reflection-based DI container and lifecycle hooks for seamless component integration and state management.

What is the best way to structure modular Go services for maintainable codebases?

The best way to structure modular Go services is using uber-go/fx Module composition, which enables modular design and maintainable codebases by organizing dependencies and lifecycle hooks into cohesive, reusable application blocks.

Can I use uber-go/fx for long-running Go workers and HTTP servers?

Yes, you can use uber-go/fx for long-running Go workers, HTTP servers, and daemons where managing boot order, modular composition, and graceful shutdown are crucial for application stability.

Does the uber-go/fx framework require any specific dependencies to set up DI?

Setting up uber-go/fx requires the go.uber.org/fx and go.uber.org/dig libraries to automate the wiring and lifecycle management of your Go application's dependency injection container.

How does lifecycle management work with uber-go/fx in Golang?

Lifecycle management in Golang with uber-go/fx works by providing lifecycle hooks that facilitate graceful shutdown and state management, ensuring long-running services start and stop in the correct boot order.

When should I avoid using a reflection-based DI container in Go?

You should avoid using a reflection-based DI container like uber-go/fx for simple, short-lived Go scripts where the overhead of modular composition, lifecycle management, and dependency wiring provides no structural benefit.