A Swift-only refactoring methodology for AI-generated SwiftUI apps targeting iOS 18 and Swift 6.2+ readiness.
The skill helps an agent analyze and refactor SwiftUI projects by finding duplicate implementations, unused design-system resources, legacy state patterns, inconsistent services, weak concurrency boundaries, SwiftData lifetime issues, App Intents exposure gaps, and other common issues caused by context-fragmented AI coding.
- SwiftUI app architecture and feature boundaries
- iOS 18 compatibility with Swift 6.2+ modern defaults
- Approachable Concurrency, strict concurrency, and default actor isolation audits
- Observation macro state management with
@Observableand@Bindable - SwiftData, Swift Testing, App Intents, Spotlight,
Transferable, and system experiences - Design system reuse: Views, modifiers, styles, assets, colors, typography, spacing
- Xcode and SwiftPM target dependency cleanup
- Incremental, persistent refactoring through
.refactor/ - Unattended task execution that runs until blocked and creates local per-task commits
- SwiftUI first.
- iOS 18 minimum.
- Swift 6 language mode minimum; Swift 6.2+ readiness preferred.
- New code must not introduce
ObservableObject,@Published,@StateObject, or@ObservedObject. - Legacy state patterns are detected and migrated toward Observation macros.
- Domain, Services, DesignSystem, and Infrastructure must not be blindly main-actor isolated.
- Analysis must finish before refactoring begins.
Install this folder as a Codex/Cursor skill, then ask for tasks such as:
Refactor this SwiftUI app using the frontier-modern Swift methodology.
Run the autonomous Swift refactor loop until blocked.
Analyze this iOS 18 Swift 6.2-ready project architecture.
Clean up duplicate SwiftUI views and migrate legacy state to Observation.
Audit SwiftData, Swift Testing, App Intents, and Approachable Concurrency readiness.
Continue refactoring.
Project partition -> Key feature identification -> Architecture analysis
-> Module deep analysis -> Execute refactoring -> Final verification
The skill stores durable state in .refactor/ so later agents can continue from the last checkpoint. During execution it defaults to running until blocked, with separate local commits for task code changes and .refactor/ state updates.
swift-refactor/
├── SKILL.md
├── analysis/
├── patterns/
├── strategies/
└── workspace/
- SKILL.md - main entry point
- Deep Analysis - SwiftUI feature analysis
- Problem Classification - Swift-specific issues
- Refactoring Patterns - standard Swift fixes
- Workspace Spec - persistent
.refactor/format - Autonomous Execution - run-until-blocked task loop and commit protocol
MIT