axiom-assume-isolated

Access actor-isolated state synchronously with MainActor.assumeIsolated in Swift.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/pradeepmouli/swift-template --skill axiom-assume-isolated-pradeepmouli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: axiom-assume-isolated
Source: https://github.com/pradeepmouli/swift-template/tree/main/.agents/skills/axiom-assume-isolated
Command: npx skills add https://github.com/pradeepmouli/swift-template --skill axiom-assume-isolated-pradeepmouli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Synchronously access actor-isolated state when you know you are on the correct isolation domain, avoiding asynchronous hops and potential race conditions.

Core Features & Use Cases

  • MainActor.assumeIsolated: Synchronous execution that crashes if misaligned with the actor's executor.
  • Custom Actor assumeIsolated: Generic pattern for safety when protocol callbacks are guaranteed to run on a specific actor.
  • Patterns & Pitfalls: Guidance on testing, legacy delegates, and @preconcurrency shorthands.

Quick Start

Use MainActor.assumeIsolated to synchronously access isolated state in a test or performance-critical context.

Frequently Asked Questions about axiom-assume-isolated

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I synchronously access actor-isolated state in Swift without async hops?

Apply assumeIsolated patterns to synchronously access actor-isolated state when the current isolation domain is guaranteed correct. This avoids asynchronous hops and prevents race conditions by crashing immediately if the context is misaligned.

What does MainActor.assumeIsolated do when the execution context is misaligned?

MainActor.assumeIsolated crashes immediately if the synchronous execution context is misaligned with the actor's executor. It provides safe access to MainActor state when you confidently know the current isolation domain is correct.

When should I use custom actor assumeIsolated patterns in Swift?

Use custom actor assumeIsolated patterns when protocol callbacks or delegate methods are guaranteed to run on a specific custom actor. This allows synchronous state access without async hops while verifying executor alignment.

How do I test MainActor code using assumeIsolated in Swift?

Use MainActor.assumeIsolated to synchronously access isolated state within your test context. It executes MainActor code synchronously without async hops, crashing safely if the test context is misaligned with the MainActor executor.

Can I use @preconcurrency with assumeIsolated for legacy delegate callbacks?

Yes, @preconcurrency shorthand patterns help apply assumeIsolated to legacy delegate callbacks. This allows synchronous access to actor-isolated state when delegate callbacks are guaranteed to run on the correct isolation domain.

What are the limitations of using assumeIsolated for actor isolation?

The primary limitation of assumeIsolated is that it crashes the application if the execution context is misaligned with the actor's executor. It must only be used when the current isolation domain is confidently verified as correct.