opencodekit 0.16.15 → 0.16.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +1 -1
  3. package/dist/template/.opencode/agent/plan.md +77 -161
  4. package/dist/template/.opencode/command/create.md +75 -307
  5. package/dist/template/.opencode/command/design.md +53 -589
  6. package/dist/template/.opencode/command/handoff.md +76 -180
  7. package/dist/template/.opencode/command/init.md +45 -211
  8. package/dist/template/.opencode/command/plan.md +62 -514
  9. package/dist/template/.opencode/command/pr.md +56 -226
  10. package/dist/template/.opencode/command/research.md +55 -266
  11. package/dist/template/.opencode/command/resume.md +33 -138
  12. package/dist/template/.opencode/command/review-codebase.md +54 -202
  13. package/dist/template/.opencode/command/ship.md +78 -127
  14. package/dist/template/.opencode/command/start.md +47 -577
  15. package/dist/template/.opencode/command/status.md +55 -354
  16. package/dist/template/.opencode/command/ui-review.md +52 -298
  17. package/dist/template/.opencode/command/verify.md +36 -250
  18. package/dist/template/.opencode/memory.db-shm +0 -0
  19. package/dist/template/.opencode/memory.db-wal +0 -0
  20. package/dist/template/.opencode/plugin/README.md +8 -4
  21. package/dist/template/.opencode/plugin/swarm-enforcer.ts +182 -27
  22. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +112 -0
  23. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +6 -0
  24. package/dist/template/.opencode/skill/core-data-expert/SKILL.md +82 -0
  25. package/dist/template/.opencode/skill/core-data-expert/references/batch-operations.md +543 -0
  26. package/dist/template/.opencode/skill/core-data-expert/references/cloudkit-integration.md +259 -0
  27. package/dist/template/.opencode/skill/core-data-expert/references/concurrency.md +522 -0
  28. package/dist/template/.opencode/skill/core-data-expert/references/fetch-requests.md +643 -0
  29. package/dist/template/.opencode/skill/core-data-expert/references/glossary.md +233 -0
  30. package/dist/template/.opencode/skill/core-data-expert/references/migration.md +393 -0
  31. package/dist/template/.opencode/skill/core-data-expert/references/model-configuration.md +597 -0
  32. package/dist/template/.opencode/skill/core-data-expert/references/performance.md +300 -0
  33. package/dist/template/.opencode/skill/core-data-expert/references/persistent-history.md +553 -0
  34. package/dist/template/.opencode/skill/core-data-expert/references/project-audit.md +60 -0
  35. package/dist/template/.opencode/skill/core-data-expert/references/saving.md +574 -0
  36. package/dist/template/.opencode/skill/core-data-expert/references/stack-setup.md +625 -0
  37. package/dist/template/.opencode/skill/core-data-expert/references/testing.md +300 -0
  38. package/dist/template/.opencode/skill/core-data-expert/references/threading.md +589 -0
  39. package/dist/template/.opencode/skill/swift-concurrency/SKILL.md +246 -0
  40. package/dist/template/.opencode/skill/swift-concurrency/references/actors.md +640 -0
  41. package/dist/template/.opencode/skill/swift-concurrency/references/async-algorithms.md +822 -0
  42. package/dist/template/.opencode/skill/swift-concurrency/references/async-await-basics.md +249 -0
  43. package/dist/template/.opencode/skill/swift-concurrency/references/async-sequences.md +670 -0
  44. package/dist/template/.opencode/skill/swift-concurrency/references/core-data.md +533 -0
  45. package/dist/template/.opencode/skill/swift-concurrency/references/glossary.md +128 -0
  46. package/dist/template/.opencode/skill/swift-concurrency/references/linting.md +142 -0
  47. package/dist/template/.opencode/skill/swift-concurrency/references/memory-management.md +542 -0
  48. package/dist/template/.opencode/skill/swift-concurrency/references/migration.md +1076 -0
  49. package/dist/template/.opencode/skill/swift-concurrency/references/performance.md +574 -0
  50. package/dist/template/.opencode/skill/swift-concurrency/references/sendable.md +578 -0
  51. package/dist/template/.opencode/skill/swift-concurrency/references/tasks.md +604 -0
  52. package/dist/template/.opencode/skill/swift-concurrency/references/testing.md +565 -0
  53. package/dist/template/.opencode/skill/swift-concurrency/references/threading.md +452 -0
  54. package/dist/template/.opencode/skill/swiftui-expert-skill/SKILL.md +290 -0
  55. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-advanced.md +351 -0
  56. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-basics.md +284 -0
  57. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-transitions.md +326 -0
  58. package/dist/template/.opencode/skill/swiftui-expert-skill/references/image-optimization.md +286 -0
  59. package/dist/template/.opencode/skill/swiftui-expert-skill/references/layout-best-practices.md +312 -0
  60. package/dist/template/.opencode/skill/swiftui-expert-skill/references/liquid-glass.md +377 -0
  61. package/dist/template/.opencode/skill/swiftui-expert-skill/references/list-patterns.md +153 -0
  62. package/dist/template/.opencode/skill/swiftui-expert-skill/references/modern-apis.md +400 -0
  63. package/dist/template/.opencode/skill/swiftui-expert-skill/references/performance-patterns.md +377 -0
  64. package/dist/template/.opencode/skill/swiftui-expert-skill/references/scroll-patterns.md +305 -0
  65. package/dist/template/.opencode/skill/swiftui-expert-skill/references/sheet-navigation-patterns.md +292 -0
  66. package/dist/template/.opencode/skill/swiftui-expert-skill/references/state-management.md +447 -0
  67. package/dist/template/.opencode/skill/swiftui-expert-skill/references/text-formatting.md +285 -0
  68. package/dist/template/.opencode/skill/swiftui-expert-skill/references/view-structure.md +276 -0
  69. package/package.json +1 -1
