Skip to content
cccskills
FreePublished on GitHub

apple-engineer-superpowers

Use when writing Swift code for Apple platforms - iOS, macOS, visionOS. Covers Swift 6 concurrency, actors, Sendable, async/await, SwiftUI, MVVM architecture, Metal GPU programming, RealityKit ECS, visionOS scenes, interpolation/animation, advanced collection types, property wrappers, Combine bridging, error handling, testing, and API design patterns.

The English summary is being prepared. Showing the original description.

See how to install

Files included (14)

  • SKILL.md5.3 KB
  • .claude-plugin/marketplace.json1023 B
  • .claude-plugin/plugin.json574 B
  • .codex/INSTALL.md1.5 KB
  • .cursor-plugin/plugin.json631 B
  • .gitattributes36 B
  • .gitignore19 B
  • advanced-swift-patterns.md27.4 KB
  • LICENSE1.0 KB
  • metal-graphics.md17.3 KB
  • README.md6.7 KB
  • realitykit-visionos.md14.8 KB
  • swift-concurrency.md17.9 KB
  • swiftui-architecture.md11.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Apple Platform Engineering

Comprehensive Swift engineering standards for building production-quality Apple platform applications.

Core Principles

  1. No Force Unwrapping (!) - Use guard let, if let, nil coalescing (??), or optional chaining. Never crash on nil.
  2. Actor-First Concurrency - Use actors as the default for stateful components. Prefer actor isolation over manual locking.
  3. Async/Await Always - Never use completion handlers in new code. Use async throws functions.
  4. Sendable Everything - All shared types must conform to Sendable. All closures crossing concurrency boundaries must be @Sendable.
  5. Swift 6 Strict Concurrency - Enable StrictConcurrency from the start. No data races.
  6. Protocol-Oriented Design - Define contracts through protocols. Use dependency injection for testability.
  7. LocalizedError for Errors - Domain-specific error enums conforming to LocalizedError, Sendable.

Quick Reference

Safe Optional Handling

Instead ofUse
value!guard let value else { return }
string.data(using: .utf8)!string.data(using: .utf8) ?? Data()
url!guard let url = URL(string: s) else { return }
object.property!object.property?.method() or if let prop = object.property { }

Concurrency Primitives

NeedUse
Stateful shared componentactor
Simple value protectionMutex<State>
Low-level syncOSAllocatedUnfairLock
UI state management@MainActor on ViewModels
Progress/events streamAsyncStream / AsyncThrowingStream
Multi-subscriber broadcastAsyncBroadcastChannel or AsyncNotifier

Actor vs @MainActor Decision

ScenarioUse
API service, data operationsactor
ViewModel with @Published@MainActor final class: ObservableObject
Service with @Published properties Views observe@MainActor ObservableObject (rare)
Pure data modelstruct: Sendable

Error Handling Pattern

enum ServiceError: LocalizedError, Sendable {
    case operationFailed(String)

    var errorDescription: String? {
        switch self {
        case .operationFailed(let msg): return "Operation failed: \(msg)"
        }
    }
}

API Design

PatternUse
func work() async throws -> TStandard async operation
func work() -> AsyncThrowingStream<Event, Error>Progress/event reporting
func work(progress: @Sendable (Float) -> Void) async throws -> TSimple progress callback

Metal GPU Quick Reference

NeedUse
Compute pipelineMTLComputePipelineDescriptor + device.makeComputePipelineState
Render pipelineMTLRenderPipelineDescriptor + vertex/fragment functions
Buffer managementMetalBuffer<Element> generic wrapper
Multi-frame pipeliningRing buffer (pool of 3) with tick()
Texture from IOSurfacedevice.makeTexture(descriptor:iosurface:plane:)
Threadgroup sizingmin(elementCount, pipelineState.maxTotalThreadsPerThreadgroup)

RealityKit/visionOS Quick Reference

NeedUse
Custom entity datastruct: Component
Per-frame logicclass: System with scene subscriptions
Show entities in SwiftUIRealityView { content in content.add(entity) }
Observe component changesentity.componentChangePublisher(T.self)
Full immersionImmersiveSpace(id:) { }.immersionStyle(.full)
Multi-windowWindowGroup(id:) with WindowPlacement

Advanced Patterns Quick Reference

NeedUse
Smooth value trackingExponentialDamper<T: Lerpable>
Generic interpolationLerpable protocol with lerp(from:to:blend:)
Non-empty guaranteeNonEmpty<C: Collection>
Enum-keyed storageTable<E: CaseIterable, V>
Multi-consumer asyncAsyncBroadcastChannel with back-pressure
Combine to asyncpublisher.sinkSingleValue() async throws
Custom defaults@DefaultValue<T> property wrapper

Detailed References

  • swift-concurrency.md — Swift 6 concurrency patterns: actors, Sendable, AsyncSequence, task cancellation, synchronization, state machines, reactive patterns, generics, persistence, networking, testing, diagnostics
  • swiftui-architecture.md — SwiftUI app architecture: MVVM, ViewModel/View guidelines, service layer patterns, data flow, App Intents, file organization
  • metal-graphics.md — Metal GPU programming: pipelines, buffers, textures, compute dispatch, ring buffers, shaders, frame pacing
  • realitykit-visionos.md — RealityKit ECS and visionOS: entities, components, systems, scene subscriptions, immersive spaces, windows, hand tracking
  • advanced-swift-patterns.md — Property wrappers, interpolation/animation, collection types, Combine bridging, advanced async abstractions, @dynamicMemberLookup

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Report a problem with this skill