Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cass-2003/local-workflow-skill --skill concurrency-patternsgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cass-2003/local-workflow-skill/concurrency-patterns)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/concurrency-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/concurrency-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/concurrency-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/concurrency-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00168 | $0.03629 |
| Opus 5 | $0.00084 | $0.01814 |
| Sonnet 5 | $0.00034 | $0.00726 |
| Haiku 4.5 | $0.00017 | $0.00363 |
Grade A, and why
concurrency-patterns scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
const r = await fetch(url, { signal: ctrl.signal }) How it starts
The opening of the file, as written. The whole thing — 488 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Concurrency Patterns Skill — 并发原语跨语言
何时使用
- 设计高并发服务(并行处理 / 流水线 / 扇出扇入)
- 排查 race condition / deadlock / 偶发崩溃
- 选择 mutex vs channel vs actor
- 实现 worker pool / 任务并行
- 跨语言移植并发代码
一、并发模型分类
| 模型 | 代表 | 哲学 |
|---|---|---|
| 共享内存 + 锁 | Java / C++ / Python threading | "用锁保护共享数据" |
| CSP(消息传递) | Go / Erlang | "Don't communicate by sharing memory; share memory by communicating" |
| Actor | Erlang / Akka / Elixir | "每个 actor 自封闭,邮箱接收消息" |
| Async/Await | JS / Python asyncio / Rust / C# | "单线程事件循环,IO 等待时让出" |
| Software Transactional Memory | Clojure / Haskell | "数据库事务般的内存原子块" |
| Data Parallel | OpenMP / CUDA | "同一操作并行作用于数据数组" |
不同语言混合使用。Go 主推 CSP 但也有 mutex;Rust 主推无锁但提供完整 sync 库。
二、关键概念区分
并发 vs 并行
并发(concurrency):多个任务交替推进(可单核)
并行(parallelism):多个任务同时执行(多核)
asyncio 是并发单线程;Go runtime / Java 线程池是并行多核。
进程 / 线程 / 协程
| 切换成本 | 内存 | 隔离 | |
|---|---|---|---|
| 进程 | 高(上下文 + TLB) | MB 级 | 完全 |
| 线程 | 中(寄存器) | KB-MB | 共享地址空间 |
| 协程 / fiber | 低(用户态) | KB 级 | 共享地址空间 |
| Goroutine | 极低 | 2KB 起 | 共享 |
| async task | 极低(栈复用) | 极小 | 共享 |
Goroutine = 用户态调度的轻量线程;async/await = 编译器变换的状态机。
三、Mutex(最基础)
// Go
var mu sync.Mutex
var counter int
func increment() {
mu.Lock()
defer mu.Unlock()
counter++
}
// Rust
use std::sync::Mutex;
let counter = Mutex::new(0);
let mut guard = counter.lock().unwrap();
*guard += 1;
// guard 离开作用域自动释放(RAII)
# Python
lock = threading.Lock()
with lock:
counter += 1
// JS 单线程,无 mutex;Web Worker 间用 SharedArrayBuffer + Atomics
const sab = new SharedArrayBuffer(4)
const view = new Int32Array(sab)
Atomics.add(view, 0, 1)
RWLock(读多写少)
var mu sync.RWMutex
mu.RLock(); ... mu.RUnlock() // 多读
mu.Lock(); ... mu.Unlock() // 独占写
读远多于写时显著快于普通 Mutex。
Atomic
import "sync/atomic"
var counter atomic.Int64
counter.Add(1)
counter.Load()
无锁,单变量级 / CPU 指令直接支持。比 mutex 快 5-10 倍。
四、Go 的 Channel(CSP)
// 无缓冲 — 发送阻塞直到接收
ch := make(chan int)
go func() { ch <- 42 }()
val := <-ch
// 带缓冲
ch := make(chan int, 10)
// 关闭
close(ch)
for val := range ch { ... } // 收到所有 + close
// select 多路
select {
case v := <-ch1: ...
case ch2 <- val: ...
case <-time.After(5*time.Second): // 超时
case <-ctx.Done(): // 取消
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 488 lines · 168 tokens per session scan A f9d6658290b4
concurrency-patterns is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 168 tokens to every session and 3,629 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
printing-press-amend
Amend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or feeds, fix a named bug, optionally…
convex-performance-audit
Audits Convex performance for reads, subscriptions, write contention, and function limits. Use for slow features, insights findings, OCC conflicts, or read amplification.
convex-insights
Query a running Convex app's logs + health in natural language (official MCP): failures, slow/expensive functions, deploy causality — scoped, evidence-backed, with a dashboard deep link.
ssl-proxy-troubleshoot
Systematic workflow for troubleshooting SSL/proxy connectivity issues with government websites.
diagnose-backend-bug
Diagnose a bounded backend or multi-service failure from GitHub Issues, Jira, Aone, user-provided exports, logs, traces, responses, stack traces, or job records. Use when a service, API, RPC, worker, queue, CLI, or scheduled job bug needs correlation through the project's existing observability route before repair; do…
axiom-networking
Use when implementing or debugging ANY network connection, API call, or socket. Covers URLSession, Network.framework, NetworkConnection, connection diagnostics.