[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JZCKDKSZ49ZH7ZS4STSMC7":3,"skill-same:01M6JZCKDKSZ49ZH7ZS4STSMC7":105},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":14,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":60,"install":61,"resources":74},"01M6JZCKDKSZ49ZH7ZS4STSMC7","golang-design-patterns",null,"Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, and streaming. Apply when designing Go APIs, structuring applications, choosing between patterns, making design decisions, architectural choices, or production hardening.","paulohgodinho\u002Fskills","paulohgodinho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F57510522?v=4","01M6JZBW2QZR573QTV4PN1H6DE","Paulo Godinho","01M6JZBW6QM55GHQB0K3BC6D45",0,"MIT","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"golang","patterns","golang design patterns","design","design patterns","dependency","resource management","functional","error","false","options","shutdown","read","projects","Bash","streaming","code","resilience","ai coding agents","architecture","2026-11-10 10:12:30",false,"---\nname: golang-design-patterns\ndescription: \"Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, and streaming. Apply when designing Go APIs, structuring applications, choosing between patterns, making design decisions, architectural choices, or production hardening.\"\nuser-invocable: false\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.0\"\n  openclaw:\n    emoji: \"?️\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\n    requires:\n      bins:\n        - go\n    install: []\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent\n---\n\n**Persona:** You are a Go architect who values simplicity and explicitness. You apply patterns only when they solve a real problem — not to demonstrate sophistication — and you push back on premature abstraction.\n\n**Modes:**\n\n- **Design mode** — creating new APIs, packages, or application structure: ask the developer about their architecture preference before proposing patterns; favor the smallest pattern that satisfies the requirement.\n- **Review mode** — auditing existing code for design issues: scan for `init()` abuse, unbounded resources, missing timeouts, and implicit global state; report findings before suggesting refactors.\n\n> **Community default.** A company skill that explicitly supersedes `samber\u002Fcc-skills-golang@golang-design-patterns` skill takes precedence.\n\n# Go Design Patterns & Idioms\n\nIdiomatic Go patterns for production-ready code. For struct\u002Finterface design see [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md).\n\n## Best Practices Summary\n\n1. Constructors SHOULD use **functional options** — they scale better as APIs evolve (one function per option, no breaking changes)\n2. Functional options MUST **return an error** if validation can fail — catch bad config at construction, not at runtime\n3. **Avoid `init()`** — runs implicitly, cannot return errors, makes testing unpredictable. Use explicit constructors\n4. Enums SHOULD **start at 1** (or Unknown sentinel at 0) — Go's zero value silently passes as the first enum member\n5. Error cases MUST be **handled first** with early return — keep happy path flat\n6. **Panic is for bugs, not expected errors** — callers can handle returned errors; panics crash the process\n7. **`defer Close()` immediately after opening** — later code changes can accidentally skip cleanup\n8. **`runtime.AddCleanup`** over `runtime.SetFinalizer` — finalizers are unpredictable and can resurrect objects\n9. Every external call SHOULD **have a timeout** — a slow upstream hangs your goroutine indefinitely\n10. **Limit everything** (pool sizes, queue depths, buffers) — unbounded resources grow until they crash\n11. Retry logic MUST **check context cancellation** between attempts\n12. **Use `strings.Builder`** for concatenation in loops → see [golang-code-style](..\u002Fgolang-code-style\u002FSKILL.md)\n13. string vs []byte: **use `[]byte` for mutation and I\u002FO**, `string` for display and keys — conversions allocate\n14. Iterators (Go 1.23+): **use for lazy evaluation** — avoid loading everything into memory\n15. **Stream large transfers** — loading millions of rows causes OOM; stream keeps memory constant\n16. `\u002F\u002Fgo:embed` for **static assets** — embeds at compile time, eliminates runtime file I\u002FO errors\n17. **Use `crypto\u002Frand`** for keys\u002Ftokens — `math\u002Frand` is predictable\n18. Regexp MUST be **compiled once at package level** — compilation is O(n) and allocates\n19. Compile-time interface checks: **`var _ Interface = (*Type)(nil)`**\n20. **A little recode > a big dependency** — each dep adds attack surface and maintenance burden\n21. **Design for testability** — accept interfaces, inject dependencies\n\n## Constructor Patterns: Functional Options vs Builder\n\n### Functional Options (Preferred)\n\n```go\ntype Server struct {\n    addr         string\n    readTimeout  time.Duration\n    writeTimeout time.Duration\n    maxConns     int\n}\n\ntype Option func(*Server)\n\nfunc WithReadTimeout(d time.Duration) Option {\n    return func(s *Server) { s.readTimeout = d }\n}\n\nfunc WithWriteTimeout(d time.Duration) Option {\n    return func(s *Server) { s.writeTimeout = d }\n}\n\nfunc WithMaxConns(n int) Option {\n    return func(s *Server) { s.maxConns = n }\n}\n\nfunc NewServer(addr string, opts ...Option) *Server {\n    \u002F\u002F Default options\n    s := &Server{\n        addr:         addr,\n        readTimeout:  5 * time.Second,\n        writeTimeout: 10 * time.Second,\n        maxConns:     100,\n    }\n    for _, opt := range opts {\n        opt(s)\n    }\n    return s\n}\n\n\u002F\u002F Usage\nsrv := NewServer(\":8080\",\n    WithReadTimeout(30*time.Second),\n    WithMaxConns(500),\n)\n```\n\nConstructors SHOULD use **functional options** — they scale better with API evolution and require less code. Use builder pattern only if you need complex validation between configuration steps.\n\n## Constructors & Initialization\n\n### Avoid `init()` and Mutable Globals\n\n`init()` runs implicitly, makes testing harder, and creates hidden dependencies:\n\n- Multiple `init()` functions run in declaration order, across files in **filename alphabetical order** — fragile\n- Cannot return errors — failures must panic or `log.Fatal`\n- Runs before `main()` and tests — side effects make tests unpredictable\n\n```go\n\u002F\u002F Bad — hidden global state\nvar db *sql.DB\n\nfunc init() {\n    var err error\n    db, err = sql.Open(\"postgres\", os.Getenv(\"DATABASE_URL\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n\n\u002F\u002F Good — explicit initialization, injectable\nfunc NewUserRepository(db *sql.DB) *UserRepository {\n    return &UserRepository{db: db}\n}\n```\n\n### Enums: Start at 1\n\nZero values should represent invalid\u002Funset state:\n\n```go\ntype Status int\n\nconst (\n    StatusUnknown Status = iota \u002F\u002F 0 = invalid\u002Funset\n    StatusActive                \u002F\u002F 1\n    StatusInactive              \u002F\u002F 2\n    StatusSuspended             \u002F\u002F 3\n)\n```\n\n### Compile Regexp Once\n\n```go\n\u002F\u002F Good — compiled once at package level\nvar emailRegex = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$`)\n\nfunc ValidateEmail(email string) bool {\n    return emailRegex.MatchString(email)\n}\n```\n\n### Use `\u002F\u002Fgo:embed` for Static Assets\n\n```go\nimport \"embed\"\n\n\u002F\u002Fgo:embed templates\u002F*\nvar templateFS embed.FS\n\n\u002F\u002Fgo:embed version.txt\nvar version string\n```\n\n### Compile-Time Interface Checks\n\n→ See [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md) for the `var _ Interface = (*Type)(nil)` pattern.\n\n## Error Flow Patterns\n\nError cases MUST be handled first with early return — keep the happy path at minimal indentation. → See [golang-code-style](..\u002Fgolang-code-style\u002FSKILL.md) for the full pattern and examples.\n\n### When to Panic vs Return Error\n\n- **Return error**: network failures, file not found, invalid input — anything a caller can handle\n- **Panic**: nil pointer in a place that should be impossible, violated invariant, `Must*` constructors used at init time\n- **`.Close()` errors**: acceptable to not check — `defer f.Close()` is fine without error handling\n\n## Data Handling\n\n### string vs []byte vs []rune\n\n| Type     | Default for | Use when                                            |\n| -------- | ----------- | --------------------------------------------------- |\n| `string` | Everything  | Immutable, safe, UTF-8                              |\n| `[]byte` | I\u002FO         | Writing to `io.Writer`, building strings, mutations |\n| `[]rune` | Unicode ops | `len()` must mean characters, not bytes             |\n\nAvoid repeated conversions — each one allocates. Stay in one type until you need the other.\n\n### Iterators & Streaming for Large Data\n\nUse iterators (Go 1.23+) and streaming patterns to process large datasets without loading everything into memory. For large transfers between services (e.g., 1M rows DB to HTTP), stream to prevent OOM.\n\nFor code examples, see [Data Handling Patterns](references\u002Fdata-handling.md).\n\n## Resource Management\n\n`defer Close()` immediately after opening — don't wait, don't forget:\n\n```go\nf, err := os.Open(path)\nif err != nil {\n    return err\n}\ndefer f.Close() \u002F\u002F right here, not 50 lines later\n\nrows, err := db.QueryContext(ctx, query)\nif err != nil {\n    return err\n}\ndefer rows.Close()\n```\n\nFor graceful shutdown, resource pools, and `runtime.AddCleanup`, see [Resource Management](references\u002Fresource-management.md).\n\n## Resilience & Limits\n\n### Timeout Every External Call\n\n```go\nctx, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\n\nresp, err := httpClient.Do(req.WithContext(ctx))\n```\n\n### Retry & Context Checks\n\nRetry logic MUST check `ctx.Err()` between attempts and use exponential\u002Flinear backoff via `select` on `ctx.Done()`. Long loops MUST check `ctx.Err()` periodically.\n\n## Database Patterns\n\nSee the `samber\u002Fcc-skills-golang@golang-database` skill for sqlx\u002Fpgx, transactions, nullable columns, connection pools, repository interfaces, testing.\n\n## Architecture\n\nAsk the developer which architecture they prefer: clean architecture, hexagonal, DDD, or flat layout. Don't impose complex architecture on a small project.\n\nCore principles regardless of architecture:\n\n- **Keep domain pure** — no framework dependencies in the domain layer\n- **Fail fast** — validate at boundaries, trust internal code\n- **Make illegal states unrepresentable** — use types to enforce invariants\n- **Respect 12-factor app** principles — → see [golang-project-layout](..\u002Fgolang-project-layout\u002FSKILL.md)\n\n## Detailed Guides\n\n| Guide | Scope |\n| --- | --- |\n| [Architecture Patterns](references\u002Farchitecture.md) | High-level principles, when each architecture fits |\n| [Clean Architecture](references\u002Fclean-architecture.md) | Use cases, dependency rule, layered adapters |\n| [Hexagonal Architecture](references\u002Fhexagonal-architecture.md) | Ports and adapters, domain core isolation |\n| [Domain-Driven Design](references\u002Fddd.md) | Aggregates, value objects, bounded contexts |\n\n## Code Philosophy\n\n- **Avoid repetitive code** — but don't abstract prematurely\n- **Minimize dependencies** — a little recode > a big dependency\n- **Design for testability** — accept interfaces, inject dependencies, keep functions pure\n\n## Cross-References\n\n- → See [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md) for interface design and composition\n- → See [golang-project-layout](..\u002Fgolang-project-layout\u002FSKILL.md) for architecture and directory structure\n","**Persona:** You are a Go architect who values simplicity and explicitness. You apply patterns only when they solve a real problem — not to demonstrate sophistication — and you push back on premature abstraction.\n\n**Modes:**\n\n- **Design mode** — creating new APIs, packages, or application structure: ask the developer about their architecture preference before proposing patterns; favor the smallest pattern that satisfies the requirement.\n- **Review mode** — auditing existing code for design issues: scan for `init()` abuse, unbounded resources, missing timeouts, and implicit global state; report findings before suggesting refactors.\n\n> **Community default.** A company skill that explicitly supersedes `samber\u002Fcc-skills-golang@golang-design-patterns` skill takes precedence.\n\n# Go Design Patterns & Idioms\n\nIdiomatic Go patterns for production-ready code. For struct\u002Finterface design see [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md).\n\n## Best Practices Summary\n\n1. Constructors SHOULD use **functional options** — they scale better as APIs evolve (one function per option, no breaking changes)\n2. Functional options MUST **return an error** if validation can fail — catch bad config at construction, not at runtime\n3. **Avoid `init()`** — runs implicitly, cannot return errors, makes testing unpredictable. Use explicit constructors\n4. Enums SHOULD **start at 1** (or Unknown sentinel at 0) — Go's zero value silently passes as the first enum member\n5. Error cases MUST be **handled first** with early return — keep happy path flat\n6. **Panic is for bugs, not expected errors** — callers can handle returned errors; panics crash the process\n7. **`defer Close()` immediately after opening** — later code changes can accidentally skip cleanup\n8. **`runtime.AddCleanup`** over `runtime.SetFinalizer` — finalizers are unpredictable and can resurrect objects\n9. Every external call SHOULD **have a timeout** — a slow upstream hangs your goroutine indefinitely\n10. **Limit everything** (pool sizes, queue depths, buffers) — unbounded resources grow until they crash\n11. Retry logic MUST **check context cancellation** between attempts\n12. **Use `strings.Builder`** for concatenation in loops → see [golang-code-style](..\u002Fgolang-code-style\u002FSKILL.md)\n13. string vs []byte: **use `[]byte` for mutation and I\u002FO**, `string` for display and keys — conversions allocate\n14. Iterators (Go 1.23+): **use for lazy evaluation** — avoid loading everything into memory\n15. **Stream large transfers** — loading millions of rows causes OOM; stream keeps memory constant\n16. `\u002F\u002Fgo:embed` for **static assets** — embeds at compile time, eliminates runtime file I\u002FO errors\n17. **Use `crypto\u002Frand`** for keys\u002Ftokens — `math\u002Frand` is predictable\n18. Regexp MUST be **compiled once at package level** — compilation is O(n) and allocates\n19. Compile-time interface checks: **`var _ Interface = (*Type)(nil)`**\n20. **A little recode > a big dependency** — each dep adds attack surface and maintenance burden\n21. **Design for testability** — accept interfaces, inject dependencies\n\n## Constructor Patterns: Functional Options vs Builder\n\n### Functional Options (Preferred)\n\n```go\ntype Server struct {\n    addr         string\n    readTimeout  time.Duration\n    writeTimeout time.Duration\n    maxConns     int\n}\n\ntype Option func(*Server)\n\nfunc WithReadTimeout(d time.Duration) Option {\n    return func(s *Server) { s.readTimeout = d }\n}\n\nfunc WithWriteTimeout(d time.Duration) Option {\n    return func(s *Server) { s.writeTimeout = d }\n}\n\nfunc WithMaxConns(n int) Option {\n    return func(s *Server) { s.maxConns = n }\n}\n\nfunc NewServer(addr string, opts ...Option) *Server {\n    \u002F\u002F Default options\n    s := &Server{\n        addr:         addr,\n        readTimeout:  5 * time.Second,\n        writeTimeout: 10 * time.Second,\n        maxConns:     100,\n    }\n    for _, opt := range opts {\n        opt(s)\n    }\n    return s\n}\n\n\u002F\u002F Usage\nsrv := NewServer(\":8080\",\n    WithReadTimeout(30*time.Second),\n    WithMaxConns(500),\n)\n```\n\nConstructors SHOULD use **functional options** — they scale better with API evolution and require less code. Use builder pattern only if you need complex validation between configuration steps.\n\n## Constructors & Initialization\n\n### Avoid `init()` and Mutable Globals\n\n`init()` runs implicitly, makes testing harder, and creates hidden dependencies:\n\n- Multiple `init()` functions run in declaration order, across files in **filename alphabetical order** — fragile\n- Cannot return errors — failures must panic or `log.Fatal`\n- Runs before `main()` and tests — side effects make tests unpredictable\n\n```go\n\u002F\u002F Bad — hidden global state\nvar db *sql.DB\n\nfunc init() {\n    var err error\n    db, err = sql.Open(\"postgres\", os.Getenv(\"DATABASE_URL\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n\n\u002F\u002F Good — explicit initialization, injectable\nfunc NewUserRepository(db *sql.DB) *UserRepository {\n    return &UserRepository{db: db}\n}\n```\n\n### Enums: Start at 1\n\nZero values should represent invalid\u002Funset state:\n\n```go\ntype Status int\n\nconst (\n    StatusUnknown Status = iota \u002F\u002F 0 = invalid\u002Funset\n    StatusActive                \u002F\u002F 1\n    StatusInactive              \u002F\u002F 2\n    StatusSuspended             \u002F\u002F 3\n)\n```\n\n### Compile Regexp Once\n\n```go\n\u002F\u002F Good — compiled once at package level\nvar emailRegex = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$`)\n\nfunc ValidateEmail(email string) bool {\n    return emailRegex.MatchString(email)\n}\n```\n\n### Use `\u002F\u002Fgo:embed` for Static Assets\n\n```go\nimport \"embed\"\n\n\u002F\u002Fgo:embed templates\u002F*\nvar templateFS embed.FS\n\n\u002F\u002Fgo:embed version.txt\nvar version string\n```\n\n### Compile-Time Interface Checks\n\n→ See [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md) for the `var _ Interface = (*Type)(nil)` pattern.\n\n## Error Flow Patterns\n\nError cases MUST be handled first with early return — keep the happy path at minimal indentation. → See [golang-code-style](..\u002Fgolang-code-style\u002FSKILL.md) for the full pattern and examples.\n\n### When to Panic vs Return Error\n\n- **Return error**: network failures, file not found, invalid input — anything a caller can handle\n- **Panic**: nil pointer in a place that should be impossible, violated invariant, `Must*` constructors used at init time\n- **`.Close()` errors**: acceptable to not check — `defer f.Close()` is fine without error handling\n\n## Data Handling\n\n### string vs []byte vs []rune\n\n| Type     | Default for | Use when                                            |\n| -------- | ----------- | --------------------------------------------------- |\n| `string` | Everything  | Immutable, safe, UTF-8                              |\n| `[]byte` | I\u002FO         | Writing to `io.Writer`, building strings, mutations |\n| `[]rune` | Unicode ops | `len()` must mean characters, not bytes             |\n\nAvoid repeated conversions — each one allocates. Stay in one type until you need the other.\n\n### Iterators & Streaming for Large Data\n\nUse iterators (Go 1.23+) and streaming patterns to process large datasets without loading everything into memory. For large transfers between services (e.g., 1M rows DB to HTTP), stream to prevent OOM.\n\nFor code examples, see [Data Handling Patterns](references\u002Fdata-handling.md).\n\n## Resource Management\n\n`defer Close()` immediately after opening — don't wait, don't forget:\n\n```go\nf, err := os.Open(path)\nif err != nil {\n    return err\n}\ndefer f.Close() \u002F\u002F right here, not 50 lines later\n\nrows, err := db.QueryContext(ctx, query)\nif err != nil {\n    return err\n}\ndefer rows.Close()\n```\n\nFor graceful shutdown, resource pools, and `runtime.AddCleanup`, see [Resource Management](references\u002Fresource-management.md).\n\n## Resilience & Limits\n\n### Timeout Every External Call\n\n```go\nctx, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\n\nresp, err := httpClient.Do(req.WithContext(ctx))\n```\n\n### Retry & Context Checks\n\nRetry logic MUST check `ctx.Err()` between attempts and use exponential\u002Flinear backoff via `select` on `ctx.Done()`. Long loops MUST check `ctx.Err()` periodically.\n\n## Database Patterns\n\nSee the `samber\u002Fcc-skills-golang@golang-database` skill for sqlx\u002Fpgx, transactions, nullable columns, connection pools, repository interfaces, testing.\n\n## Architecture\n\nAsk the developer which architecture they prefer: clean architecture, hexagonal, DDD, or flat layout. Don't impose complex architecture on a small project.\n\nCore principles regardless of architecture:\n\n- **Keep domain pure** — no framework dependencies in the domain layer\n- **Fail fast** — validate at boundaries, trust internal code\n- **Make illegal states unrepresentable** — use types to enforce invariants\n- **Respect 12-factor app** principles — → see [golang-project-layout](..\u002Fgolang-project-layout\u002FSKILL.md)\n\n## Detailed Guides\n\n| Guide | Scope |\n| --- | --- |\n| [Architecture Patterns](references\u002Farchitecture.md) | High-level principles, when each architecture fits |\n| [Clean Architecture](references\u002Fclean-architecture.md) | Use cases, dependency rule, layered adapters |\n| [Hexagonal Architecture](references\u002Fhexagonal-architecture.md) | Ports and adapters, domain core isolation |\n| [Domain-Driven Design](references\u002Fddd.md) | Aggregates, value objects, bounded contexts |\n\n## Code Philosophy\n\n- **Avoid repetitive code** — but don't abstract prematurely\n- **Minimize dependencies** — a little recode > a big dependency\n- **Design for testability** — accept interfaces, inject dependencies, keep functions pure\n\n## Cross-References\n\n- → See [golang-structs-interfaces](..\u002Fgolang-structs-interfaces\u002FSKILL.md) for interface design and composition\n- → See [golang-project-layout](..\u002Fgolang-project-layout\u002FSKILL.md) for architecture and directory structure\n",{"name":5,"license":15,"metadata":44,"description":7,"allowed-tools":54,"compatibility":55,"user-invocable":40},{"author":45,"version":46,"openclaw":47},"samber","1.0",{"emoji":48,"install":49,"homepage":50,"requires":51},"?️",[],"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills",{"bins":52},[53],"go","Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent","Designed for Claude Code or similar AI coding agents, and for projects using Golang.","main","f1ec08caf4f3441b371842829bc5b7e2fae2b11a","skills\u002Fgo\u002Fgolang-design-patterns","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho","2026-04-04 09:40:33",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add paulohgodinho\u002Fskills --skill golang-design-patterns",{"tool":67,"command":68},"bunx","bunx skills add paulohgodinho\u002Fskills --skill golang-design-patterns",{"tool":70,"command":71},"pnpm","pnpm dlx skills add paulohgodinho\u002Fskills --skill golang-design-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002FSKILL.md",true,[75,81,85,89,93,97,101],{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fevals.json","REFERENCE","参考文档",20756,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Fevals\u002Fevals.json",{"path":82,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Farchitecture.md",4786,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Farchitecture.md",{"path":86,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fclean-architecture.md",5127,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Fclean-architecture.md",{"path":90,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fdata-handling.md",1667,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Fdata-handling.md",{"path":94,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fddd.md",6916,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Fddd.md",{"path":98,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fhexagonal-architecture.md",6180,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Fhexagonal-architecture.md",{"path":102,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fresource-management.md",4119,"https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-design-patterns\u002Freferences\u002Fresource-management.md",[106,123,142,157,173,189],{"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":39},"01M6JZD7VH66ESK96RANN6C5J1","golang-structs-interfaces","Golang struct and interface design patterns — composition, embedding, type assertions, type switches, interface segregation, dependency injection via interfaces, struct field tags, and pointer vs value receivers. Use this skill when designing Go types, defining or implementing interfaces, embedding structs or interfaces, writing type assertions or type switches, adding struct field tags for JSON\u002FYAML\u002FDB serialization, or choosing between pointer and value receivers. Also use when the user asks about \"accept interfaces, return structs\", compile-time interface checks, or composing small interfaces into larger ones.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-structs-interfaces\u002FSKILL.md",[],[19,113,22,114,37,35,115,33,32,31,116,24,23,117,118,28,119,120,121,122],"golang structs interfaces","writing","Composition","write","time","db","embedding","types","interface","implementing",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":39},"01M6JZD385E2VQ9MEPJGZK2RH5","golang-project-layout","Provides a guide for setting up Golang project layouts and workspaces. Use this whenever starting a new Go project, organizing an existing codebase, setting up a monorepo with multiple packages, creating CLI tools with multiple main packages, or deciding on directory structure. Apply this for any Go project initialization or restructuring work.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-project-layout\u002FSKILL.md",[],[19,130,131,132,133,134,37,135,35,33,32,136,137,31,116,138,139,56,140,141],"golang project layout","project","layout","directory","cli","packages","monorepo","work","up","workspaces","structure","initialization",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":39},"01M6JZCXBFYKM5A7W8QHBG5SP6","golang-naming","Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters\u002Fsetters, functional options, acronyms, test functions, and subtest names. Use this skill when writing new Go code, reviewing or refactoring, choosing between naming alternatives (New vs NewTypeName, isConnected vs connected, ErrNotFound vs NotFoundError, StatusReady vs StatusUnknown at iota 0), debating Go package names (utils\u002Fhelpers anti-patterns), or asking about Go naming best practices. Also trigger when the user mentions MixedCaps vs snake_case, ALL_CAPS constants, Get-prefix on getters, or error string casing. Do NOT use for general Go implementation questions that don't involve naming decisions.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-naming\u002FSKILL.md",[],[19,149,150,114,37,135,35,33,151,32,31,152,29,153,28,27,26,154,155,156],"golang naming","naming","refactoring","anti-patterns","get","errors","utils","at",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":39},"01M6JZCRJPW41M4A70HYKEMN19","golang-lint","Provides linting best practices and golangci-lint configuration for Go projects. Covers running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and managing linter settings. Use this skill whenever the user runs linters, configures golangci-lint, asks about lint warnings or suppressions, sets up code quality tooling, or asks which linters to enable for a Go project. Also use when the user mentions golangci-lint, go vet, staticcheck, revive, or any Go linting tool.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-linter\u002FSKILL.md",[],[164,19,165,53,37,35,166,33,32,167,168,169,31,116,170,138,131,28,171,172],"lint","golang lint","git","coding","linter","brew","edit","linting","which",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":39},"01M6JZCE2S3X0WWK38MZSTHH3A","golang-dependency-injection","Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google\u002Fwire, uber-go\u002Fdig, uber-go\u002Ffx). Use this skill when designing service architecture, setting up dependency injection, refactoring tightly coupled code, managing singletons or service factories, or when the user asks about inversion of control, service containers, or wiring dependencies in Go.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-dependency-injection\u002FSKILL.md",[],[19,180,24,181,182,183,38,37,35,184,33,151,32,31,138,185,186,28,187,188],"injection","golang dependency injection","dependency injection","MCP","why","context7","query","separation of concerns","wiring",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":39},"01M6JZC9YB4PHATT09BNY5B4WK","golang-code-style","Golang code style, formatting and conventions. Use when writing code, reviewing style, configuring linters, writing comments, or establishing project standards.","https:\u002F\u002Fgithub.com\u002Fpaulohgodinho\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgo\u002Fgolang-code-style\u002FSKILL.md",[],[196,35,19,197,198,114,53,37,166,33,32,167,31,116,170,199,131,200,28,201],"code style","golang code style","style","standards","formatting","for"]