About effect-concurrency-fibers
A skill for managing concurrency with Effect, including parallel work, fiber lifecycles, races, and timeouts. It is intended for developers building asynchronous Effect code and emphasizes bounded concurrency and checking local source before implementation.
Key features
- 01Run tasks with concurrency limits
- 02Fork, join, and interrupt fibers
- 03Race operations and set timeouts
- 04Search local Effect source and tests
Use cases
- 01Parallelize independent Effect operations
- 02Manage background fibers through shutdown
- 03Set latency bounds for competing operations
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ mepuka/ effect-ontology --skill effect-concurrency-fibersAfter installing, type/effect-concurrency-fibersin Claude Code to confirm it loaded.
Details
From the project READMEConcurrency & Fibers
When to use
- Parallelizing independent work safely with limits
- Coordinating background tasks and lifecycle
- Racing operations for latency control
Parallel Patterns
const results = yield* Effect.all(tasks, { concurrency: 10 })
const processed = yield* Effect.forEach(items, processItem, { concurrency: 5 })
Fiber Lifecycle
const fiber = yield* Effect.fork(work)
const value = yield* Fiber.join(fiber)
yield* Fiber.interrupt(fiber)
Racing / Timeouts
const fastest = yield* Effect.race(slow, fast)
const withTimeout = yield* Effect.timeout(operation, "5 seconds")
Guidance
- Limit concurrency to protect resources
- Use
forkfor background loops; always manage interruption - Prefer
Effect.allfor independent operations - Use
Effect.forEachwithconcurrencyfor pools - Combine with retries and timeouts for resilient parallelism
Pitfalls
- Unbounded concurrency can exhaust CPU/IO or hit rate limits
- Always interrupt background fibers on shutdown
- Don’t block inside fibers; keep work asynchronous/effectful
Cross-links
- Errors & Retries: backoff + jitter for transient failures
- Streams & Pipelines: concurrent map over streams
- EffectPatterns inspiration: https://github.com/PaulJPhilp/EffectPatterns
Local Source Reference
CRITICAL: Search local Effect source before implementing
The full Effect source code is available at docs/effect-source/. Always search the actual implementation before writing Effect code.
Key Source Files
- Effect:
docs/effect-source/effect/src/Effect.ts - Fiber:
docs/effect-source/effect/src/Fiber.ts - Duration:
docs/effect-source/effect/src/Duration.ts
Example Searches
# Find Effect.all and concurrency patterns
grep -F "Effect.all" docs/effect-source/effect/src/Effect.ts
# Find forEach with concurrency
grep -rF "forEach" docs/effect-source/effect/src/ | grep -F "concurrency"
# Study Fiber lifecycle operations
grep -F "export" docs/effect-source/effect/src/Fiber.ts | grep -E "fork|join|interrupt"
# Find race and timeout implementations
grep -F "race" docs/effect-source/effect/src/Effect.ts
grep -F "timeout" docs/effect-source/effect/src/Effect.ts
Workflow
- Identify the concurrency API you need (e.g., Effect.all, fork)
- Search
docs/effect-source/effect/src/Effect.tsfor the implementation - Study the types and concurrency options
- Look at test files for usage examples
- Write your code based on real implementations
Real source code > documentation > assumptions
References
- Agent Skills overview: https://www.anthropic.com/news/skills
- Skills guide: https://docs.claude.com/en/docs/claude-code/skills
Comments
Markdown supported