golang-patterns
- Repo stars 0
- Author updated Live
- Author repo skills-registry
- Domain
- Other
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Shell exec
- Env read
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: golang-patterns
description: >- Use when this capability is needed. Idiomatic Go reference pack — concurrency, interfaces, ge…
category: other
runtime: no special runtime
---
# golang-patterns output preview
## PART A: Task fit
- Use case: >- Use when this capability is needed. Idiomatic Go reference pack — concurrency, interfaces, generics, testing, project structure, plus the anti-patterns agents most commonly get wrong. runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Reference Guide / Core Workflow / Core Pattern Example” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “>- Use when this capability is needed. Idiomatic Go reference pack — concurrency, interfaces, generics, testing, project structure, plus the anti-patterns agents most commonly get wrong. runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “Reference Guide / Core Workflow / Core Pattern Example” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files, run shell commands, read environment variables; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files, run shell commands, read environment variables; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files, run shell commands, read environment variables.
Start with a small task and check whether the result follows “Reference Guide / Core Workflow / Core Pattern Example”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: golang-patterns
description: >- Use when this capability is needed. Idiomatic Go reference pack — concurrency, interfaces, ge…
category: other
source: tomevault-io/skills-registry
---
# golang-patterns
## When to use
- >- Use when this capability is needed. Idiomatic Go reference pack — concurrency, interfaces, generics, testing, proje…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Reference Guide / Core Workflow / Core Pattern Example” and keep inference separate from source facts.
- read files, write/modify files, run shell commands, read environment variables; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "golang-patterns" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Reference Guide / Core Workflow / Core Pattern Example
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files, run shell commands, read environment variables | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Golang Patterns
Idiomatic Go reference pack — concurrency, interfaces, generics, testing, project structure, plus the anti-patterns agents most commonly get wrong. Two-thesis stack:
- Clear is better than clever. Boring, explicit, maintainable Go (Jon Bodner, Learning Go, 2nd ed.).
- Production-grade by default. Bounded goroutine lifetimes, context threading, race-detector-clean tests, gofmt + golangci-lint on every change.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Concurrency | references/concurrency.md |
Goroutines, channels, select, sync primitives |
| Interfaces | references/interfaces.md |
Interface design, io.Reader/Writer, composition |
| Generics | references/generics.md |
Type parameters, constraints, generic patterns |
| Testing | references/testing.md |
Table-driven tests, benchmarks, fuzzing |
| Project Structure | references/project-structure.md |
Module layout, internal packages, go.mod |
| Idiomatic Go (anti-patterns) | references/idiomatic-go.md |
Quick anti-pattern → idiomatic-fix tables, decision rules, agent-specific rationalization counters |
Core Workflow
- Analyze architecture — Review module structure, interfaces, and concurrency patterns
- Design interfaces — Small, focused, defined at the consumer; composition over inheritance
- Implement — Idiomatic Go with proper error handling and context propagation; run
go vet ./...before proceeding - Lint & validate — Run
golangci-lint runand fix all reported issues before proceeding - Optimize — Profile with pprof, write benchmarks, eliminate allocations
- Test — Table-driven tests with
-race, fuzzing, 80%+ coverage; race detector must pass before committing
Core Pattern Example
Goroutine with context cancellation and error propagation:
// worker runs until ctx is cancelled or an error occurs.
// Errors are returned via errCh; the caller must drain it.
func worker(ctx context.Context, jobs <-chan Job, errCh chan<- error) {
for {
select {
case <-ctx.Done():
errCh <- fmt.Errorf("worker cancelled: %w", ctx.Err())
return
case job, ok := <-jobs:
if !ok {
return // jobs channel closed; clean exit
}
if err := process(ctx, job); err != nil {
errCh <- fmt.Errorf("process job %v: %w", job.ID, err)
return
}
}
}
}
func runPipeline(ctx context.Context, jobs []Job) error {
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
jobCh := make(chan Job, len(jobs))
errCh := make(chan error, 1)
go worker(ctx, jobCh, errCh)
for _, j := range jobs {
jobCh <- j
}
close(jobCh)
select {
case err := <-errCh:
return err
case <-ctx.Done():
return fmt.Errorf("pipeline timed out: %w", ctx.Err())
}
}
Key properties: bounded goroutine lifetime via ctx, error propagation with
%w, no goroutine leak on cancellation.
Constraints
MUST DO
- Run gofmt and golangci-lint on all code
- Add
context.Contextas first param on all blocking operations - Handle every error explicitly (no naked
_discards without justification) - Write table-driven tests with subtests
- Document all exported functions, types, and packages
- Use
X | Yunion constraints for generics (Go 1.18+) - Propagate errors with
fmt.Errorf("...: %w", err) - Run race detector on tests (
-raceflag)
MUST NOT DO
- Ignore errors (no
_ = thatMightFail()without a comment) - Use
panicfor normal error handling - Spawn goroutines without a clear lifecycle
- Skip context cancellation handling
- Reach for reflection without a measured performance reason
- Mix sync and async patterns carelessly
- Hardcode configuration (functional options or env vars)
Output Templates
When implementing Go features, provide:
- Interface definitions (contracts first)
- Implementation files with proper package structure
- Test file with table-driven tests
- Brief explanation of any concurrency patterns used
Pairing
golang-proagent — broader architectural / DevOps coverage; delegates pattern detail here. Load both when active Go development is in scope.
Provenance
Initial content adapted from
jeffallan/claude-skills (MIT,
skills/golang-pro) and the prior wardrobe idiomatic-go skill (Bodner-derived
anti-pattern tables, now at references/idiomatic-go.md). See LICENSES.md.
Source: danmestas/wardrobe — distributed by TomeVault.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review