Kotlin Context Parameters
SkillDev toolsKotlin context parameters (`context(...)`) for scoped dependencies, DSL scopes, and migrations from context receivers. Use when designing, reviewing, or refactoring Kotlin code that uses implicit contextual values.
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 Kotlin Context Parameters skill
What this skill tells your AI
The instructions your AI receives, as published by alexandru/social-publish in .agents/skills/kotlin-context-parameters/SKILL.md and read by ahel’s review.
Quick start
- Declare dependencies with
context(name: Type)before a function or property. - Introduce values at boundaries with
context(value) { ... }or from an existing implicit receiver such aswith(value) { ... }. - Use named context parameters for services you call directly; use
_for marker/scope capabilities used only for resolution. - Prefer small, explicit contexts. Avoid having multiple same-typed values available at the same scope level.
- Read
references/context-parameters.mdbefore writing examples or migration advice.
Workflow
- Identify the contextual capability: service dependency, DSL/scope marker, typeclass-like evidence, or migration from context receivers.
- Decide names: named parameter when code needs the value;
_plus bridge functions when the context should only unlock operations. - Add a boundary that supplies the context (
context(...) {}or a wrapper accepting acontext(Type) () -> Ablock). - Check restrictions: no constructor/class contexts, no context-property initializers/backing fields/delegation.
- Compile-test syntax with the target Kotlin version.
Rules of thumb
- Context resolution is by type at the call site, not by parameter name.
- Context values come from in-scope context parameters and implicit receivers.
- If two compatible values are available at the same scope level, expect ambiguity.
- Do not present proposal-only features as available unless verified with the user's Kotlin version.
- For contextual function references and explicit context arguments, use lambdas or compile-test first; support has lagged the proposal in tested Kotlin builds.
Output expectations
- Show call sites, not just declarations.
- Prefer examples that compile on the target Kotlin version, or clearly mark untested/proposal-only behavior.
References
- Load
references/context-parameters.mdfor examples, restrictions, migration notes, and test prompts.
Signals
- GitHub stars
- 62
- Forks
- 3
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
kotlin-context-parameters- Source
- github.com/alexandru/social-publish