[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M76HB2WEV7GMPVTTYKJ0R6QX":3,"skill-same:01M76HB2WEV7GMPVTTYKJ0R6QX":69},{"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":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":62},"01M76HB2WEV7GMPVTTYKJ0R6QX","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.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fgolang-uber-fx\u002FSKILL.md",[],[],"2026-11-12 13:55:43",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,"master","fd76f882a04e445e899d5cfb2732f2105ea054ee","skills\u002Fmarketplace\u002Fgolang-uber-fx",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":39},[52,55,58],{"tool":53,"command":54},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill golang-uber-fx",{"tool":56,"command":57},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill golang-uber-fx",{"tool":59,"command":60},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill golang-uber-fx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fgolang-uber-fx\u002FSKILL.md",[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"skill-report.json","REFERENCE","参考文档",79820,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fgolang-uber-fx\u002Fskill-report.json",[70,78,85,92,99,106],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":77},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":77},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":77},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":77},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":77},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":77},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]