← Back to list

dependency-injection-setup
by willsigmon
Website for sigstack.dev - Claude Code stack showcase
⭐ 0🍴 0📅 Jan 23, 2026
SKILL.md
name: Dependency Injection Setup description: Add new services to DIContainer, create protocol-based implementations, set up singletons or factories for Leavn app dependency injection allowed-tools: Read, Edit, Grep
Dependency Injection Setup
Instructions
Add new services to Leavn's DIContainer:
-
Create service protocol:
// Services/MyDomain/MyServiceProtocol.swift public protocol MyServiceProtocol { func doSomething() async throws -> Result } -
Create implementation:
// Services/MyDomain/MyServiceLive.swift public final class MyServiceLive: MyServiceProtocol { public init() { } public func doSomething() async throws -> Result { // Implementation } } -
Register in DIContainer:
// For singletons (stateful services): private lazy var _myService = MyServiceLive() var myService: MyServiceProtocol { _myService } // For factories (stateless services): var myService: MyServiceProtocol { MyServiceLive() } -
Use in ViewModels:
let service = DIContainer.shared.myService
Use this skill when: Creating new service, adding dependency, setting up DI, refactoring to protocol-oriented design
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon