go-fx/SKILL.md
Use this skill to build, refactor, or review Go applications using the Uber Fx dependency injection framework. It ensures idiomatic use of Fx for lifecycle management, module-based architecture, and boilerplate reduction.
npx skillsauth add metalagman/agent-skills go-fxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in building Go applications with Uber Fx. Your goal is to help users leverage Fx to eliminate globals, reduce boilerplate, and manage application lifecycles through a robust dependency injection container.
This skill is based on the official Uber Fx Documentation.
These are the fundamental rules for using Fx correctly and safely. For more detail, use the reference map below.
fx.Private, and fx.Invoke usage: references/modules.mdfx.In / fx.Out) and naming: references/dependency-objects.mdfx.Provide for Constructors: Register components that should be available in the container.fx.Invoke Sparingly: Only use fx.Invoke for functions that must run to start the application (e.g., starting an HTTP server). Most logic should be driven by dependency requirements.fx.Module for Organization: Group related components (providers, invokes, decorators) into self-contained, named modules.fx.Hook (OnStart, OnStop) for any code that starts or stops background processes, servers, or database connections.OnStart hooks run in the order they are appended; OnStop hooks run in reverse order.fx.In for Dependencies: Wrap multiple dependencies in a "Parameter Object" struct embedding fx.In to keep constructor signatures clean and allow for backward-compatible additions.fx.Out for Multiple Results: Wrap multiple constructor outputs in a "Result Object" struct embedding fx.Out.optional:"true" tag on fx.In struct fields for dependencies that may not be present in the container.fx.Annotate for Clean Code: Use fx.Annotate to apply tags, cast to interfaces (fx.As), or handle value groups without polluting business logic with Fx-specific types.group:"name" tags to collect multiple implementations of an interface (e.g., several HTTP handlers) into a single slice.fx.Provide are exported if they are useful outside of Fx. It should be possible to use your package without Fx.fx suffix (e.g., package zapfx).RunParams, RunResult; for New* constructors, strip New: Params/Result for New, FooParams/FooResult for NewFoo).fx.Private to restrict a constructor's output to the module it's defined in.fx.Annotate(Constructor, fx.As(new(Interface))) to provide an implementation as an interface, keeping consumers decoupled.fx.Decorate to modify or wrap values already in the container (e.g., adding middleware to an existing router).OnStart with an OnStop to ensure resources are cleaned up (e.g., closing DB connections, stopping ticker goroutines).fx.DotGraph to export the dependency graph for debugging.fxtest.App instead of fx.App in unit tests to ensure lifecycle hooks are executed and to capture errors easily.development
Use this skill to design, document, and structure AI agent skills for Gemini, Claude, and Codex. It provides architectural rules, directory standards, and writing best practices.
development
Use this skill to initialize, configure, and run omnidist release workflows for Go projects (`init`, `ci`, `build`, `stage`, `verify`, `publish`) including npm and uv publishing setup.
development
Use this skill to install and use the upstream powerman/golangci-lint-strict config for an exact golangci-lint version by fetching the versioned config file unchanged.
development
Use this skill to write, refactor, or review Go code according to the Uber Go Style Guide. It ensures strict adherence to correctness, safety, and idiomatic patterns.