cs-concurrency
Concurrency: threads vs async, locks/mutexes/rwlocks, atomics, lock-free, actor model, STM, deadlock
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o cs-concurrency.zip https://jpskill.com/download/22161.zip && unzip -o cs-concurrency.zip && rm cs-concurrency.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22161.zip -OutFile "$d\cs-concurrency.zip"; Expand-Archive "$d\cs-concurrency.zip" -DestinationPath $d -Force; ri "$d\cs-concurrency.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
cs-concurrency.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
cs-concurrencyフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
cs-concurrency
Purpose
This skill equips OpenClaw to assist with concurrency concepts in computer science, including threads vs. async programming, synchronization primitives like locks and atomics, and advanced topics like actor models, STM, and deadlock avoidance. Use it to generate code, explain pitfalls, or debug issues.
When to Use
Apply this skill when developing multi-threaded applications (e.g., in C++ or Python), handling shared resources to prevent race conditions, optimizing for I/O-bound tasks with async/await, or analyzing deadlocks in production code. Use it for real-time systems, web servers, or distributed computing where concurrency is critical.
Key Capabilities
- Explain differences: Threads (blocking, OS-level) vs. async (non-blocking, event-loop based).
- Demonstrate synchronization: Implement mutexes, RW locks, and atomics for shared data.
- Handle advanced patterns: Generate actor model code (e.g., using Erlang-style actors) or STM for transactional memory.
- Detect issues: Identify potential deadlocks or race conditions in provided code snippets.
- Optimize: Suggest lock-free data structures like concurrent queues.
Usage Patterns
Invoke OpenClaw via CLI for quick explanations or code generation; use API for integration into scripts. Always specify the subtopic (e.g., "threads" or "locks") for targeted responses. For interactive sessions, prefix commands with "openclaw cs-concurrency". If using programmatically, pass JSON payloads with required parameters like topic and language.
Common Commands/API
Use CLI commands like:
openclaw cs-concurrency explain threads --lang python (explains threads with a Python example).
openclaw cs-concurrency generate lock --type mutex --code c++ (generates a mutex example in C++).
For API, send POST requests to /api/cs-concurrency/explain with JSON body:
{ "topic": "atomics", "lang": "rust", "detail": "high" }
Headers: Authorization: Bearer $OPENCLAW_API_KEY (set via environment variable for authentication).
Config format for custom sessions:
JSON file like { "defaultLang": "go", "focus": ["deadlock", "async"] } passed with --config path/to/file.json.
Integration Notes
Integrate by setting $OPENCLAW_API_KEY in your environment for authenticated API calls. For example, in a bash script: export OPENCLAW_API_KEY=your_api_key_here. Combine with other tools like debuggers (e.g., gdb for threads) by piping output: openclaw cs-concurrency explain deadlock | gdb -ex "run". Ensure your application handles async contexts if embedding responses in Node.js or Python event loops.
Error Handling
When using this skill, check for concurrency errors like deadlocks by wrapping code in try-except blocks. For example, in Python:
import threading
lock = threading.Lock()
try:
with lock:
# Critical section
pass
except threading.LockError:
print("Lock acquisition failed")
For API calls, handle HTTP errors (e.g., 401 for invalid $OPENCLAW_API_KEY) by checking response status codes. In OpenClaw commands, use --verbose flag to debug: openclaw cs-concurrency explain async --verbose to log detailed errors.
Concrete Usage Examples
Example 1: To generate a simple threads example in C++:
Run: openclaw cs-concurrency generate threads --lang c++
Output might include:
#include <thread>
void task() { /* code */ }
int main() {
std::thread t1(task);
t1.join();
}
This helps in understanding basic thread creation and joining.
Example 2: To explain and fix a race condition with atomics:
Command: openclaw cs-concurrency explain race --fix --lang rust
Response: Explains the issue and provides:
use std::sync::atomic::{AtomicUsize, Ordering};
static COUNTER: AtomicUsize = AtomicUsize::new(0);
COUNTER.fetch_add(1, Ordering::SeqCst);
Use this to safely increment shared counters without locks.
Graph Relationships
- Related to: cs-algorithms (via concurrency tag for parallel algorithms)
- Connected to: programming-languages (shares tags like "threads" for language-specific implementations)
- Links with: software-engineering (for deadlock in system design)
- Associated via: cs (cluster overlap for computer science topics)