@@ -0,0 +1,246 @@
1
+ ---
2
+ name: swift-concurrency
3
+ description: 'Expert guidance on Swift Concurrency best practices, patterns, and implementation. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).'
4
+ ---
5
+ # Swift Concurrency
6
+
7
+ ## Overview
8
+
9
+ This skill provides expert guidance on Swift Concurrency, covering modern async/await patterns, actors, tasks, Sendable conformance, and migration to Swift 6. Use this skill to help developers write safe, performant concurrent code and navigate the complexities of Swift's structured concurrency model.
10
+
11
+ ## Agent Behavior Contract (Follow These Rules)
12
+
13
+ 1. Analyze the project/package file to find out which Swift language mode (Swift 5.x vs Swift 6) and which Xcode/Swift toolchain is used when advice depends on it.
14
+ 2. Before proposing fixes, identify the isolation boundary: `@MainActor`, custom actor, actor instance isolation, or nonisolated.
15
+ 3. Do not recommend `@MainActor` as a blanket fix. Justify why main-actor isolation is correct for the code.
16
+ 4. Prefer structured concurrency (child tasks, task groups) over unstructured tasks. Use `Task.detached` only with a clear reason.
17
+ 5. If recommending `@preconcurrency`, `@unchecked Sendable`, or `nonisolated(unsafe)`, require:
18
+ - a documented safety invariant
19
+ - a follow-up ticket to remove or migrate it
20
+ 6. For migration work, optimize for minimal blast radius (small, reviewable changes) and add verification steps.
21
+ 7. Course references are for deeper learning only. Use them sparingly and only when they clearly help answer the developer's question.
22
+
23
+ ## Recommended Tools for Analysis
24
+
25
+ When analyzing Swift projects for concurrency issues:
26
+
27
+ 1. **Project Settings Discovery**
28
+ - Use `Read` on `Package.swift` for SwiftPM settings (tools version, strict concurrency flags, upcoming features)
29
+ - Use `Grep` for `SWIFT_STRICT_CONCURRENCY` or `SWIFT_DEFAULT_ACTOR_ISOLATION` in `.pbxproj` files
30
+ - Use `Grep` for `SWIFT_UPCOMING_FEATURE_` to find enabled upcoming features
31
+
32
+
33
+
34
+ ## Project Settings Intake (Evaluate Before Advising)
35
+
36
+ Concurrency behavior depends on build settings. Always try to determine:
37
+
38
+ - Default actor isolation (is the module default `@MainActor` or `nonisolated`?)
39
+ - Strict concurrency checking level (minimal/targeted/complete)
40
+ - Whether upcoming features are enabled (especially `NonisolatedNonsendingByDefault`)
41
+ - Swift language mode (Swift 5.x vs Swift 6) and SwiftPM tools version
42
+
43
+ ### Manual checks (no scripts)
44
+
45
+ - SwiftPM:
46
+ - Check `Package.swift` for `.defaultIsolation(MainActor.self)`.
47
+ - Check `Package.swift` for `.enableUpcomingFeature("NonisolatedNonsendingByDefault")`.
48
+ - Check for strict concurrency flags: `.enableExperimentalFeature("StrictConcurrency=targeted")` (or similar).
49
+ - Check tools version at the top: `// swift-tools-version: ...`
50
+ - Xcode projects:
51
+ - Search `project.pbxproj` for:
52
+ - `SWIFT_DEFAULT_ACTOR_ISOLATION`
53
+ - `SWIFT_STRICT_CONCURRENCY`
54
+ - `SWIFT_UPCOMING_FEATURE_` (and/or `SWIFT_ENABLE_EXPERIMENTAL_FEATURES`)
55
+
56
+ If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance.
57
+
58
+ ## Quick Decision Tree
59
+
60
+ When a developer needs concurrency guidance, follow this decision tree:
61
+
62
+ 1. **Starting fresh with async code?**
63
+ - Read `references/async-await-basics.md` for foundational patterns
64
+ - For parallel operations → `references/tasks.md` (async let, task groups)
65
+
66
+ 2. **Protecting shared mutable state?**
67
+ - Need to protect class-based state → `references/actors.md` (actors, @MainActor)
68
+ - Need thread-safe value passing → `references/sendable.md` (Sendable conformance)
69
+
70
+ 3. **Managing async operations?**
71
+ - Structured async work → `references/tasks.md` (Task, child tasks, cancellation)
72
+ - Streaming data → `references/async-sequences.md` (AsyncSequence, AsyncStream)
73
+
74
+ 4. **Working with legacy frameworks?**
75
+ - Core Data integration → `references/core-data.md`
76
+ - General migration → `references/migration.md`
77
+
78
+ 5. **Performance or debugging issues?**
79
+ - Slow async code → `references/performance.md` (profiling, suspension points)
80
+ - Testing concerns → `references/testing.md` (XCTest, Swift Testing)
81
+
82
+ 6. **Understanding threading behavior?**
83
+ - Read `references/threading.md` for thread/task relationship and isolation
84
+
85
+ 7. **Memory issues with tasks?**
86
+ - Read `references/memory-management.md` for retain cycle prevention
87
+
88
+ ## Triage-First Playbook (Common Errors -> Next Best Move)
89
+
90
+ - SwiftLint concurrency-related warnings
91
+ - Use `references/linting.md` for rule intent and preferred fixes; avoid dummy awaits as “fixes”.
92
+ - SwiftLint `async_without_await` warning
93
+ - Remove `async` if not required; if required by protocol/override/@concurrent, prefer narrow suppression over adding fake awaits. See `references/linting.md`.
94
+ - "Sending value of non-Sendable type ... risks causing data races"
95
+ - First: identify where the value crosses an isolation boundary
96
+ - Then: use `references/sendable.md` and `references/threading.md` (especially Swift 6.2 behavior changes)
97
+ - "Main actor-isolated ... cannot be used from a nonisolated context"
98
+ - First: decide if it truly belongs on `@MainActor`
99
+ - Then: use `references/actors.md` (global actors, `nonisolated`, isolated parameters) and `references/threading.md` (default isolation)
100
+ - "Class property 'current' is unavailable from asynchronous contexts" (Thread APIs)
101
+ - Use `references/threading.md` to avoid thread-centric debugging and rely on isolation + Instruments
102
+ - XCTest async errors like "wait(...) is unavailable from asynchronous contexts"
103
+ - Use `references/testing.md` (`await fulfillment(of:)` and Swift Testing patterns)
104
+ - Core Data concurrency warnings/errors
105
+ - Use `references/core-data.md` (DAO/`NSManagedObjectID`, default isolation conflicts)
106
+
107
+ ## Core Patterns Reference
108
+
109
+ ### When to Use Each Concurrency Tool
110
+
111
+ **async/await** - Making existing synchronous code asynchronous
112
+ ```swift
113
+ // Use for: Single asynchronous operations
114
+ func fetchUser() async throws -> User {
115
+ try await networkClient.get("/user")
116
+ }
117
+ ```
118
+
119
+ **async let** - Running multiple independent async operations in parallel
120
+ ```swift
121
+ // Use for: Fixed number of parallel operations known at compile time
122
+ async let user = fetchUser()
123
+ async let posts = fetchPosts()
124
+ let profile = try await (user, posts)
125
+ ```
126
+
127
+ **Task** - Starting unstructured asynchronous work
128
+ ```swift
129
+ // Use for: Fire-and-forget operations, bridging sync to async contexts
130
+ Task {
131
+ await updateUI()
132
+ }
133
+ ```
134
+
135
+ **Task Group** - Dynamic parallel operations with structured concurrency
136
+ ```swift
137
+ // Use for: Unknown number of parallel operations at compile time
138
+ await withTaskGroup(of: Result.self) { group in
139
+ for item in items {
140
+ group.addTask { await process(item) }
141
+ }
142
+ }
143
+ ```
144
+
145
+ **Actor** - Protecting mutable state from data races
146
+ ```swift
147
+ // Use for: Shared mutable state accessed from multiple contexts
148
+ actor DataCache {
149
+ private var cache: [String: Data] = [:]
150
+ func get(_ key: String) -> Data? { cache[key] }
151
+ }
152
+ ```
153
+
154
+ **@MainActor** - Ensuring UI updates on main thread
155
+ ```swift
156
+ // Use for: View models, UI-related classes
157
+ @MainActor
158
+ class ViewModel: ObservableObject {
159
+ @Published var data: String = ""
160
+ }
161
+ ```
162
+
163
+ ### Common Scenarios
164
+
165
+ **Scenario: Network request with UI update**
166
+ ```swift
167
+ Task { @concurrent in
168
+ let data = try await fetchData() // Background
169
+ await MainActor.run {
170
+ self.updateUI(with: data) // Main thread
171
+ }
172
+ }
173
+ ```
174
+
175
+ **Scenario: Multiple parallel network requests**
176
+ ```swift
177
+ async let users = fetchUsers()
178
+ async let posts = fetchPosts()
179
+ async let comments = fetchComments()
180
+ let (u, p, c) = try await (users, posts, comments)
181
+ ```
182
+
183
+ **Scenario: Processing array items in parallel**
184
+ ```swift
185
+ await withTaskGroup(of: ProcessedItem.self) { group in
186
+ for item in items {
187
+ group.addTask { await process(item) }
188
+ }
189
+ for await result in group {
190
+ results.append(result)
191
+ }
192
+ }
193
+ ```
194
+
195
+ ## Swift 6 Migration Quick Guide
196
+
197
+ Key changes in Swift 6:
198
+ - **Strict concurrency checking** enabled by default
199
+ - **Complete data-race safety** at compile time
200
+ - **Sendable requirements** enforced on boundaries
201
+ - **Isolation checking** for all async boundaries
202
+
203
+ For detailed migration steps, see `references/migration.md`.
204
+
205
+ ## Reference Files
206
+
207
+ Load these files as needed for specific topics:
208
+
209
+ - **`async-await-basics.md`** - async/await syntax, execution order, async let, URLSession patterns
210
+ - **`tasks.md`** - Task lifecycle, cancellation, priorities, task groups, structured vs unstructured
211
+ - **`threading.md`** - Thread/task relationship, suspension points, isolation domains, nonisolated
212
+ - **`memory-management.md`** - Retain cycles in tasks, memory safety patterns
213
+ - **`actors.md`** - Actor isolation, @MainActor, global actors, reentrancy, custom executors, Mutex
214
+ - **`sendable.md`** - Sendable conformance, value/reference types, @unchecked, region isolation
215
+ - **`linting.md`** - Concurrency-focused lint rules and SwiftLint `async_without_await`
216
+ - **`async-sequences.md`** - AsyncSequence, AsyncStream, when to use vs regular async methods
217
+ - **`core-data.md`** - NSManagedObject sendability, custom executors, isolation conflicts
218
+ - **`performance.md`** - Profiling with Instruments, reducing suspension points, execution strategies
219
+ - **`testing.md`** - XCTest async patterns, Swift Testing, concurrency testing utilities
220
+ - **`migration.md`** - Swift 6 migration strategy, closure-to-async conversion, @preconcurrency, FRP migration
221
+
222
+ ## Best Practices Summary
223
+
224
+ 1. **Prefer structured concurrency** - Use task groups over unstructured tasks when possible
225
+ 2. **Minimize suspension points** - Keep actor-isolated sections small to reduce context switches
226
+ 3. **Use @MainActor judiciously** - Only for truly UI-related code
227
+ 4. **Make types Sendable** - Enable safe concurrent access by conforming to Sendable
228
+ 5. **Handle cancellation** - Check Task.isCancelled in long-running operations
229
+ 6. **Avoid blocking** - Never use semaphores or locks in async contexts
230
+ 7. **Test concurrent code** - Use proper async test methods and consider timing issues
231
+
232
+ ## Verification Checklist (When You Change Concurrency Code)
233
+
234
+ - Confirm build settings (default isolation, strict concurrency, upcoming features) before interpreting diagnostics.
235
+ - After refactors:
236
+ - Run tests, especially concurrency-sensitive ones (see `references/testing.md`).
237
+ - If performance-related, verify with Instruments (see `references/performance.md`).
238
+ - If lifetime-related, verify deinit/cancellation behavior (see `references/memory-management.md`).
239
+
240
+ ## Glossary
241
+
242
+ See `references/glossary.md` for quick definitions of core concurrency terms used across this skill.
243
+
244
+ ---
245
+
246
+ **Note**: This skill is based on the comprehensive [Swift Concurrency Course](https://www.swiftconcurrencycourse.com?utm_source=github&utm_medium=agent-skill&utm_campaign=skill-footer) by Antoine van der Lee.