effect-concurrency-lifecycle
Skill1 starsChanged 6 months agoMITView on GitHub
Use when working with Effect Fiber, Deferred, Scope, Queue, PubSub, Stream, interruption, background loops, graceful shutdown, backpressure, races, or bounded concurrency in Theseus.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-self-checkSkill
- biome-grit-rulesSkill
- biome-toolingSkill
- bun-testSkill
- bun-workspaceSkill
- cleanup-auditSkill
- code-reviewSkill
- dispatch-satelliteSkill
- docs-managementSkill
- docs-readingSkill
- effect-errors-schemaSkill
- effect-observability-timeSkill
- effect-services-layersSkill
- effect-testing-runtimeSkill
- effect-v4Skill
- jsx-md-authoringSkill
- monorepo-maintenanceSkill
- refactoring-disciplineSkill
- roadmap-managementSkill
- runtime-engineSkill
- server-runtimeSkill
- testing-patternsSkill
- theseus-designSkill
- tool-authoringSkill
- typescript-strictSkill
- ui-layout-disciplineSkill
- theseus-designSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 4 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill for concurrent work, background processes, and resource lifecycles.
- Very specific: line 21
Use Effect.forkScoped for work that must stop when the current scope closes.
- Very specific: line 22
Use Effect.forkIn(effect, scope) when scope ownership is explicit.
- Very specific: line 23
Use Effect.forkDetach({ startImmediately: true })(effect) only when work must outlive the parent fiber.
- Very specific: line 24
Use Deferred for cross-fiber result delivery, especially from detached work.
- Very specific: line 25
Use Effect.onExit or Effect.ensuring for cleanup that must run on success, failure, or interrupt.
- Very specific: line 26
Use Effect.acquireUseRelease or scoped layers for real resources.
- Very specific: line 33
Use "unbounded" only when the collection and cost are bounded by design.
- Distinctive: line 35
Prefer deterministic shutdown signals over sleeps.
- Distinctive: line 48
Use explicit type parameters for queues.
- Very specific: line 49
Use PubSub when one event must be broadcast to multiple subscribers.
- Distinctive: line 52
Do not leave background consumers without interruption or shutdown.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Effect Concurrency And Lifecycle
Use this skill for concurrent work, background processes, and resource lifecycles.
Fiber Ownership
Pick the lifecycle intentionally.
const fiber = yield* Effect.forkDetach({ startImmediately: true })(work)
yield* Fiber.interrupt(fiber)Rules:
- Use
Effect.forkScopedfor work that must stop when the current scope closes. - Use
Effect.forkIn(effect, scope)when scope ownership is explicit. - Use
Effect.forkDetach({ startImmediately: true })(effect)only when work must outlive the parent fiber. - Use
Deferredfor cross-fiber result delivery, especially from detached work. - Use
Effect.onExitorEffect.ensuringfor cleanup that must run on success, failure, or interrupt. - Use
Effect.acquireUseReleaseor scoped layers for real resources. - Background work must have an owner: scope, registry, runtime service, or explicit detached lifecycle.
- Queues, streams, subscriptions, and detached fibers must have a shutdown story. If it cannot be interrupted or drained, it is not ready for runtime code.
Bounded Work
- Limit parallelism with
Effect.all(..., { concurrency: n })orEffect.forEach(..., { concurrency: n }). - Use
"unbounded"only when the collection and cost are bounded by design. Effect.raceinterrupts the losing effect. Make sure both sides are interruption-safe.- Prefer deterministic shutdown signals over sleeps.
Queues, PubSub, Streams
Queues encode pressure policy. Choose it deliberately:
Queue.bounded<A>(n)- backpressure; producer waits when full.Queue.sliding<A>(n)- keep latest, drop oldest.Queue.dropping<A>(n)- keep current, drop new when full.Queue.unbounded<A>()- only when memory growth is impossible or bounded elsewhere.
Rules:
- Use explicit type parameters for queues.
- Use
PubSubwhen one event must be broadcast to multiple subscribers. - Bridge queues to streams with
Stream.fromQueue(queue). - End queue-backed streams by offering a terminal event plus
Stream.takeUntil(...), or byQueue.shutdown(queue)when shutdown semantics are correct. - Do not leave background consumers without interruption or shutdown.
Checks
- Who owns this fiber?
- What interrupts it?
- Where is shutdown/drain handled?
- Can producers outrun consumers?
- What happens when the consumer fails?
- Are failures logged, surfaced, or intentionally ignored?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

