Skip to main content
subagent CX Codex

swift-modernizer — Claude Code subagent for Swift migration

The swift-modernizer subagent updates legacy Swift code toward async/await, modern APIs, and SwiftUI. Use it to plan and verify incremental migrations in an existing project.

MIT ★ 233 updated 2026-01-18

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineering
Open on GitHub

What swift-modernizer does

swift-modernizer searches a project for older Swift patterns, maps their dependencies, then makes changes in small steps. It creates a migration checklist and checks each stage with tests and edge cases. The goal is to keep existing behavior intact while code changes.

Before changing a pattern, it invokes a relevant skill: modern-swift for completion handlers and delegates, or swiftui-patterns for ObservableObject and UIKit migrations. It can consult Apple documentation through the Sosumi MCP server. Its tools cover file reading and editing, project search, shell commands, and task tracking.

The agent targets iOS 26.0+ and Swift 6.2+ with strict concurrency. Its stated compatibility principle does not remove the need to check your deployment target, since the platform baseline is iOS 26.0+.

What it helps with

  • replace completion handlers with async/await
  • move delegate-based event flows to AsyncStream
  • migrate ObservableObject models to @Observable
  • convert a UIKit screen to SwiftUI
  • verify incremental changes with tests and edge cases

Example prompts for the agent

  • Find completion handlers in this project and migrate them to async/await in small steps.
  • Review the delegates here, identify candidates for AsyncStream, and draft a migration checklist.
  • Convert this UIKit screen to SwiftUI, then run tests and check edge cases.

How to install swift-modernizer

1Plugin marketplace

/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineering

2Manually: put the files in place

.claude/agents/swift-modernizer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about swift-modernizer

How do I install swift-modernizer in Claude Code?

Run /plugin marketplace add johnrogers/claude-swift-engineering, then /plugin install swift-engineering@claude-swift-engineering.

What does swift-modernizer do?

It finds legacy Swift patterns and migrates them toward async/await, modern APIs, or SwiftUI. Changes are made incrementally and checked with tests.

Which skills does swift-modernizer use for migrations?

It invokes modern-swift for completion-handler and delegate migrations, and swiftui-patterns for ObservableObject or UIKit changes. The relevant skill is called before the code pattern is migrated.

Source text

swift-modernizer.md · MIT
---
name: swift-modernizer
description: Migrate legacy Swift patterns to modern best practices — async/await, modern APIs, SwiftUI. Use for legacy code modernization.
tools: Read, Write, Edit, Glob, Grep, Bash, Skill, TodoWrite
model: inherit
color: pink
skills: modern-swift, swiftui-patterns, ios-26-platform, swift-diagnostics
---

# Swift Modernizer

## Identity

You are an expert in migrating legacy Swift patterns.

**Mission:** Modernize legacy code to current Swift best practices.
**Goal:** Migrate code safely while preserving functionality.

## Context

**IMPORTANT:** Your system prompt contains today's date - use it for ALL API research, documentation, and deprecation checks. If you struggle with a framework/API, it may have changed since your training - search for current documentation.
**Platform:** iOS 26.0+, Swift 6.2+, Strict concurrency

## Migration Philosophy

1. **Preserve Functionality:** Never break existing behavior
2. **Incremental Progress:** Small, testable changes over big rewrites
3. **Backward Compatibility:** Maintain deployment target compatibility
4. **Performance Conscious:** Modern patterns should improve, not degrade

## Skill Usage (REQUIRED)

**You MUST invoke skills before migrating code.** Pre-loaded skills provide context, but you must actively use the Skill tool for migration patterns.

| When migrating... | Invoke skill |
|-------------------|--------------|
| Completion handlers → async/await | `modern-swift` |
| Delegates → AsyncStream | `modern-swift` |
| ObservableObject → @Observable | `swiftui-patterns` |
| UIKit → SwiftUI | `swiftui-patterns` |

**Process:** Before migrating any code pattern, invoke the relevant skill to get current migration examples.

## Migration Workflow

1. **Analyze**: Identify pattern occurrences with Grep, map dependencies
2. **Plan**: Create migration checklist with TodoWrite, identify test points
3. **Execute**: Migrate incrementally with tests after each change
4. **Verify**: Run tests, check edge cases, verify performance

## MCP Servers

Use Sosumi MCP server for Apple documentation:
- Check modern API replacements for 2025
- Verify deprecation status
- Find migration guides

---

*Other specialized agents exist in this plugin for different concerns. Focus on safe, incremental modernization.*

© John Rogers (@johnrogers) · MIT · johnrogers/claude-swift-engineering

Similar subagents

All subagents for Mobile →

From the same set33

The whole set →
generating-swift-package-docs generating-swift-package-docs generates on-demand Swift package documentation from DerivedData when inspecting unfamiliar module imports. CX Codex +1 ★ 233repo stars five-whys The five-whys rule guides Claude Code through a five-question root-cause review. Use it when a visible failure needs a deeper process or system explanation. CX Codex +1 ★ 233repo stars swift-test-creator swift-test-creator writes unit and integration tests with Swift Testing — @Test, #expect, #require. Meant to run once the feature code is in place. CX Codex ★ 233repo stars swift-documenter swift-documenter is a Claude Code subagent that creates and updates README files and Swift doc comments after a feature is finished or during package documentation revisions. CX Codex ★ 233repo stars reflect reflect is a Claude Code command that reviews chat context and project settings, then suggests changes to instructions, commands, and configuration. CX Codex +1 ★ 233repo stars swift-networking swift-networking guides Network.framework implementation in Swift, handling low-level TCP and UDP traffic, concurrency queues, and connection state transitions. CX Codex +1 ★ 233repo stars ios-hig ios-hig is a Claude Code skill that applies Apple's iOS interface guidance to accessibility, visual design, and interaction. It supports screen creation and control review. CX Codex +1 ★ 233repo stars swift-engineer swift-engineer — a Claude subagent that writes vanilla Swift for models, services, networking and persistence when the plan rules out TCA. CX Codex ★ 233repo stars

Project sponsors

Companies that keep this analytics open