MCP HubMCP Hub
スキル一覧に戻る

golang-concurrency-safety

majiayu000
更新日 Yesterday
18 閲覧
58
9
58
GitHubで表示
その他general

について

このClaude Skillは、Goコードの専門家レベルの並行処理安全性レビューを実行し、競合状態、デッドロック、ゴルーチンリークといった重大な問題を検出します。ゴルーチン、チャネル、同期処理を分析し、本番環境障害を引き起こす安全でない操作を特定します。デプロイ前の並行処理Goコードの記述、デバッグ、監査時にご活用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/majiayu000/claude-skill-registry
Git クローン代替
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/golang-concurrency-safety

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Golang Concurrency Safety

Expert-level concurrency safety review for Go applications. Detects common concurrency bugs that cause production failures, race conditions, deadlocks, and resource leaks.

When to Apply

Use this skill when:

  • Reviewing code with goroutines or channels
  • Debugging race conditions or deadlocks
  • Auditing concurrent data access
  • Investigating goroutine leaks or memory issues
  • Writing new concurrent code
  • Preparing concurrent code for production

Rule Categories by Priority

PriorityCountFocus
Critical5Prevents crashes, leaks, deadlocks
High4Correctness and reliability
Medium3Code quality and idioms

Rules Covered (12 total)

Critical Issues (5)

  • critical-goroutine-leak - Goroutines must have exit conditions
  • critical-race-condition - Protect shared state with mutex/channels
  • critical-channel-deadlock - Ensure paired send/receive operations
  • critical-close-panic - Sender closes channel, not receiver
  • critical-defer-in-loop - Avoid defer in loops (resource leaks)

High-Impact Patterns (4)

  • high-goroutine-unbounded - Limit concurrent goroutines (worker pool)
  • high-channel-not-closed - Always close channels when done
  • high-loop-variable-capture - Avoid closure over loop variables
  • high-waitgroup-mismatch - Match Add() and Done() calls

Medium Improvements (3)

  • medium-directional-channels - Use send/receive-only channels
  • medium-buffered-channel-size - Choose appropriate buffer size
  • medium-select-default - Avoid busy-wait with select

How to Use

For Code Review

  1. Scan code for goroutine launches and channel operations
  2. Check against rules in priority order (Critical first)
  3. For each violation found, reference the specific rule file
  4. Provide exact line numbers and explanation
  5. Show corrected code example

Accessing Detailed Rules

Each rule file in rules/ contains:

  • Brief explanation of why it matters
  • Detection criteria (how to spot the issue)
  • Incorrect code example (❌ BAD)
  • Correct code example (✅ GOOD)
  • Impact assessment
  • References

Example:

rules/critical-goroutine-leak.md
rules/high-channel-not-closed.md

Trigger Phrases

This skill activates when you say:

  • "Check for race conditions"
  • "Review concurrency"
  • "Find goroutine leaks"
  • "Check for deadlocks"
  • "Review channel usage"
  • "Audit goroutine safety"
  • "Check synchronization"
  • "Review concurrent code"

Common Patterns

Goroutine leak detection:

Check this code for goroutine leaks

Race condition audit:

Verify this concurrent code is safe

Channel safety review:

Review channel usage for deadlocks

Output Format

When reviewing code, use this format:

## Critical Concurrency Issues: X

### [Rule Name] (Line Y)
**Issue**: Brief description
**Impact**: Race condition / Deadlock / Goroutine leak
**Fix**: Suggested correction
**Example**:
```go
// Corrected code here

High-Impact Patterns: X

[Similar format for high priority items]

Medium Improvements: X

[Similar format for medium priority items]


## Philosophy

Based on Katherine Cox-Buday's "Concurrency in Go":

- **Concurrency is not parallelism** - Design for coordination, not just speed
- **Channels are for communication** - Use for passing ownership
- **Mutexes are for state** - Use for protecting shared memory
- **Always have exit conditions** - Every goroutine must be able to stop
- **Context is the standard** - Use context.Context for cancellation

## Related Skills

- [golang-error-handling](../error-handling/SKILL.md) - For context propagation patterns
- [golang-clean-architecture](../clean-architecture/SKILL.md) - For usecase/repository concurrency patterns

## Notes

- Rules are evidence-based from authoritative Go concurrency books
- All examples are tested and production-ready
- Detection patterns help identify issues systematically
- Focused exclusively on concurrency safety (not general Go patterns)

GitHub リポジトリ

majiayu000/claude-skill-registry
パス: skills/concurrency-safety

関連スキル

algorithmic-art

メタ

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

スキルを見る

subagent-driven-development

開発

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

スキルを見る

executing-plans

デザイン

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

スキルを見る

cost-optimization

その他

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

スキルを見る