[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DFT3ZWCFEBTPX2R5SKJYYC":3,"skill-same:01M7DFT3ZWCFEBTPX2R5SKJYYC":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":14,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":60},"01M7DFT3ZWCFEBTPX2R5SKJYYC","golang-uber-fx",null,"Golang application framework using uber-go\u002Ffx — fx.New, fx.Provide, fx.Invoke, fx.Module, fx.Lifecycle hooks, fx.Annotate (name\u002Fgroup\u002FAs), fx.Decorate, fx.Supply, fx.Replace, fx.WithLogger, and signal-aware Run(). Apply when using or adopting uber-go\u002Ffx, when the codebase imports `go.uber.org\u002Ffx`, or when wiring services with fx.New. For raw DI without lifecycle, see `samber\u002Fcc-skills-golang@golang-uber-dig` skill.","heynemann\u002Fomp-marketplace","heynemann","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F60965?v=4","01M7DFBD9ZDB2J2QE7R4AR0PES","Bernardo Heynemann","01M7DFBDAM3NXF540P210W3NYT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: golang-uber-fx\ndescription: \"Golang application framework using uber-go\u002Ffx — fx.New, fx.Provide, fx.Invoke, fx.Module, fx.Lifecycle hooks, fx.Annotate (name\u002Fgroup\u002FAs), fx.Decorate, fx.Supply, fx.Replace, fx.WithLogger, and signal-aware Run(). Apply when using or adopting uber-go\u002Ffx, when the codebase imports `go.uber.org\u002Ffx`, or when wiring services with fx.New. For raw DI without lifecycle, see `samber\u002Fcc-skills-golang@golang-uber-dig` skill.\"\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.2.2\"\n  openclaw:\n    emoji: \"🏭\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang\n    requires:\n      bins:\n        - go\n    install: []\n    skill-library-version: \"1.24.0\"\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*\npaths:\n  - \"**\u002F*.go\"\n---\n\n**Persona:** You are a Go architect building a long-running service with fx. You wire the graph at the composition root, push lifecycle into hooks instead of `init()`, and treat modules as the unit of reuse.\n\n# Using uber-go\u002Ffx for Application Wiring in Go\n\nApplication framework combining a reflection-based DI container (built on `uber-go\u002Fdig`) with a lifecycle, module system, signal-aware run loop, and structured event logging. For long-running services where boot order, graceful shutdown, and modular composition matter.\n\n**Official Resources:**\n\n- [pkg.go.dev\u002Fgo.uber.org\u002Ffx](https:\u002F\u002Fpkg.go.dev\u002Fgo.uber.org\u002Ffx)\n- [uber-go.github.io\u002Ffx](https:\u002F\u002Fuber-go.github.io\u002Ffx\u002F)\n- [github.com\u002Fuber-go\u002Ffx](https:\u002F\u002Fgithub.com\u002Fuber-go\u002Ffx)\n\nThis skill is not exhaustive — refer to library documentation and code examples for more information:\n\n- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`), preferred over Context7 for Go package facts.\n- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`).\n- Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n```bash\ngo get go.uber.org\u002Ffx\n```\n\n## fx vs. dig\n\nfx is built on top of dig and shares the same reflection-based container engine. The DI primitives (`Provide`, `Invoke`, `In`\u002F`Out` structs, named values, value groups) are identical — `fx.In`\u002F`fx.Out` are re-exports of `dig.In`\u002F`dig.Out`.\n\nWhat fx adds on top:\n\n| Concern | dig | fx |\n| --- | --- | --- |\n| DI container | ✅ `dig.New()` | ✅ (embedded) |\n| Lifecycle hooks | ❌ | ✅ `fx.Lifecycle` OnStart\u002FOnStop |\n| Module system | ❌ | ✅ `fx.Module` with scoped decorators |\n| Signal-aware run loop | ❌ | ✅ `app.Run()` blocks on SIGINT\u002FSIGTERM |\n| Structured event logging | ❌ | ✅ `fx.WithLogger` \u002F `fxevent` |\n| Startup\u002Fshutdown timeout | ❌ | ✅ `fx.StartTimeout` \u002F `fx.StopTimeout` |\n\n**Choose fx** for long-running services (HTTP servers, workers, daemons) — lifecycle and signal handling are mandatory there, and modules make large service graphs manageable.\n\n**Choose raw dig** when you need wiring without a framework: CLI tools, libraries that expose a container to callers, test harnesses, or embedding DI into an existing app that manages its own lifecycle. See `samber\u002Fcc-skills-golang@golang-uber-dig` skill.\n\n## The Application\n\n```go\nimport \"go.uber.org\u002Ffx\"\n\napp := fx.New(\n    fx.Provide(NewLogger, NewDatabase, NewServer),\n    fx.Invoke(RegisterRoutes),\n)\napp.Run() \u002F\u002F blocks until SIGINT\u002FSIGTERM, then runs OnStop hooks\n```\n\nBoot stages: `fx.New` validates types (constructors do not run); `app.Start(ctx)` runs each `fx.Invoke` and fires OnStart hooks in topological order; main blocks on `app.Done()`; `app.Stop(ctx)` fires OnStop hooks in reverse order. Default timeout is **15 seconds** — override with `fx.StartTimeout` \u002F `fx.StopTimeout`.\n\n## Provide and Invoke\n\n```go\nfx.New(\n    fx.Provide(NewLogger, NewDatabase, NewServer),  \u002F\u002F lazy\n    fx.Invoke(RegisterRoutes, StartMetricsExporter), \u002F\u002F always run during Start\n)\n```\n\n`fx.Provide` registers constructors; `fx.Invoke` is the trigger — without an Invoke (directly or transitively) referencing a type, its constructor never runs.\n\n## Lifecycle Hooks\n\nInject `fx.Lifecycle` and append hooks. Constructors should return quickly; long-running work belongs in `OnStart`.\n\n```go\nfunc NewHTTPServer(lc fx.Lifecycle, log *zap.Logger, cfg *Config) *http.Server {\n    srv := &http.Server{Addr: cfg.Addr}\n\n    lc.Append(fx.Hook{\n        OnStart: func(ctx context.Context) error {\n            ln, err := net.Listen(\"tcp\", srv.Addr)\n            if err != nil { return err }\n            go srv.Serve(ln)         \u002F\u002F blocking work in a goroutine\n            return nil\n        },\n        OnStop: func(ctx context.Context) error {\n            return srv.Shutdown(ctx)\n        },\n    })\n    return srv\n}\n```\n\nBoth callbacks receive a context bounded by `StartTimeout`\u002F`StopTimeout` — respect cancellation. **OnStart must return quickly** — spawn a goroutine for blocking work; otherwise startup hangs and dependent hooks never fire.\n\n`fx.StartHook` \u002F `fx.StopHook` \u002F `fx.StartStopHook` adapt simpler signatures (no context, no error, or both):\n\n```go\nlc.Append(fx.StartStopHook(srv.Start, srv.Stop))   \u002F\u002F matched pair\n```\n\n## Parameter and Result Objects\n\nfx re-exports dig's `dig.In` \u002F `dig.Out` as `fx.In` \u002F `fx.Out`. Use them when a constructor has 4+ dependencies, or when you need `name`\u002F`group`\u002F`optional` tags.\n\n```go\ntype ServerParams struct {\n    fx.In\n\n    Logger *zap.Logger\n    DB     *sql.DB\n    Cache  *redis.Client     `optional:\"true\"`\n    Routes []http.Handler    `group:\"routes\"`\n}\n\nfunc NewServer(p ServerParams) *Server { \u002F* ... *\u002F }\n```\n\n## fx.Annotate\n\n`fx.Annotate` wraps a constructor to add tags or interface bindings without a `fx.Out` struct. Prefer it for ergonomic name\u002Fgroup\u002FAs bindings:\n\n```go\nfx.Provide(\n    fx.Annotate(NewPrimaryDB, fx.ResultTags(`name:\"primary\"`)),\n    fx.Annotate(NewPostgresDB, fx.As(new(Database))),    \u002F\u002F expose interface\n    fx.Annotate(NewUserHandler,\n        fx.As(new(http.Handler)),\n        fx.ResultTags(`group:\"routes\"`),\n    ),\n)\n```\n\n## Value Groups\n\nMany constructors, one consumer slice — typical for routes, health checks, metrics collectors:\n\n```go\ntype RouteResult struct {\n    fx.Out\n    Handler http.Handler `group:\"routes\"`\n}\n\ntype ServerParams struct {\n    fx.In\n    Routes []http.Handler `group:\"routes\"`\n}\n```\n\nAppend `,flatten` (`group:\"routes,flatten\"`) to unwrap a slice instead of nesting it. Order is **not guaranteed** — provide an explicit ordered slice when sequence matters.\n\n## fx.Module\n\n`fx.Module` groups providers, invokes, and decorators under a name. Modules **scope decorators** to themselves and their children — a logger renamed in `fx.Module(\"db\", ...)` only appears renamed for code inside that module.\n\n```go\nvar DatabaseModule = fx.Module(\"database\",\n    fx.Provide(NewConnection, NewUserRepository),\n    fx.Decorate(func(log *zap.Logger) *zap.Logger {\n        return log.Named(\"db\")\n    }),\n)\n\nfunc main() {\n    fx.New(\n        fx.Provide(NewConfig, NewLogger),\n        DatabaseModule,\n        HTTPModule,\n    ).Run()\n}\n```\n\nTreat each module as a small library that can be lifted into another app — its public surface is the types it Provides.\n\nFor `fx.Supply`\u002F`fx.Replace`\u002F`fx.Decorate`, optional deps, custom logging, manual lifecycle, and Quick Reference, see [advanced.md](.\u002Freferences\u002Fadvanced.md).\n\n## Best Practices\n\n1. Keep `main()` thin — providers, modules, and a single `Run()`. Push real work into modules so each can be tested in isolation.\n2. Use lifecycle hooks instead of `init()` or goroutines launched from constructors — Start\u002FStop ordering depends on graph topology, but `init()` goroutines do not, which leads to races and leaks.\n3. OnStart must return promptly — long work goes in a goroutine inside the hook. A blocking OnStart hangs the rest of the boot.\n4. Respect `ctx.Done()` in hooks — a hook that ignores cancellation is reported as a timeout failure but its goroutine continues, leaking resources.\n5. Group by module, not by layer — a module owns the providers, lifecycle, and decorators for one concern (HTTP, DB, metrics).\n6. Use `fx.Annotate` for tags rather than wrapping a constructor in an `fx.Out` struct — keeps the constructor reusable outside fx.\n7. Replace `fx.Provide` with `fx.Supply` for pre-built values (config, command-line flags). Shorter, signals intent.\n8. Validate the graph in CI by booting under `fx.New(...).Err()` — catches missing providers and cycles before deploy.\n\n## Common Mistakes\n\n| Mistake | Fix |\n| --- | --- |\n| Long-running work directly in OnStart | Spawn a goroutine inside OnStart; the hook itself must return quickly so dependent hooks can run. |\n| `fx.Provide` something that should be `fx.Supply` | Pre-built values (config, secrets) belong in `fx.Supply` — clearer and avoids a no-op constructor. |\n| Module decorator leaking to siblings | Decorate inside `fx.Module(...)` — decorators flow only to descendants. A top-level `fx.Decorate` is global. |\n| Group order assumed | Groups are unordered. If order matters, provide an ordered slice from one constructor. |\n| Constructors with side effects | Side effects belong in OnStart — constructors should be cheap and pure-ish, since they may run concurrently and lazily. |\n| Forgotten `fx.Invoke` | Without an Invoke (or downstream consumer), constructors never run. Add at least one Invoke per app. |\n\n## Testing\n\nUse `go.uber.org\u002Ffx\u002Ffxtest` to integrate fx with `*testing.T` (failures call `t.Fatal`, `RequireStop` registers as `t.Cleanup`). `fx.Populate(&target)` pulls values out of the graph; `fx.Replace` swaps real dependencies for fakes. Full patterns in [testing.md](.\u002Freferences\u002Ftesting.md).\n\n## Further Reading\n\n- [advanced.md](.\u002Freferences\u002Fadvanced.md) — Supply\u002FReplace\u002FDecorate, optional deps, custom event logging, manual lifecycle, full Quick Reference\n- [recipes.md](.\u002Freferences\u002Frecipes.md) — full HTTP service with database\u002Fmetrics, background workers with graceful drain, multiple impls of the same interface, manual lifecycle for CLI embedding\n- [testing.md](.\u002Freferences\u002Ftesting.md) — fxtest patterns, `fx.Replace`, `fx.Populate`, isolated lifecycle tests, CI graph validation\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-uber-dig` skill for the underlying container, `dig.In`\u002F`dig.Out`, and DI without lifecycle\n- → See `samber\u002Fcc-skills-golang@golang-dependency-injection` skill for DI concepts and library comparison\n- → See `samber\u002Fcc-skills-golang@golang-samber-do` skill for a generics-based alternative without reflection\n- → See `samber\u002Fcc-skills-golang@golang-google-wire` skill for compile-time DI (no runtime container)\n- → See `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill for interface design patterns\n- → See `samber\u002Fcc-skills-golang@golang-context` skill for context propagation in OnStart\u002FOnStop hooks\n- → See `samber\u002Fcc-skills-golang@golang-testing` skill for general testing patterns\n\nIf you encounter a bug or unexpected behavior in uber-go\u002Ffx, open an issue at \u003Chttps:\u002F\u002Fgithub.com\u002Fuber-go\u002Ffx\u002Fissues>.\n","**Persona:** You are a Go architect building a long-running service with fx. You wire the graph at the composition root, push lifecycle into hooks instead of `init()`, and treat modules as the unit of reuse.\n\n# Using uber-go\u002Ffx for Application Wiring in Go\n\nApplication framework combining a reflection-based DI container (built on `uber-go\u002Fdig`) with a lifecycle, module system, signal-aware run loop, and structured event logging. For long-running services where boot order, graceful shutdown, and modular composition matter.\n\n**Official Resources:**\n\n- [pkg.go.dev\u002Fgo.uber.org\u002Ffx](https:\u002F\u002Fpkg.go.dev\u002Fgo.uber.org\u002Ffx)\n- [uber-go.github.io\u002Ffx](https:\u002F\u002Fuber-go.github.io\u002Ffx\u002F)\n- [github.com\u002Fuber-go\u002Ffx](https:\u002F\u002Fgithub.com\u002Fuber-go\u002Ffx)\n\nThis skill is not exhaustive — refer to library documentation and code examples for more information:\n\n- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`), preferred over Context7 for Go package facts.\n- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`).\n- Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n```bash\ngo get go.uber.org\u002Ffx\n```\n\n## fx vs. dig\n\nfx is built on top of dig and shares the same reflection-based container engine. The DI primitives (`Provide`, `Invoke`, `In`\u002F`Out` structs, named values, value groups) are identical — `fx.In`\u002F`fx.Out` are re-exports of `dig.In`\u002F`dig.Out`.\n\nWhat fx adds on top:\n\n| Concern | dig | fx |\n| --- | --- | --- |\n| DI container | ✅ `dig.New()` | ✅ (embedded) |\n| Lifecycle hooks | ❌ | ✅ `fx.Lifecycle` OnStart\u002FOnStop |\n| Module system | ❌ | ✅ `fx.Module` with scoped decorators |\n| Signal-aware run loop | ❌ | ✅ `app.Run()` blocks on SIGINT\u002FSIGTERM |\n| Structured event logging | ❌ | ✅ `fx.WithLogger` \u002F `fxevent` |\n| Startup\u002Fshutdown timeout | ❌ | ✅ `fx.StartTimeout` \u002F `fx.StopTimeout` |\n\n**Choose fx** for long-running services (HTTP servers, workers, daemons) — lifecycle and signal handling are mandatory there, and modules make large service graphs manageable.\n\n**Choose raw dig** when you need wiring without a framework: CLI tools, libraries that expose a container to callers, test harnesses, or embedding DI into an existing app that manages its own lifecycle. See `samber\u002Fcc-skills-golang@golang-uber-dig` skill.\n\n## The Application\n\n```go\nimport \"go.uber.org\u002Ffx\"\n\napp := fx.New(\n    fx.Provide(NewLogger, NewDatabase, NewServer),\n    fx.Invoke(RegisterRoutes),\n)\napp.Run() \u002F\u002F blocks until SIGINT\u002FSIGTERM, then runs OnStop hooks\n```\n\nBoot stages: `fx.New` validates types (constructors do not run); `app.Start(ctx)` runs each `fx.Invoke` and fires OnStart hooks in topological order; main blocks on `app.Done()`; `app.Stop(ctx)` fires OnStop hooks in reverse order. Default timeout is **15 seconds** — override with `fx.StartTimeout` \u002F `fx.StopTimeout`.\n\n## Provide and Invoke\n\n```go\nfx.New(\n    fx.Provide(NewLogger, NewDatabase, NewServer),  \u002F\u002F lazy\n    fx.Invoke(RegisterRoutes, StartMetricsExporter), \u002F\u002F always run during Start\n)\n```\n\n`fx.Provide` registers constructors; `fx.Invoke` is the trigger — without an Invoke (directly or transitively) referencing a type, its constructor never runs.\n\n## Lifecycle Hooks\n\nInject `fx.Lifecycle` and append hooks. Constructors should return quickly; long-running work belongs in `OnStart`.\n\n```go\nfunc NewHTTPServer(lc fx.Lifecycle, log *zap.Logger, cfg *Config) *http.Server {\n    srv := &http.Server{Addr: cfg.Addr}\n\n    lc.Append(fx.Hook{\n        OnStart: func(ctx context.Context) error {\n            ln, err := net.Listen(\"tcp\", srv.Addr)\n            if err != nil { return err }\n            go srv.Serve(ln)         \u002F\u002F blocking work in a goroutine\n            return nil\n        },\n        OnStop: func(ctx context.Context) error {\n            return srv.Shutdown(ctx)\n        },\n    })\n    return srv\n}\n```\n\nBoth callbacks receive a context bounded by `StartTimeout`\u002F`StopTimeout` — respect cancellation. **OnStart must return quickly** — spawn a goroutine for blocking work; otherwise startup hangs and dependent hooks never fire.\n\n`fx.StartHook` \u002F `fx.StopHook` \u002F `fx.StartStopHook` adapt simpler signatures (no context, no error, or both):\n\n```go\nlc.Append(fx.StartStopHook(srv.Start, srv.Stop))   \u002F\u002F matched pair\n```\n\n## Parameter and Result Objects\n\nfx re-exports dig's `dig.In` \u002F `dig.Out` as `fx.In` \u002F `fx.Out`. Use them when a constructor has 4+ dependencies, or when you need `name`\u002F`group`\u002F`optional` tags.\n\n```go\ntype ServerParams struct {\n    fx.In\n\n    Logger *zap.Logger\n    DB     *sql.DB\n    Cache  *redis.Client     `optional:\"true\"`\n    Routes []http.Handler    `group:\"routes\"`\n}\n\nfunc NewServer(p ServerParams) *Server { \u002F* ... *\u002F }\n```\n\n## fx.Annotate\n\n`fx.Annotate` wraps a constructor to add tags or interface bindings without a `fx.Out` struct. Prefer it for ergonomic name\u002Fgroup\u002FAs bindings:\n\n```go\nfx.Provide(\n    fx.Annotate(NewPrimaryDB, fx.ResultTags(`name:\"primary\"`)),\n    fx.Annotate(NewPostgresDB, fx.As(new(Database))),    \u002F\u002F expose interface\n    fx.Annotate(NewUserHandler,\n        fx.As(new(http.Handler)),\n        fx.ResultTags(`group:\"routes\"`),\n    ),\n)\n```\n\n## Value Groups\n\nMany constructors, one consumer slice — typical for routes, health checks, metrics collectors:\n\n```go\ntype RouteResult struct {\n    fx.Out\n    Handler http.Handler `group:\"routes\"`\n}\n\ntype ServerParams struct {\n    fx.In\n    Routes []http.Handler `group:\"routes\"`\n}\n```\n\nAppend `,flatten` (`group:\"routes,flatten\"`) to unwrap a slice instead of nesting it. Order is **not guaranteed** — provide an explicit ordered slice when sequence matters.\n\n## fx.Module\n\n`fx.Module` groups providers, invokes, and decorators under a name. Modules **scope decorators** to themselves and their children — a logger renamed in `fx.Module(\"db\", ...)` only appears renamed for code inside that module.\n\n```go\nvar DatabaseModule = fx.Module(\"database\",\n    fx.Provide(NewConnection, NewUserRepository),\n    fx.Decorate(func(log *zap.Logger) *zap.Logger {\n        return log.Named(\"db\")\n    }),\n)\n\nfunc main() {\n    fx.New(\n        fx.Provide(NewConfig, NewLogger),\n        DatabaseModule,\n        HTTPModule,\n    ).Run()\n}\n```\n\nTreat each module as a small library that can be lifted into another app — its public surface is the types it Provides.\n\nFor `fx.Supply`\u002F`fx.Replace`\u002F`fx.Decorate`, optional deps, custom logging, manual lifecycle, and Quick Reference, see [advanced.md](.\u002Freferences\u002Fadvanced.md).\n\n## Best Practices\n\n1. Keep `main()` thin — providers, modules, and a single `Run()`. Push real work into modules so each can be tested in isolation.\n2. Use lifecycle hooks instead of `init()` or goroutines launched from constructors — Start\u002FStop ordering depends on graph topology, but `init()` goroutines do not, which leads to races and leaks.\n3. OnStart must return promptly — long work goes in a goroutine inside the hook. A blocking OnStart hangs the rest of the boot.\n4. Respect `ctx.Done()` in hooks — a hook that ignores cancellation is reported as a timeout failure but its goroutine continues, leaking resources.\n5. Group by module, not by layer — a module owns the providers, lifecycle, and decorators for one concern (HTTP, DB, metrics).\n6. Use `fx.Annotate` for tags rather than wrapping a constructor in an `fx.Out` struct — keeps the constructor reusable outside fx.\n7. Replace `fx.Provide` with `fx.Supply` for pre-built values (config, command-line flags). Shorter, signals intent.\n8. Validate the graph in CI by booting under `fx.New(...).Err()` — catches missing providers and cycles before deploy.\n\n## Common Mistakes\n\n| Mistake | Fix |\n| --- | --- |\n| Long-running work directly in OnStart | Spawn a goroutine inside OnStart; the hook itself must return quickly so dependent hooks can run. |\n| `fx.Provide` something that should be `fx.Supply` | Pre-built values (config, secrets) belong in `fx.Supply` — clearer and avoids a no-op constructor. |\n| Module decorator leaking to siblings | Decorate inside `fx.Module(...)` — decorators flow only to descendants. A top-level `fx.Decorate` is global. |\n| Group order assumed | Groups are unordered. If order matters, provide an ordered slice from one constructor. |\n| Constructors with side effects | Side effects belong in OnStart — constructors should be cheap and pure-ish, since they may run concurrently and lazily. |\n| Forgotten `fx.Invoke` | Without an Invoke (or downstream consumer), constructors never run. Add at least one Invoke per app. |\n\n## Testing\n\nUse `go.uber.org\u002Ffx\u002Ffxtest` to integrate fx with `*testing.T` (failures call `t.Fatal`, `RequireStop` registers as `t.Cleanup`). `fx.Populate(&target)` pulls values out of the graph; `fx.Replace` swaps real dependencies for fakes. Full patterns in [testing.md](.\u002Freferences\u002Ftesting.md).\n\n## Further Reading\n\n- [advanced.md](.\u002Freferences\u002Fadvanced.md) — Supply\u002FReplace\u002FDecorate, optional deps, custom event logging, manual lifecycle, full Quick Reference\n- [recipes.md](.\u002Freferences\u002Frecipes.md) — full HTTP service with database\u002Fmetrics, background workers with graceful drain, multiple impls of the same interface, manual lifecycle for CLI embedding\n- [testing.md](.\u002Freferences\u002Ftesting.md) — fxtest patterns, `fx.Replace`, `fx.Populate`, isolated lifecycle tests, CI graph validation\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-uber-dig` skill for the underlying container, `dig.In`\u002F`dig.Out`, and DI without lifecycle\n- → See `samber\u002Fcc-skills-golang@golang-dependency-injection` skill for DI concepts and library comparison\n- → See `samber\u002Fcc-skills-golang@golang-samber-do` skill for a generics-based alternative without reflection\n- → See `samber\u002Fcc-skills-golang@golang-google-wire` skill for compile-time DI (no runtime container)\n- → See `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill for interface design patterns\n- → See `samber\u002Fcc-skills-golang@golang-context` skill for context propagation in OnStart\u002FOnStop hooks\n- → See `samber\u002Fcc-skills-golang@golang-testing` skill for general testing patterns\n\nIf you encounter a bug or unexpected behavior in uber-go\u002Ffx, open an issue at \u003Chttps:\u002F\u002Fgithub.com\u002Fuber-go\u002Ffx\u002Fissues>.\n",{"name":5,"paths":24,"license":15,"metadata":26,"description":7,"allowed-tools":37,"compatibility":38,"user-invocable":39},[25],"**\u002F*.go",{"author":27,"version":28,"openclaw":29},"samber","1.2.2",{"emoji":30,"install":31,"homepage":32,"requires":33,"skill-library-version":36},"🏭",[],"https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang",{"bins":34},[35],"go","1.24.0","Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*","Designed for Claude Code, Codex or similar harness, and for projects using Golang.",true,"main","2147d79c9cd764770418b462c29634bcdc710096","plugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace","https:\u002F\u002Fgithub.com\u002Fheynemann","http:\u002F\u002Fwww.thumbor.org","CTO @ Flutter Brazil | Former Meta & Coinbase","2026-09-29 21:26:05",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":39},[50,53,56],{"tool":51,"command":52},"npx","npx skills add heynemann\u002Fomp-marketplace --skill golang-uber-fx",{"tool":54,"command":55},"bunx","bunx skills add heynemann\u002Fomp-marketplace --skill golang-uber-fx",{"tool":57,"command":58},"pnpm","pnpm dlx skills add heynemann\u002Fomp-marketplace --skill golang-uber-fx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002FSKILL.md",[61,67,71,75],{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"evals\u002Fevals.json","REFERENCE","参考文档",12825,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002Fevals\u002Fevals.json",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fadvanced.md",5448,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002Freferences\u002Fadvanced.md",{"path":72,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Frecipes.md",8826,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002Freferences\u002Frecipes.md",{"path":76,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Ftesting.md",4855,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-uber-fx\u002Freferences\u002Ftesting.md",[80,87,94,101,108,115],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7DFXDYP0N6P8KR0AF7C0TDK","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7DFX9C5B0T1T0AVDCWNR5P2","write-skill","Use when creating, designing, or fixing an agent skill (SKILL.md pack) — triggers include \"write a skill\", \"make me a skill\", \"create a skill\", skill directories, and skills that fail to trigger or fire on the wrong tasks.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwrite-skill\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7DFX64VSTQV0CSGYR76MPZF","write-agent","Use when creating, designing, or fixing an omp subagent (task agent) — triggers include \"write an agent\", \"make me an agent\", \"create a subagent\", agent `.md` definitions, and agents that misbehave when spawned via task.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwrite-agent\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7DFX22JEY7ZN9EDESM732K5","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7DFWYXR5V2CY2BPDAAS19R1","wayfinder","Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M7DFWXFFMBKV294WS66S475V","wait-what","Stop. That last message did not land: re-pitch it.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwait-what\u002FSKILL.md",[],[]]