Agent skill

Go Concurrency

by hegeldev in hegeldev/hegel-go

Go concurrency patterns and pitfalls for this codebase. An agent skill from hegeldev/hegel-go.

MITAuto-check passedDevelopment

Install Go Concurrency

skills CLI
$ npx skills add hegeldev/hegel-go --skill go-concurrency -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install hegeldev/hegel-go go-concurrency --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/hegeldev/hegel-go.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/go-concurrency .claude/skills/go-concurrency && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
go-concurrency
GitHub stars
103
Token cost
~1.3k tokens
SKILL.md length
671 words
Files
4 (incl. references)
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Go concurrency patterns and pitfalls for this codebase. An agent skill from hegeldev/hegel-go.

  • Works in 4 steps: Single readLoop goroutine per connection… → writerMu serializes socket writes — any… → hegelSession.mu protects subprocess… → …
  • Reviewing code that involves goroutines
  • SKILL.md covers Core principle: be explicit…, This codebase's concurrency…, Red flags to watch for and Cross-process concurrency, plus 1 more section
  • Calls go

What it does

Go Concurrency is an agent skill from hegeldev/hegel-go. Go concurrency patterns and pitfalls for this codebase. Use when writing or reviewing code that involves goroutines, channels, mutexes, shared state, subprocess management, or anything that runs concurrently. Also use proactively when writing new code — ask yourself: can this be called from multiple goroutines? Is this resource process-global?

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/architecture.md`, `references/patterns.md` and `references/testing.md`).

It sits in Development, covering Async programming. The repository describes itself as: Property-based testing for Go. The licence is MIT.

When your agent uses it

  • Reviewing code that involves goroutines
  • Subprocess management
  • Anything that runs concurrently

Example prompts

  • “/go-concurrency”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Single readLoop goroutine per connection — only one goroutine reads the socket. Packets are dispatched to per-channel inboxes via…
  2. writerMu serializes socket writes — any goroutine can write, but all writes go through the mutex.
  3. hegelSession.mu protects subprocess lifecycle — start/cleanup are serialized; concurrent tests multiplex over the shared connection via…
  4. processExited channel as a happens-before barrier — the monitor goroutine writes crash state, then closes the channel. Readers after…

What it can do on your machine

Read from SKILL.md and the folder at commit 77ceb5d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Go Concurrency loads about 1.3k tokens when it runs, and up to ~3.9k if it reads all its reference files. Until then it costs about 90 tokens; SKILL.md has 671 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from hegeldev/hegel-go at commit 77ceb5d, republished under its MIT licence (© hegeldev). 671 words, ~1,328 tokens.

Download SKILL.mdSave it as .claude/skills/go-concurrency/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
go-concurrency
description
Go concurrency patterns and pitfalls for this codebase. Use when writing or reviewing code that involves goroutines, channels, mutexes, shared state, subprocess management, or anything that runs concurrently. Also use proactively when writing new code — ask yourself: can this be called from multiple goroutines? Is this resource process-global?

Go Concurrency Review

This codebase multiplexes concurrent property tests over a shared subprocess via channels. Concurrency bugs here are subtle and the race detector only catches about half of real-world Go concurrency bugs. Think carefully.

Core principle: be explicit about ownership

Every piece of mutable state must have a clear owner. Either:

  • One goroutine owns it — no synchronization needed, but document it (e.g., "only called from readLoop")
  • A mutex protects it — every access, including reads, must hold the lock
  • A channel mediates it — data flows from producer to consumer with happens-before guarantees
  • It's immutable after initialization — set before any goroutine can read it, preferably via sync.Once

If you can't immediately name the owner of a field, that's a bug.

This codebase's concurrency architecture

See references/architecture.md for the full map of what's protected by what. The key patterns:

  1. Single readLoop goroutine per connection — only one goroutine reads the socket. Packets are dispatched to per-channel inboxes via non-blocking select.
  2. writerMu serializes socket writes — any goroutine can write, but all writes go through the mutex.
  3. hegelSession.mu protects subprocess lifecycle — start/cleanup are serialized; concurrent tests multiplex over the shared connection via separate channels.
  4. processExited channel as a happens-before barrier — the monitor goroutine writes crash state, then closes the channel. Readers after <-processExited see the state without additional locking.

Red flags to watch for

Lazy initialization without clear goroutine assignment

If initialization happens "on first use" and multiple goroutines might be the first user, you have a race. Use sync.Once or initialize before spawning goroutines. The lazy pattern is especially tempting for error messages, log excerpts, and diagnostic data — but those are read under failure conditions when timing is least predictable.

Reading shared state "just for diagnostics"

Logging, error messages, and crash reports still need synchronization. s.logFile.Name() races with s.logFile = nil in cleanup. The fix is to capture the value at initialization time, or have the goroutine that detects the event compute the message before signaling.

Function closures capturing mutable references

conn.crashMessageFn = s.serverCrashMessage captures s and reads s.logFile — any field the method touches is shared state. Prefer capturing immutable values (strings, ints) rather than pointers to mutable structs.

Process-global resources in parallel tests

Environment variables, working directory, temp file paths, and network ports are process-global. t.Setenv panics if called after t.Parallel(). If tests need different env values, pass config structs instead.

Show full SKILL.md (281 more words)Show less
File I/O racing with Close

Even though os.File.Read is safe to call concurrently with Close at the syscall level, the logical race remains: after Close, the fd is freed and may be reused by another open. Read the file contents into a variable while the file is known to be open, then use the variable.

select with multiple ready cases

Go's select picks a uniformly random ready case. If you need priority (e.g., "check done before processing"), use a nested select with a non-blocking check first.

Goroutine leaks

Every goroutine must have a clear termination path. A goroutine blocked on a channel send/receive that will never complete leaks forever. Common in error paths where cleanup skips closing a channel.

Cross-process concurrency

go test ./... runs separate binaries per package. t.Parallel() runs tests concurrently within a binary. Both levels matter:

  • Within-process: Shared Go variables, the global session, mutexes work
  • Cross-process: File locks, temp dirs, network ports, the uv binary cache, installed binaries in .hegel/venv — all races here require filesystem-level coordination (atomic rename, unique paths per process)

See references/testing.md for testing-specific patterns.

The happens-before relationship

The Go memory model guarantees sequential consistency for data-race-free programs. Key rules:

  • Channel send happens-before the corresponding receive completes
  • For unbuffered channels, receive happens-before send completes (NOT true for buffered)
  • mutex.Unlock() happens-before the next Lock() returns
  • once.Do(f) completion happens-before any Do() call returns
  • close(ch) happens-before <-ch returns zero value
  • Goroutine creation (go f()) happens-before f() starts
  • Goroutine exit is NOT synchronized — you cannot observe completion without explicit sync

Corollary: if you write to a variable, then close a channel, any goroutine that receives from that channel is guaranteed to see the write. This is the pattern used by processExited.

© hegeldev, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .claude/skills/go-concurrency of hegeldev/hegel-go.

  • SKILL.md
  • references/architecture.md
  • references/patterns.md
  • references/testing.md

Open the folder on GitHubat commit 77ceb5d

Compare with similar skills

Go Concurrency next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Go Concurrency compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Go Concurrency this skillhegeldev/hegel-go103—~1.3kAutomated safety check: PassMIT
YugabyteDB ASH Instrumentationyugabyte/yugabyte-db11k—~4.5kAutomated safety check: PassCustom licence
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.5kAutomated safety check: PassApache-2.0
Golang Patternsantoniopaya22/go-rest-template1729 repos~3.5kAutomated safety check: PassNone
Rust Async Patternsdiodeme/Gold-Band14310 repos~3.1kAutomated safety check: PassAGPL-3.0
Swift Concurrencyhenrypldev/react-native-nitro-mlx1003 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • YugabyteDB ASH Instrumentation

    yugabyte/yugabyte-db

    Procedure for adding or changing YugabyteDB Active Session History wait states in TServer and DocDB C++ code, including the macro to use for sync and async paths.

    11k GitHub stars~4.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Golang Patterns

    antoniopaya22/go-rest-template

    Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.

    172 GitHub starsUsed in 9 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 10 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Swift Concurrency

    henrypldev/react-native-nitro-mlx

    Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…

    100 GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Rust Engineer

    farm-fe/farm

    Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions.

    5.6k GitHub starsUsed in 1 repo~1.5k tokens
    DevelopmentAuto-check passed

More from hegeldev/hegel-go

  • Changelog

    hegeldev/hegel-go

    Changelog style guide for writing RELEASE.md files. An agent skill from hegeldev/hegel-go.

    103 GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed
  • Self Review

    hegeldev/hegel-go

    Review your own changes before creating a pull request. An agent skill from hegeldev/hegel-go.

    103 GitHub stars~588 tokensUpdated 2 days ago
    Auto-check passed
  • Coverage

    hegeldev/hegel-go

    How to approach code coverage in this project. An agent skill from hegeldev/hegel-go.

    103 GitHub stars~705 tokensUpdated 2 days ago
    Auto-check passed
  • Align Libhegel

    hegeldev/hegel-go

    How to align the Go FFI wrapper to a new libhegel (hegel-c) release.

    103 GitHub stars~5.8k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Go Concurrency

What does Go Concurrency do?

Go concurrency patterns and pitfalls for this codebase. An agent skill from hegeldev/hegel-go. Go Concurrency is an agent skill from hegeldev/hegel-go. Go concurrency patterns and pitfalls for this codebase.

When should I use Go Concurrency?

Go Concurrency fits situations like: reviewing code that involves goroutines; subprocess management; anything that runs concurrently.

How do I install Go Concurrency in Claude Code?

Run `npx skills add hegeldev/hegel-go --skill go-concurrency -a claude-code`. Or copy the skill folder (.claude/skills/go-concurrency in hegeldev/hegel-go) into .claude/skills/go-concurrency in your project. Claude Code loads it when a task matches its description.

How do I install Go Concurrency in Codex?

Run `npx skills add hegeldev/hegel-go --skill go-concurrency -a codex`. Or copy the skill folder (.claude/skills/go-concurrency in hegeldev/hegel-go) into .agents/skills/go-concurrency in your project. Codex loads it when a task matches its description.

Can I use Go Concurrency in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hegeldev/hegel-go --skill go-concurrency -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/go-concurrency, .gemini/skills/go-concurrency, .github/skills/go-concurrency and .opencode/skills/go-concurrency in your project.

What does Go Concurrency need to run?

Going by SKILL.md and its folder, Go Concurrency needs the command-line tools its instructions call (go).

Does Go Concurrency access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Go Concurrency safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Go Concurrency use?

Go Concurrency is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Go Concurrency use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.6k tokens, read only when the agent opens those files.

What are the alternatives to Go Concurrency?

Skills that share tags, products or a category with Go Concurrency: YugabyteDB ASH Instrumentation (yugabyte/yugabyte-db, 11k stars), Mirage VFS Adapter Authoring (strukto-ai/mirage, 3.7k stars), Golang Patterns (antoniopaya22/go-rest-template, 172 stars) and Rust Async Patterns (diodeme/Gold-Band, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Go Concurrency?

hegeldev (a GitHub organization) maintains it in hegeldev/hegel-go, which has 103 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 8, 2026.

Source: hegeldev/hegel-go on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.