design_patterns-wait_group

Coordinate concurrent Go tasks with automatic error aggregation via Do and DoAfter workflows.

2|Updated Jun 26, 2025
One-click install
npx skills add https://github.com/amarbel-llc/dodder --skill design-patterns-wait-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design_patterns-wait_group
Source: https://github.com/amarbel-llc/dodder/tree/main/.claude/skills/design_patterns-wait_group
Command: npx skills add https://github.com/amarbel-llc/dodder --skill design-patterns-wait-group

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinate concurrent tasks with automatic error aggregation and structured cleanup.

Core Features & Use Cases

  • Supports both parallel (concurrent) and serial (sequential) execution modes with Do and DoAfter
  • Aggregates all errors into a single return value via GroupBuilder
  • Includes optional stack-frame capture for debugging in parallel executions

Quick Start

Create a parallel wait group, register Do and DoAfter tasks, and call GetError to obtain a single aggregated error.

Frequently Asked Questions about design_patterns-wait_group

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I aggregate errors from concurrent goroutines in Go into a single return value?

Use a wait group pattern that collects all errors via GroupBuilder and returns them through a single GetError call. This lets you coordinate concurrent Go tasks and retrieve one aggregated error instead of checking each goroutine individually.

What's the best way to run cleanup tasks in order after parallel goroutines finish?

Register cleanup logic with DoAfter after your concurrent Do tasks. DoAfter executes in a structured, ordered sequence once parallel work completes, ensuring cleanup happens in a predictable order even when preceding tasks ran concurrently.

Can I use the same wait group pattern for both parallel and serial execution in Go?

Yes, the pattern exposes MakeWaitGroupParallel and MakeWaitGroupSerial constructors. Both support Do, DoAfter, and GetError, so you can switch between concurrent and sequential execution modes while keeping the same error aggregation and cleanup workflow.

How do I debug which goroutine caused an error during parallel execution?

Enable optional stack-frame capture when creating your wait group. This records debug stack traces alongside aggregated errors, helping you pinpoint which concurrent task produced a given error during parallel execution.

When should I choose serial over parallel execution for my Go tasks?

Choose serial execution with MakeWaitGroupSerial when tasks depend on each other's completion or must run in strict sequence. Use MakeWaitGroupParallel for independent tasks that benefit from concurrent execution, while both modes retain the same error aggregation and cleanup.