AgentSkillsCN

concurrency-core

并发设计模式与安全开发流程。在引入或调整并发机制(线程/异步/回调/队列/锁)、为提升性能而进行并行化处理,或需要制定清晰的关闭/取消策略时,务必参考此指南。

SKILL.md
--- frontmatter
name: concurrency-core
description: "Concurrency design patterns & safety workflow. Use when you introduce or modify concurrency (threads/async/callbacks/queues/locks), parallelize for performance, or need a clear shutdown/cancellation strategy."
metadata:
  short-description: Concurrency design patterns and planning

Purpose

Produce a Concurrency Plan with pattern-based choices so concurrent behavior is deliberate, safe, and testable.

When to use

Use this skill when you:

  • add or change threads, async/await, callbacks, queues, locks, or executors
  • parallelize work for performance or responsiveness
  • introduce background workers, timers, or concurrent IO

How to use

  1. Open references/concurrency-core.md.
  2. Write a Concurrency Plan (use the template).
  3. Select an appropriate pattern (or justify why none fits).
  4. Identify shared mutable state and choose a containment strategy.
  5. Define cancellation/shutdown and error propagation.
  6. Define observability hooks for diagnosing concurrent behavior.
  7. Define verification strategy; invoke $thread-safety-tooling if multi-threading exists.

Output expectation

  • Output the full Concurrency Plan sections.
  • Add a short Risks & mitigations summary.