[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ANXNXSDCMMNNDP71BQ61K":3,"skill-same:01M79ANXNXSDCMMNNDP71BQ61K":88},{"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":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":6,"updatedAt":44,"install":45,"resources":57},"01M79ANXNXSDCMMNNDP71BQ61K","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, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.","CCH-HQ\u002Fcchp-automation","CCH-HQ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253065381?v=4","01M79AG9QPRTJEVTCT1ZS7TM9J","CCH HQ","01M79AG9RNM4TAB3PJQH71X62P",2,"MIT","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.\"\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.1.5\"\n  openclaw:\n    emoji: \"🏗\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang\n    requires:\n      bins:\n        - go\n    install: []\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestion\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 error handling details see the `samber\u002Fcc-skills-golang@golang-error-handling` skill; for context propagation see `samber\u002Fcc-skills-golang@golang-context` skill; for struct\u002Finterface design see `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill.\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 `samber\u002Fcc-skills-golang@golang-code-style`\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 → see `samber\u002Fcc-skills-golang@golang-security`\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 `samber\u002Fcc-skills-golang@golang-structs-interfaces` 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 `samber\u002Fcc-skills-golang@golang-code-style` 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()` \u002F `Flush()` errors**: read-only cleanup can often use `defer f.Close()`, but write\u002Fflush resources must report close or flush errors when durability matters\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. → See `samber\u002Fcc-skills-golang@golang-context` skill.\n\n## Database Patterns\n\n→ See `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 `samber\u002Fcc-skills-golang@golang-project-layout`\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 `samber\u002Fcc-skills-golang@golang-data-structures` skill for data structure selection, internals, and container\u002F packages\n- → See `samber\u002Fcc-skills-golang@golang-error-handling` skill for error wrapping, sentinel errors, and the single handling rule\n- → See `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill for interface design and composition\n- → See `samber\u002Fcc-skills-golang@golang-concurrency` skill for goroutine lifecycle and graceful shutdown\n- → See `samber\u002Fcc-skills-golang@golang-context` skill for timeout and cancellation patterns\n- → See `samber\u002Fcc-skills-golang@golang-project-layout` skill for architecture and directory structure\n- → See `samber\u002Fcc-skills-golang@golang-refactoring` skill for safely staging a migration toward one of these patterns (options struct, DI, consumer-side interfaces) across an existing codebase\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 error handling details see the `samber\u002Fcc-skills-golang@golang-error-handling` skill; for context propagation see `samber\u002Fcc-skills-golang@golang-context` skill; for struct\u002Finterface design see `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill.\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 `samber\u002Fcc-skills-golang@golang-code-style`\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 → see `samber\u002Fcc-skills-golang@golang-security`\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 `samber\u002Fcc-skills-golang@golang-structs-interfaces` 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 `samber\u002Fcc-skills-golang@golang-code-style` 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()` \u002F `Flush()` errors**: read-only cleanup can often use `defer f.Close()`, but write\u002Fflush resources must report close or flush errors when durability matters\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. → See `samber\u002Fcc-skills-golang@golang-context` skill.\n\n## Database Patterns\n\n→ See `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 `samber\u002Fcc-skills-golang@golang-project-layout`\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 `samber\u002Fcc-skills-golang@golang-data-structures` skill for data structure selection, internals, and container\u002F packages\n- → See `samber\u002Fcc-skills-golang@golang-error-handling` skill for error wrapping, sentinel errors, and the single handling rule\n- → See `samber\u002Fcc-skills-golang@golang-structs-interfaces` skill for interface design and composition\n- → See `samber\u002Fcc-skills-golang@golang-concurrency` skill for goroutine lifecycle and graceful shutdown\n- → See `samber\u002Fcc-skills-golang@golang-context` skill for timeout and cancellation patterns\n- → See `samber\u002Fcc-skills-golang@golang-project-layout` skill for architecture and directory structure\n- → See `samber\u002Fcc-skills-golang@golang-refactoring` skill for safely staging a migration toward one of these patterns (options struct, DI, consumer-side interfaces) across an existing codebase\n",{"name":5,"license":15,"metadata":24,"description":7,"allowed-tools":34,"compatibility":35,"user-invocable":36},{"author":25,"version":26,"openclaw":27},"samber","1.1.5",{"emoji":28,"install":29,"homepage":30,"requires":31},"🏗",[],"https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang",{"bins":32},[33],"go","Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestion","Designed for Claude Code or similar AI coding agents, and for projects using Golang.",true,"main","a93764baed707eda5a68d91e19e5719368e6335e","skills-backup\u002Fskills\u002Fgolang-design-patterns",0,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation","https:\u002F\u002Fgithub.com\u002FCCH-HQ","https:\u002F\u002Fclaude-code-hub.app\u002F","2026-11-09 20:50:54",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":36},[47,50,53],{"tool":48,"command":49},"npx","npx skills add CCH-HQ\u002Fcchp-automation --skill golang-design-patterns",{"tool":51,"command":52},"bunx","bunx skills add CCH-HQ\u002Fcchp-automation --skill golang-design-patterns",{"tool":54,"command":55},"pnpm","pnpm dlx skills add CCH-HQ\u002Fcchp-automation --skill golang-design-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002FSKILL.md",[58,64,68,72,76,80,84],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},"evals\u002Fevals.json","REFERENCE","参考文档",20756,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Fevals\u002Fevals.json",{"path":65,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Farchitecture.md",4786,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Farchitecture.md",{"path":69,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fclean-architecture.md",5127,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Fclean-architecture.md",{"path":73,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fdata-handling.md",1667,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Fdata-handling.md",{"path":77,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fddd.md",6916,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Fddd.md",{"path":81,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fhexagonal-architecture.md",6180,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Fhexagonal-architecture.md",{"path":85,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fresource-management.md",4119,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-design-patterns\u002Freferences\u002Fresource-management.md",[89,96,103,110,117,124],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M79B44RKSB6Z0GENGYFCCZYA","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M79B410BHDSNHZ7MKAYXWJHS","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M79B3XK29MCD5HGD50YGYXQZ","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\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":19},"01M79B3TFQEXXM2KK5V44H64DV","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\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":19},"01M79B3Q3WTMJDM6NNGG1X4NYK","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fverification-before-completion\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":19},"01M79B3GW8YCKT7W489HKWFMNC","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[]]