[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AWTKCJ9QWYPJ363JSPHVSH":3,"skill-same:01M7AWTKCJ9QWYPJ363JSPHVSH":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7AWTKCJ9QWYPJ363JSPHVSH","m07-concurrency",null,"CRITICAL: Use for concurrency\u002Fasync. Triggers: E0277 Send Sync, cannot be sent between threads, thread, spawn, channel, mpsc, Mutex, RwLock, Atomic, async, await, Future, tokio, deadlock, race condition, 并发, 线程, 异步, 死锁","wxxb789\u002Fmarkturbo","wxxb789","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F49564443?v=4","01M7AWR3AB19SNE4ATARY9KV3W","01M7AWR3AZ5Y5ADAY47KF3RBRJ",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: m07-concurrency\ndescription: \"CRITICAL: Use for concurrency\u002Fasync. Triggers: E0277 Send Sync, cannot be sent between threads, thread, spawn, channel, mpsc, Mutex, RwLock, Atomic, async, await, Future, tokio, deadlock, race condition, 并发, 线程, 异步, 死锁\"\nuser-invocable: false\n---\n\n# Concurrency\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**Is this CPU-bound or I\u002FO-bound, and what's the sharing model?**\n\nBefore choosing concurrency primitives:\n- What's the workload type?\n- What data needs to be shared?\n- What's the thread safety requirement?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| E0277 Send | \"Add Send bound\" | Should this type cross threads? |\n| E0277 Sync | \"Wrap in Mutex\" | Is shared access really needed? |\n| Future not Send | \"Use spawn_local\" | Is async the right choice? |\n| Deadlock | \"Reorder locks\" | Is the locking design correct? |\n\n---\n\n## Thinking Prompt\n\nBefore adding concurrency:\n\n1. **What's the workload?**\n   - CPU-bound → threads (std::thread, rayon)\n   - I\u002FO-bound → async (tokio, async-std)\n   - Mixed → hybrid approach\n\n2. **What's the sharing model?**\n   - No sharing → message passing (channels)\n   - Immutable sharing → Arc\u003CT>\n   - Mutable sharing → Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n\n3. **What are the Send\u002FSync requirements?**\n   - Cross-thread ownership → Send\n   - Cross-thread references → Sync\n   - Single-thread async → spawn_local\n\n---\n\n## Trace Up ↑ (MANDATORY)\n\n**CRITICAL**: Don't just fix the error. Trace UP to find domain constraints.\n\n### Domain Detection Table\n\n| Context Keywords | Load Domain Skill | Key Constraint |\n|-----------------|-------------------|----------------|\n| Web API, HTTP, axum, actix, handler | **domain-web** | Handlers run on any thread |\n| 交易, 支付, trading, payment | **domain-fintech** | Audit + thread safety |\n| gRPC, kubernetes, microservice | **domain-cloud-native** | Distributed tracing |\n| CLI, terminal, clap | **domain-cli** | Usually single-thread OK |\n\n### Example: Web API + Rc Error\n\n```\n\"Rc cannot be sent between threads\" in Web API context\n    ↑ DETECT: \"Web API\" → Load domain-web\n    ↑ FIND: domain-web says \"Shared state must be thread-safe\"\n    ↑ FIND: domain-web says \"Rc in state\" is Common Mistake\n    ↓ DESIGN: Use Arc\u003CT> with State extractor\n    ↓ IMPL: axum::extract::State\u003CArc\u003CAppConfig>>\n```\n\n### Generic Trace\n\n```\n\"Send not satisfied for my type\"\n    ↑ Ask: What domain is this? Load domain-* skill\n    ↑ Ask: Does this type need to cross thread boundaries?\n    ↑ Check: m09-domain (is the data model correct?)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| Send\u002FSync in Web | **domain-web** | What's the state management pattern? |\n| Send\u002FSync in CLI | **domain-cli** | Is multi-thread really needed? |\n| Mutex vs channels | m09-domain | Shared state or message passing? |\n| Async vs threads | m10-performance | What's the workload profile? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need parallelism for CPU work\"\n    ↓ Use: std::thread or rayon\n\n\"Need concurrency for I\u002FO\"\n    ↓ Use: async\u002Fawait with tokio\n\n\"Need to share immutable data across threads\"\n    ↓ Use: Arc\u003CT>\n\n\"Need to share mutable data across threads\"\n    ↓ Use: Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n    ↓ Or: channels for message passing\n\n\"Need simple atomic operations\"\n    ↓ Use: AtomicBool, AtomicUsize, etc.\n```\n\n---\n\n## Send\u002FSync Markers\n\n| Marker | Meaning | Example |\n|--------|---------|---------|\n| `Send` | Can transfer ownership between threads | Most types |\n| `Sync` | Can share references between threads | `Arc\u003CT>` |\n| `!Send` | Must stay on one thread | `Rc\u003CT>` |\n| `!Sync` | No shared refs across threads | `RefCell\u003CT>` |\n\n## Quick Reference\n\n| Pattern | Thread-Safe | Blocking | Use When |\n|---------|-------------|----------|----------|\n| `std::thread` | Yes | Yes | CPU-bound parallelism |\n| `async\u002Fawait` | Yes | No | I\u002FO-bound concurrency |\n| `Mutex\u003CT>` | Yes | Yes | Shared mutable state |\n| `RwLock\u003CT>` | Yes | Yes | Read-heavy shared state |\n| `mpsc::channel` | Yes | Optional | Message passing |\n| `Arc\u003CMutex\u003CT>>` | Yes | Yes | Shared mutable across threads |\n\n## Decision Flowchart\n\n```\nWhat type of work?\n├─ CPU-bound → std::thread or rayon\n├─ I\u002FO-bound → async\u002Fawait\n└─ Mixed → hybrid (spawn_blocking)\n\nNeed to share data?\n├─ No → message passing (channels)\n├─ Immutable → Arc\u003CT>\n└─ Mutable →\n   ├─ Read-heavy → Arc\u003CRwLock\u003CT>>\n   └─ Write-heavy → Arc\u003CMutex\u003CT>>\n   └─ Simple counter → AtomicUsize\n\nAsync context?\n├─ Type is Send → tokio::spawn\n├─ Type is !Send → spawn_local\n└─ Blocking code → spawn_blocking\n```\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| E0277 `Send` not satisfied | Non-Send in async | Use Arc or spawn_local |\n| E0277 `Sync` not satisfied | Non-Sync shared | Wrap with Mutex |\n| Deadlock | Lock ordering | Consistent lock order |\n| `future is not Send` | Non-Send across await | Drop before await |\n| `MutexGuard` across await | Guard held during suspend | Scope guard properly |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Arc\u003CMutex\u003CT>> everywhere | Contention, complexity | Message passing |\n| thread::sleep in async | Blocks executor | tokio::time::sleep |\n| Holding locks across await | Blocks other tasks | Scope locks tightly |\n| Ignoring deadlock risk | Hard to debug | Lock ordering, try_lock |\n\n---\n\n## Async-Specific Patterns\n\n### Avoid MutexGuard Across Await\n\n```rust\n\u002F\u002F Bad: guard held across await\nlet guard = mutex.lock().await;\ndo_async().await;  \u002F\u002F guard still held!\n\n\u002F\u002F Good: scope the lock\n{\n    let guard = mutex.lock().await;\n    \u002F\u002F use guard\n}  \u002F\u002F guard dropped\ndo_async().await;\n```\n\n### Non-Send Types in Async\n\n```rust\n\u002F\u002F Rc is !Send, can't cross await in spawned task\n\u002F\u002F Option 1: use Arc instead\n\u002F\u002F Option 2: use spawn_local (single-thread runtime)\n\u002F\u002F Option 3: ensure Rc is dropped before .await\n```\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Smart pointer choice | m02-resource |\n| Interior mutability | m03-mutability |\n| Performance tuning | m10-performance |\n| Domain concurrency needs | domain-* |\n","# Concurrency\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**Is this CPU-bound or I\u002FO-bound, and what's the sharing model?**\n\nBefore choosing concurrency primitives:\n- What's the workload type?\n- What data needs to be shared?\n- What's the thread safety requirement?\n\n---\n\n## Error → Design Question\n\n| Error | Don't Just Say | Ask Instead |\n|-------|----------------|-------------|\n| E0277 Send | \"Add Send bound\" | Should this type cross threads? |\n| E0277 Sync | \"Wrap in Mutex\" | Is shared access really needed? |\n| Future not Send | \"Use spawn_local\" | Is async the right choice? |\n| Deadlock | \"Reorder locks\" | Is the locking design correct? |\n\n---\n\n## Thinking Prompt\n\nBefore adding concurrency:\n\n1. **What's the workload?**\n   - CPU-bound → threads (std::thread, rayon)\n   - I\u002FO-bound → async (tokio, async-std)\n   - Mixed → hybrid approach\n\n2. **What's the sharing model?**\n   - No sharing → message passing (channels)\n   - Immutable sharing → Arc\u003CT>\n   - Mutable sharing → Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n\n3. **What are the Send\u002FSync requirements?**\n   - Cross-thread ownership → Send\n   - Cross-thread references → Sync\n   - Single-thread async → spawn_local\n\n---\n\n## Trace Up ↑ (MANDATORY)\n\n**CRITICAL**: Don't just fix the error. Trace UP to find domain constraints.\n\n### Domain Detection Table\n\n| Context Keywords | Load Domain Skill | Key Constraint |\n|-----------------|-------------------|----------------|\n| Web API, HTTP, axum, actix, handler | **domain-web** | Handlers run on any thread |\n| 交易, 支付, trading, payment | **domain-fintech** | Audit + thread safety |\n| gRPC, kubernetes, microservice | **domain-cloud-native** | Distributed tracing |\n| CLI, terminal, clap | **domain-cli** | Usually single-thread OK |\n\n### Example: Web API + Rc Error\n\n```\n\"Rc cannot be sent between threads\" in Web API context\n    ↑ DETECT: \"Web API\" → Load domain-web\n    ↑ FIND: domain-web says \"Shared state must be thread-safe\"\n    ↑ FIND: domain-web says \"Rc in state\" is Common Mistake\n    ↓ DESIGN: Use Arc\u003CT> with State extractor\n    ↓ IMPL: axum::extract::State\u003CArc\u003CAppConfig>>\n```\n\n### Generic Trace\n\n```\n\"Send not satisfied for my type\"\n    ↑ Ask: What domain is this? Load domain-* skill\n    ↑ Ask: Does this type need to cross thread boundaries?\n    ↑ Check: m09-domain (is the data model correct?)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| Send\u002FSync in Web | **domain-web** | What's the state management pattern? |\n| Send\u002FSync in CLI | **domain-cli** | Is multi-thread really needed? |\n| Mutex vs channels | m09-domain | Shared state or message passing? |\n| Async vs threads | m10-performance | What's the workload profile? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need parallelism for CPU work\"\n    ↓ Use: std::thread or rayon\n\n\"Need concurrency for I\u002FO\"\n    ↓ Use: async\u002Fawait with tokio\n\n\"Need to share immutable data across threads\"\n    ↓ Use: Arc\u003CT>\n\n\"Need to share mutable data across threads\"\n    ↓ Use: Arc\u003CMutex\u003CT>> or Arc\u003CRwLock\u003CT>>\n    ↓ Or: channels for message passing\n\n\"Need simple atomic operations\"\n    ↓ Use: AtomicBool, AtomicUsize, etc.\n```\n\n---\n\n## Send\u002FSync Markers\n\n| Marker | Meaning | Example |\n|--------|---------|---------|\n| `Send` | Can transfer ownership between threads | Most types |\n| `Sync` | Can share references between threads | `Arc\u003CT>` |\n| `!Send` | Must stay on one thread | `Rc\u003CT>` |\n| `!Sync` | No shared refs across threads | `RefCell\u003CT>` |\n\n## Quick Reference\n\n| Pattern | Thread-Safe | Blocking | Use When |\n|---------|-------------|----------|----------|\n| `std::thread` | Yes | Yes | CPU-bound parallelism |\n| `async\u002Fawait` | Yes | No | I\u002FO-bound concurrency |\n| `Mutex\u003CT>` | Yes | Yes | Shared mutable state |\n| `RwLock\u003CT>` | Yes | Yes | Read-heavy shared state |\n| `mpsc::channel` | Yes | Optional | Message passing |\n| `Arc\u003CMutex\u003CT>>` | Yes | Yes | Shared mutable across threads |\n\n## Decision Flowchart\n\n```\nWhat type of work?\n├─ CPU-bound → std::thread or rayon\n├─ I\u002FO-bound → async\u002Fawait\n└─ Mixed → hybrid (spawn_blocking)\n\nNeed to share data?\n├─ No → message passing (channels)\n├─ Immutable → Arc\u003CT>\n└─ Mutable →\n   ├─ Read-heavy → Arc\u003CRwLock\u003CT>>\n   └─ Write-heavy → Arc\u003CMutex\u003CT>>\n   └─ Simple counter → AtomicUsize\n\nAsync context?\n├─ Type is Send → tokio::spawn\n├─ Type is !Send → spawn_local\n└─ Blocking code → spawn_blocking\n```\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| E0277 `Send` not satisfied | Non-Send in async | Use Arc or spawn_local |\n| E0277 `Sync` not satisfied | Non-Sync shared | Wrap with Mutex |\n| Deadlock | Lock ordering | Consistent lock order |\n| `future is not Send` | Non-Send across await | Drop before await |\n| `MutexGuard` across await | Guard held during suspend | Scope guard properly |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Arc\u003CMutex\u003CT>> everywhere | Contention, complexity | Message passing |\n| thread::sleep in async | Blocks executor | tokio::time::sleep |\n| Holding locks across await | Blocks other tasks | Scope locks tightly |\n| Ignoring deadlock risk | Hard to debug | Lock ordering, try_lock |\n\n---\n\n## Async-Specific Patterns\n\n### Avoid MutexGuard Across Await\n\n```rust\n\u002F\u002F Bad: guard held across await\nlet guard = mutex.lock().await;\ndo_async().await;  \u002F\u002F guard still held!\n\n\u002F\u002F Good: scope the lock\n{\n    let guard = mutex.lock().await;\n    \u002F\u002F use guard\n}  \u002F\u002F guard dropped\ndo_async().await;\n```\n\n### Non-Send Types in Async\n\n```rust\n\u002F\u002F Rc is !Send, can't cross await in spawned task\n\u002F\u002F Option 1: use Arc instead\n\u002F\u002F Option 2: use spawn_local (single-thread runtime)\n\u002F\u002F Option 3: ensure Rc is dropped before .await\n```\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Smart pointer choice | m02-resource |\n| Interior mutability | m03-mutability |\n| Performance tuning | m10-performance |\n| Domain concurrency needs | domain-* |\n",{"name":5,"description":7,"user-invocable":19},"main","0f3f41ed51c357d4f79561a132514089c1aaa97d",".agents\u002Fskills\u002Fm07-concurrency",0,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo","https:\u002F\u002Fgithub.com\u002Fwxxb789","2026-11-15 04:06:53",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add wxxb789\u002Fmarkturbo --skill m07-concurrency",{"tool":36,"command":37},"bunx","bunx skills add wxxb789\u002Fmarkturbo --skill m07-concurrency",{"tool":39,"command":40},"pnpm","pnpm dlx skills add wxxb789\u002Fmarkturbo --skill m07-concurrency","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002FSKILL.md",true,[44,50,54,58],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"comparison.md","REFERENCE","参考文档",7436,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002Fcomparison.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"examples\u002Fthread-patterns.md",8291,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002Fexamples\u002Fthread-patterns.md",{"path":55,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":56,"sourceHtmlUrl":57},"patterns\u002Fasync-patterns.md",8263,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002Fpatterns\u002Fasync-patterns.md",{"path":59,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":60,"sourceHtmlUrl":61},"patterns\u002Fcommon-errors.md",6568,"https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fm07-concurrency\u002Fpatterns\u002Fcommon-errors.md",[63,70,76,83,90,96],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M7AWXVVZ6JEJVFGGT2WBSEN0","hello-diagrams","A valid, fully-populated Agent Skill, shown here so the Skills inspector has something correct to display.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fhello-diagrams\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M7AWXTNG6ZV6WW5CHJZXJYEC","Broken-Example","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Fsample\u002F.claude\u002Fskills\u002Fbroken-example\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M7AWXS5WN306ENF2MYJYP7VM","valid-skill","A fully conformant skill with every optional field populated.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fvalid-skill\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M7AWXR0NY08YVHE0G8VTJJ97","a-different-name","The name does not match the directory, which is a conformance warning.","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fname-mismatch\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M7AWXQ5EV9JCA0WG9Q1WB13Y","missing-metadata","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmissing-metadata\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M7AWXP8GT7FATM53B914ZN50","malformed-yaml","https:\u002F\u002Fgithub.com\u002Fwxxb789\u002Fmarkturbo\u002Fblob\u002Fmain\u002Ffixtures\u002Fskills\u002Fskills\u002Fmalformed-yaml\u002FSKILL.md",[],[]]