yandex/implicits/implicits-usage-guide

Claude Code and agent skill by yandex/implicits

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Swift Implicits library — use for code with `@Implicit`, `ImplicitScope`, `#withImplicits`, `#implicits`, `withScope`, or a `Package.swift` depending on the `implicits` package.

Install

npx vskill@latest install yandex/implicits/implicits-usage-guide

SKILL.md

Implicits Usage Guide

Implicits is a Swift library for implicit parameter passing through call stacks — eliminates "parameter drilling" (passing the same arguments through many function layers). Similar in spirit to implicit parameters in Scala or context receivers in Kotlin.

Core Pattern

swift
func start() {
let scope = ImplicitScope()
defer { scope.end() }
@Implicit var network = NetworkService() // declare
process(scope)
}
func process(_ scope: ImplicitScope) { fetch(scope) }
func fetch(_ scope: ImplicitScope) {
@Implicit() var network: NetworkService // retrieve
network.request()
}

Rules:

  • ImplicitScope — last argument, no parameter label
  • Always defer { scope.end() } after creating a scope
  • Declaration: @Implicit var x = value (with initializer)
  • Retrieval: @Implicit() var x: Type (no initializer, explicit type)
  • Missing implicit = compile-time error

Keys: Type-Based vs Named

Type-based (default) — the type itself is the key:

swift
@Implicit() var network: NetworkService

Named keys — use when type alone doesn't explain meaning:

swift
extension ImplicitsKeys {
static let guestMode = Key<Bool>()
}
@Implicit(\.guestMode) var guest = true // declare
@Implicit(\.guestMode) var isGuest: Bool // retrieve

Nested Scopes

Child scope inherits parent values, can override or add new (retrieval picks nearest):

swift
func inner(_ outer: ImplicitScope) async {
let scope = outer.nested()
defer { scope.end() }
@Implicit var extra = ExtraService()
await extra.doWork(scope)
}

Async code is supported.

Closures

Closures don't inherit scope automatically. Use #withImplicits to capture implicits used in the body:

swift
fetchData(completion: #withImplicits { result, scope in
@Implicit() var handler: ResultHandler
handler.process(result)
})

Effects (async/throws) are inferred. @MainActor is preserved on the result; other global actors aren't — use named wrappers for those.

#withImplicits takes an isolation: parameter: .mainActor selects the @MainActor variant explicitly when the compiler or the analyzer can't choose it.

For full details on #withImplicits, named wrappers, capture lists, and #implicits, see docs/closures.md in the Implicits repo.

Factory Pattern

Store context for later use:

swift
class Component {
let implicits = #implicits
init(_ scope: ImplicitScope) {}
func createChild() -> Child {
withScope(with: implicits) { scope in
Child(scope)
}
}
}

Stored Properties in Types

@Implicit works as a stored property — the type needs a scope in its initializer:

swift
struct View {
@Implicit() var theme: Theme
init(_ scope: ImplicitScope) {}
}

withScope Alternative

withScope handles scope lifecycle when indentation isn't a problem and the body is small:

swift
withScope { scope in ... } // root scope
withScope(with: implicits) { scope in ... } // from captured implicits
withScope(nesting: outer) { scope in ... } // nested scope

Build-Time Analysis Setup

Add the plugin to Package.swift:

swift
.target(
name: "MyApp",
dependencies: [.product(name: "Implicits", package: "implicits")],
plugins: [.plugin(name: "ImplicitsAnalysisPlugin", package: "implicits")]
)

Plugin graph rule: Every module on the path from your code to the Implicits library must have the plugin. Example: if App → FeatureA → FeatureB → Implicits and FeatureB uses implicits, then FeatureB and FeatureA both need the plugin (App too if it uses implicits).

Static Analysis Constraints

  1. Type annotations may be needed for type-based keys — the analyzer infers when possible.
  2. No dynamic dispatch — the analyzer can't track through protocol-typed values or closures stored in properties. Static calls only.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
41
Repository forks
5
7-day trend score
19

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/yandex/implicits/implicits-usage-guide/badge)](https://verified-skill.com/skills/yandex/implicits/implicits-usage-guide)

Something wrong with this skill or its page? Tell us.