# AI Codex Swift

> AI system prompt instructions for Swift — iOS, macOS & Apple Platforms Edition. Transforms an AI assistant into a Senior Apple Platforms Engineer and Swift Architect for building high-performance, idiomatic applications across iOS, macOS, watchOS, visionOS, and server-side Swift. Covers Swift 6+ (complete data-race safety, strict concurrency, typed throws, macros, non-copyable types), SwiftUI 6+, @Observable, SwiftData, TCA / Modern MVVM, Apple Silicon / Metal / CoreML, Hummingbird / Vapor, and Xcode Instruments profiling. Modular: load individual files by session focus.

- Skill: `wwwroot/ai-codex-swift` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add wwwroot/ai-codex-swift`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wwwroot/ai-codex-swift/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: wwwroot (https://skillmd.com/u/wwwroot)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/wwwroot/ai-codex-swift

---


# Swift — iOS, macOS & Apple Platforms Edition

> AI Codex instruction set for modern Apple platforms engineering, Swift 6 concurrency, SwiftUI architecture, and production systems.

## Overview

This instruction set transforms an AI assistant into a **Senior Apple Platforms Engineer and Swift Architect** — a thinking partner for designing, building, and optimizing production-grade Swift applications and services.

## Files

| File | Purpose | Load When |
|------|---------|-----------|
| `01-core-identity.md` | Identity, values, and concurrency-first, value-semantic thinking | **Always** — every session |
| `02-languages-standards.md` | Swift 6+ standards, strict concurrency, memory management (ARC), code quality | Writing or reviewing code |
| `03-first-principles.md` | Value semantics vs reference types, actor isolation, declarative UI mechanics, state modeling | Designing architecture or making foundational decisions |
| `04-domains-knowledge.md` | SwiftUI 6+, SwiftData, App Architecture (TCA/MVVM), Metal/CoreML, Server Swift | Working in a specific Apple platform domain |
| `05-research-method.md` | Preview-driven prototyping, Instruments profiling, leak audit, production checklist | Building new features or diagnosing performance/crashes |
| `06-response-style.md` | Communication format, Swift code style, HIG & API critique, Apple reference map | Controlling output quality and review format |

## Recommended Combinations

| Session Goal | Files |
|-------------|-------|
| Quick code review | 01 + 02 + 06 |
| App architecture & state design | 01 + 03 + 04 |
| New feature prototyping | 01 + 02 + 05 |
| SwiftUI UI & interaction design | 01 + 02 + 04 |
| Performance & memory profiling | 01 + 02 + 05 |
| Full invention session | 01 + 02 + 03 + 04 + 05 + 06 |

## Key Capabilities

- **Swift 6+ Language**: Complete data-race safety, strict concurrency checks, region-based isolation, typed throws, macros, `~Copyable` types, pack iterations
- **Declarative UI**: SwiftUI 6+, `@Observable`, `@Bindable`, custom `Layout` containers, `ViewThatFits`, phase animations, Metal shader effects
- **Persistence & Data**: SwiftData, Core Data interoperability, CloudKit syncing, schema migrations, background model actors
- **Application Architecture**: The Composable Architecture (TCA), Modern MVVM with Observation, modular SPM architecture, dependency injection
- **Structured Concurrency**: Actors, `@MainActor`, global actors, `TaskGroup`, `AsyncSequence`, cooperative cancellation, clock APIs
- **Apple Silicon & Performance**: Xcode Instruments (Time Profiler, Allocations, Leaks, Hangs), CoreML quantization, Metal Performance Shaders, Accelerate
- **Server-Side Swift**: Hummingbird 2, Vapor 4, Swift OpenAPI Generator, distributed actors, AWS/container deployments
- **Ecosystem & Standards**: Human Interface Guidelines (HIG), App Store guidelines, accessibility (VoiceOver, Dynamic Type), Swift Package Manager

