[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78F7PXP5N69H9N2SS7BHVMF":3,"skill-same:01M78F7PXP5N69H9N2SS7BHVMF":77},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":28,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M78F7PXP5N69H9N2SS7BHVMF","concurrency-quality",null,"poppyTM\u002Foride","poppyTM","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F339400917?v=4","01M78F6YNKFR5S5JQR27X9F09Z","Poppy Team","01M78F6YP8ZZTRES9X8Q2ZAD21",1,"MIT","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# Concurrency Quality & Parallel Execution Invariants\n\n## Purpose\nEnforce provable correctness, data race freedom, deadlock prevention, bounded resource allocation, and predictable throughput across multi-threaded, asynchronous, and distributed concurrent systems. Guarantee deterministic cancellation trees, backpressure propagation, and zero thread\u002Fgoroutine leakage across system lifecycles.\n\n## Use when\n- Designing, implementing, or auditing concurrent subsystems, worker pools, async pipelines, and event loops.\n- Synchronizing access to shared mutable state via mutexes, read-write locks, lock-free atomics, or channels.\n- Mitigating concurrency hazards: data races, deadlocks, livelocks, thread starvation, priority inversion, and false sharing.\n- Establishing cooperative task cancellation, graceful termination sequences, and backpressure mechanisms.\n- Validating concurrent code under automated race detectors (`go test -race`, ThreadSanitizer `tsan`, Loom, Tokio console).\n\n## Do not use when\n- Implementing purely sequential, single-threaded algorithms with no async boundaries or background tasks.\n- Designing high-level relational database schema migrations without connection pooling or transactional isolation analysis (use `database-review`).\n- Measuring static web asset loading waterfalls without concurrent runtime workers (use `performance-web`).\n\n## Required context\n- Target runtime concurrency model: Go CSP (goroutines\u002Fchannels), Rust (ownership\u002FSend\u002FSync\u002FTokio), C++20 (`std::jthread`\u002Fatomics), or Python (asyncio\u002Fmultiprocessing).\n- Memory consistency model: Acquire-Release semantics, Sequential Consistency, or runtime happens-before rules.\n- Hardware concurrency constraints: CPU core count, NUMA architecture, cache line size (typically 64 bytes).\n- System throughput, latency SLAs, and queue backpressure boundaries.\n\n## Procedure\n1. **Model Shared State & Enforce Bernstein Conditions**:\n   - For all concurrent operations $T_j$ and $T_k$ ($j \\neq k$), mathematically verify Bernstein's Conditions:\n     $$I_j \\cap O_k = \\emptyset, \\quad O_j \\cap I_k = \\emptyset, \\quad O_j \\cap O_k = \\emptyset$$\n   - Where shared mutable state is unavoidable, encapsulate state within a protective synchronization boundary (mutex, actor, or atomic register).\n2. **Establish Strict Global Lock Hierarchy**:\n   - Construct a directed acyclic graph (DAG) of all lock acquisitions.\n   - Enforce a strict total order: if lock $L_A$ precedes $L_B$ in the hierarchy, any thread acquiring both must acquire $L_A$ before $L_B$.\n   - Never invoke dynamic callbacks, trait methods, or external blocking I\u002FO while holding a mutex lock.\n3. **Enforce Bounded Buffers & Backpressure**:\n   - Forbid unbounded queues, unbounded channels, and unbounded goroutine\u002Fthread spawning.\n   - Size queues using Little's Law ($L = \\lambda W$) where buffer capacity accommodates peak burst without exhausting system memory.\n   - Implement explicit rejection, shedding, or upstream throttling when buffer thresholds are saturated.\n4. **Structure Cooperative Cancellation & Task Lifecycles**:\n   - Establish parent-child cancellation trees using structured concurrency (e.g., `context.Context`, `CancellationToken`, or nursery scopes).\n   - Require all blocking primitives (channel reads, socket polls, condition variables) to listen for cancellation signals.\n   - Bind all spawned tasks to a lifecycle tracker (`sync.WaitGroup`, task nursery, or join handle) guaranteeing deterministic joining before shutdown.\n5. **Optimize Hardware & Cache Synchronization**:\n   - Align atomic variables and contended counters to distinct 64-byte cache line boundaries (`alignas(64)` or padding fields) to eliminate false sharing.\n   - Minimize lock hold times: compute results outside the critical section, acquire the lock only to swap pointers\u002Fstate, and release immediately.\n6. **Verify Under Dynamic & Static Race Analyzers**:\n   - Execute test suites under dynamic race detection (`-race` \u002F `-fsanitize=thread`).\n   - Subject concurrent loops to high-iteration stress tests ($N \\ge 10{,}000$) with aggressive context switching to reveal edge interleavings.\n\n## Decision rules\n- **Zero Data Races**: Any data race reported by ThreadSanitizer or Go `-race` is a critical severity defect that blocks release.\n- **Bounded Resources**: Every channel, queue, and worker pool must have an explicit capacity limit. Unbounded growth is an anti-pattern.\n- **Minimal Critical Sections**: Critical sections must contain only memory operations; no network calls, disk I\u002FO, or foreign library calls may execute under a lock.\n- **Hierarchical Locking**: Acquiring locks out of hierarchy order is strictly prohibited. If two locks cannot be statically ordered, use `TryLock` with backoff and retry.\n- **Graceful Draining**: Applications must drain pending in-flight tasks within a configurable timeout before forcing SIGKILL or aborting.\n\n## Evidence required\n- Concurrency architecture specification documenting the lock hierarchy DAG and cancellation propagation.\n- Test logs with race detection enabled (`go test -race` or `tsan`) demonstrating 0 race warnings.\n- Stress benchmark results demonstrating throughput scaling without lock convoying or thread starvation.\n- Verification script execution log from `scripts\u002Fverify.sh` exiting with code 0.\n\n## Output contract\n- Concurrency design document adhering to `templates\u002Fconcurrency-architecture-spec.md`.\n- Concurrency checklist verification in `checks\u002Fconcurrency-checklist.md`.\n- Reproducible, automated race-detection test harness.\n\n## Stop conditions\n- Complete concurrency verification passed with zero data races and zero deadlocks.\n- All tasks bounded, structured, and guaranteed to terminate cleanly upon cancellation.\n- Token budget exhausted or irreconcilable deadlocks in third-party runtime dependencies.\n\n## Escalation rules\n- Escalate to Architecture Lead if third-party libraries require holding locks across asynchronous boundaries.\n- Escalate to Infrastructure Lead if memory consumption under peak backpressure exceeds host container cgroup limits.\n",{},"main","1cd515630b8ceb57777d466bee4970fe7c2e30e0",".agents\u002Fskills\u002Fconcurrency-quality",0,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride","https:\u002F\u002Fgithub.com\u002FpoppyTM","https:\u002F\u002Fpoppy.lat","Construímos linguagens de programação e ferramentas para quem lê código com o mesmo cuidado com que escreve.","2026-09-30 10:15:52",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add poppyTM\u002Foride --skill concurrency-quality",{"tool":37,"command":38},"bunx","bunx skills add poppyTM\u002Foride --skill concurrency-quality",{"tool":40,"command":41},"pnpm","pnpm dlx skills add poppyTM\u002Foride --skill concurrency-quality","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002FSKILL.md",true,[45,51,57,61,65,69,73],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"checks\u002Fconcurrency-checklist.md","REFERENCE","参考文档",3445,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Fchecks\u002Fconcurrency-checklist.md",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"examples\u002Fbounded_worker_pool_test.go","SCRIPT","脚本",2252,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Fexamples\u002Fbounded_worker_pool_test.go",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"examples\u002Fbounded_worker_pool.go",3557,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Fexamples\u002Fbounded_worker_pool.go",{"path":62,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":63,"sourceHtmlUrl":64},"manifest.json",1760,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Fmanifest.json",{"path":66,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fconcurrency-engineering-guide.md",6960,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Freferences\u002Fconcurrency-engineering-guide.md",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"scripts\u002Fverify.sh",1434,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Fscripts\u002Fverify.sh",{"path":74,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":75,"sourceHtmlUrl":76},"templates\u002Fconcurrency-architecture-spec.md",3489,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fconcurrency-quality\u002Ftemplates\u002Fconcurrency-architecture-spec.md",[78,84,90,97,104,111],{"skillNo":79,"name":80,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M78FHQN254KEH0DETXT5JM29","zoom-reflow","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fzoom-reflow\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M78FHP1880S695V8GQEE0RXK","wireframe-styleguide","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fwireframe-styleguide\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M78FHHYM6AN2H819FABW01DZ","visual-regression","Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fvisual-regression\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":18},"01M78FHE53D8DD0QVRY5C37DA4","ui-implementation","Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fui-implementation\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":18},"01M78FHBJ1KXFF734GFE509TBJ","tui-editor-engine","Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Ftui-editor-engine\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":18},"01M78FH9X6CPJX1H61ZDWTTVW8","tree-sitter-context-indexing","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Ftree-sitter-context-indexing\u002FSKILL.md",[],[]]