Arrow Resource (Kotlin)
SkillFiles & storageKotlin + Arrow Resource lifecycle discipline with `Resource`, `ResourceScope`, `resourceScope`, and context parameters. Use for safe acquisition/release of files, streams, DB pools/connections, HTTP clients, background scopes, or multipart parts; preventing resource leaks and use-after-close bugs; designing companion `Resource` builders; using `arrow-autoclose` when only synchronous `AutoCloseable` cleanup is possible; composing resources with typed errors, cancellation, or parallel acquisition.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Arrow Resource (Kotlin) skill
What this skill tells your AI
The instructions your AI receives, as published by alexandru/social-publish in .agents/skills/arrow-resource/SKILL.md and read by ahel’s review.
Quick start
- Treat every disposable handle as scoped: wrap it in
Resourceand acquire it only insideresourceScope,resource {}, orResource.use. - Prefer
arrow.fx.coroutines.resource.contextimports for context-parameter-friendlyresource,resourceScope,bind,install, andautoCloseable. - Never return a disposable value from
resourceScope { ... },resource { ... }, orresource.use { ... }; that returns a closed handle. - Classes must not allocate owned resources in ordinary constructors. Use a companion builder returning
Resource<Class>or requiringcontext(ResourceScope). - If suspend
Resourcecannot be used, usearrow-autoclose/AutoCloseablewith the same no-leak discipline. - Read
references/resource.mdbefore writing examples, reviews, or new APIs.
Workflow
- Identify every owned disposable dependency and its release action.
- Move acquisition into a
Resourcerecipe orcontext(ResourceScope)builder. - Compose resources into higher-level resources with
.bind()or context-parameter builders. - Keep resource handles private to the scoped object; expose operations, not the raw handle.
- Execute at lifecycle boundaries with
resourceScope/.use, and keep finalizers idempotent.
Usage guidance
- Prefer
Resourceoveruse/try/finallyfor suspend finalizers, cancellation awareness, composition, or multiplatform code. - Use context parameters for scoped capabilities:
context(_: ResourceScope) suspend fun acquire.... - Use
ExitCasewhen release behavior depends on success, failure, or cancellation. Resourceis FP-style ownership: acquisition and finalization are values/effects that compose; hidden side-effectful constructors are a design smell.- When changing examples, update and run the bundled
scripts/verify-examples.ktcheck.
References
- Load
references/resource.mdfor rules, source links, and typechecked examples.
Signals
- GitHub stars
- 62
- Forks
- 3
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
arrow-resource- Source
- github.com/alexandru/social-publish