skills/hoare-1978-csp/SKILL.md
Foundational theory for process-oriented concurrency through synchronous message-passing, applicable to multi-agent coordination and parallel decomposition
npx skillsauth add curiositech/windags-skills hoare-1978-cspInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Description: Foundational theory for process-oriented concurrency through synchronous message-passing Activation triggers: Multi-agent coordination protocols, parallel task decomposition, deadlock debugging, coordination failures
IF task has clear data transformations (input → process → output)
THEN decompose by data flow (each transformation = process)
└── Linear dependencies → pipeline topology
└── Independent branches → parallel processes
└── Convergence points → guarded input selection
IF components need frequent fine-grained data sharing
THEN consider shared-memory model instead
└── Use CSP for coarse-grained coordination only
IF coordination requirements unclear
THEN map all component interactions first
└── Draw communication graph before coding
IF request-response pattern needed
THEN client outputs request, inputs reply
server inputs request, outputs reply
└── Symmetric protocol prevents deadlock
IF streaming data flow
THEN producer: *[output!data]
consumer: *[input?data → process(data)]
└── Termination via channel closure
IF multiple clients, one server
THEN server uses guarded selection:
*[client1?req → handle1(req)
[]client2?req → handle2(req)]
└── Built-in fairness via arbitrary choice
IF communication graph has cycles
THEN prove resource ordering OR redesign topology
└── Cycles require careful justification
IF topology is DAG (no cycles)
THEN deadlock impossible, proceed with design
IF bidirectional communication needed
THEN alternate input/output carefully
└── Never have both processes waiting for same direction
IF pipeline topology
THEN source terminates first → propagates downstream
└── Each stage: *[input?x → process(x)]
IF tree/graph topology
THEN design explicit join points for synchronization
└── Avoid premature termination breaking chains
IF long-running services
THEN use external termination signals
└── CSP suitable for bounded-lifetime tasks
ps shows processes blocked; communication graph has cycles*[input?x → process(x)] only stops when input closesScenario: Auction system where auctioneer coordinates bidder agents
AUCTIONEER =
*[bidder1?bid(amount) → record(1, amount); announce!newbid(1, amount)
[]bidder2?bid(amount) → record(2, amount); announce!newbid(2, amount)
[]bidder3?bid(amount) → record(3, amount); announce!newbid(3, amount)
[]timer?timeout → announce!closed; winner!result
]
BIDDER(id) =
*[announce?newbid(bidder, amount) →
[amount < maxprice → auctioneer!bid(amount + increment)
[]amount >= maxprice → skip
]
[]winner?result → celebrate
]
Decision walkthrough:
Novice mistake: Making bidders poll for auction state instead of using announcements Expert insight: Guards encode bidding strategy (amount < maxprice), selection handles concurrency
Scenario: Data processing pipeline with validation stage that can reject items
// BROKEN VERSION (deadlock prone)
PRODUCER = *[pipeline!item(data)]
VALIDATOR = *[pipeline?item(data) →
[valid(data) → consumer!clean(data)
[]¬valid(data) → skip // PROBLEM: consumer waits forever
]]
CONSUMER = *[validator?clean(data) → process(data)]
Failure analysis:
// FIXED VERSION
VALIDATOR = *[pipeline?item(data) →
[valid(data) → consumer!clean(data)
[]¬valid(data) → consumer!error(data) // Always send something
]]
CONSUMER = *[validator?clean(data) → process(data)
[]validator?error(data) → log_error(data) // Handle both cases
]
Key decisions made:
Don't use CSP for:
Delegate instead:
concurrent-data-structures skillevent-sourcing or reactive-streams skillslock-free-algorithms skilltask-scheduling skilldistributed-consensus skill for cross-network coordinationCSP sweet spot: Medium-grained coordination between independent processes with clear communication boundaries and well-defined protocols.
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.