cats-effect-resource
8
总安装量
4
周安装量
#35709
全站排名
安装命令
npx skills add https://github.com/alexandru/skills --skill cats-effect-resource
Agent 安装分布
claude-code
4
opencode
3
github-copilot
3
codex
2
amp
1
kimi-cli
1
Skill 文档
Cats Effect Resource (Scala)
Quick start
- Model each resource with
Resource.makeorResource.fromAutoCloseableand keep release idempotent. - Compose resources with
flatMap,mapN,parMapN, or helper constructors; exposeResource[F, A]from APIs. - Use
Resourceat lifecycle boundaries and call.useonly at the program edges. - Read
references/resource.mdfor patterns, best practices, and API notes.
Workflow
- Identify acquisition, use, and release steps; decide if acquisition is blocking.
- Implement a
Resource[F, A]constructor using the smallest needed typeclass. - Compose resources into higher-level resources and keep finalizers minimal.
- Decide how cancelation and errors should influence release logic.
- Run with
.useat the boundary (IOApp, service startup) and avoid leaking rawA.
Usage guidance
- Prefer
Resourceovertry/finallyorbracketwhen composition and cancelation safety matter. - Use
IO.blocking(orSync[F].blocking) for acquisition and release when calling blocking JVM APIs. - For background fibers, use
ResourceorSupervisorto ensure cleanup on cancelation.
References
- Load
references/resource.mdfor API details, patterns, and examples. - For Kotlin/Arrow parallels, see the
arrow-resourceskill. - Install this skill with
npx skills add https://github.com/alexandru/skills --skill cats-effect-resource.