Agent skill
Actor Isolation Fixer
Fix Swift 6 actor isolation errors in Leavn app - deinit accessing @MainActor properties, nonisolated contexts, concurrent access violations
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/actor-isolation-fixer-willsigmon-sigstack-site
SKILL.md
Actor Isolation Fixer
Instructions
Fix actor isolation errors systematically:
-
Error: "main actor-isolated property X cannot be accessed from nonisolated"
- In deinit: Mark property as
nonisolated(unsafe) private var - In closure: Add
@MainActorto Task or useawait MainActor.run { } - In method: Mark method
@MainActorornonisolated
- In deinit: Mark property as
-
Common Leavn patterns:
swift// Timer in @MainActor class deinit nonisolated(unsafe) private var timer: Timer? deinit { timer?.invalidate() // Safe - Timer.invalidate() is thread-safe } // Task property in @MainActor class nonisolated(unsafe) private var task: Task<Void, Never>? deinit { task?.cancel() // Safe - Task.cancel() is thread-safe } -
Don't use nonisolated(unsafe) for:
- UI properties (views, layers)
- Mutable state accessed across threads
- Non-thread-safe types
-
Safe to use nonisolated(unsafe) for:
- Timers (invalidate is thread-safe)
- Tasks (cancel is thread-safe)
- Notification observers (removeObserver is thread-safe)
Use this skill when: Actor isolation errors, deinit cannot access properties, concurrent access violations
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?