How to Use Claude Code with Xcode: Start From the CFA App Template
The short answer
Use each tool for what it does best. Xcode creates, builds and runs your iOS app. Claude Code writes and edits the Swift in the same project folder. To make them work well together, start from a project layout Claude Code understands. The free, open-source CFA AI Toolkit gives you both halves: a CFA App template for Xcode's new-project menu, and AI skills that teach Claude Code to keep building in that same structure.
Xcode: File → New → Project → iOS → CFA App
Claude Code: Using CFA, add a new feature to the tab bar.
Xcode: Build, run and try the new feature.
💡 What this article covers
How to split the work between Claude Code and Xcode, how to create a CFA App project in Xcode, what's inside it, how to point Claude Code at it, and what to do if you already have an Xcode project.
Who does what: Claude Code and Xcode
Claude Code is an AI coding tool that works inside your project folder from the Terminal. It can create files, edit them and run commands. Xcode is still where you build the app, run it in the Simulator or on a device, and look through the project in the navigator. You don't have to choose one. Keep Xcode open on the project and run Claude Code in a Terminal window in the same folder.
The hard part is that the two need to agree on where code lives. Without a plan, AI-written code tends to land wherever is quickest. CFA (Cooperative Feature Architecture) fixes that with four numbered folders that you can see in Xcode from the first day, and one path every feature follows:
View → dedicated ViewModel → Feature API → Feature Manager → Repository
You see that layout in Xcode's navigator, and Claude Code follows the same rules from the CFA skills. So when it adds a feature, you know where to look for it.
Step 1: Create the project in Xcode with the CFA App template
The toolkit includes a native Xcode project template. Download or clone the toolkit repository, then double-click Install Xcode Template.command. It doesn't need Node.js. You can also run it from Terminal:
./Install\ Xcode\ Template.command
The installer prints the folder it created. If you don't see "CFA App is installed in Xcode", the install didn't finish, so read the message in the Terminal window before closing it.
Quit and reopen Xcode.
Choose File → New → Project → iOS → CFA App.
Enter your product name and organisation identifier.
The template only creates new projects. It doesn't modify an existing Xcode project. Running the installer again safely updates a template it installed, and it refuses to replace a same-named template from another source.
What's inside the new project
The CFA App is deliberately small, but it's a complete, runnable app, not an empty shell. Its first tab loads the 3DaysOfSwift repositories from GitHub's public API, keeps a JSON file cache, and shows retry and failure states. Its Settings tab saves your choice of colour theme. Here's a shortened map of what Xcode creates:
Application
├── 1 - View
│ ├── Theme
│ └── Views
│ ├── Root (RootTabView + RootTabViewModel)
│ ├── Git Repos (GitReposView + GitReposViewModel)
│ └── Settings (SettingsView + SettingsViewModel)
├── 2 - AppModel
│ ├── AppModel.swift
│ ├── Features
│ │ ├── Git Repos (GitReposManager, Repo)
│ │ └── Settings (SettingsManager, AppColourTheme)
│ └── Networking & Data Storage
│ ├── File Cache
│ ├── Networking
│ └── Protocols
├── 3 - App Resources
└── 4 - Swift Extensions
Notice the pattern. Every screen has its own ViewModel next to it. Every feature has one folder under 2 - AppModel/Features, where its Feature Manager keeps that feature's rules and state. AppModel.swift builds the real managers and data sources in one place. This is the map Claude Code will extend, and it's the map you'll read in Xcode.
Step 2: Give Claude Code the CFA skills
The template gives you the layout. The skills tell Claude Code how to keep it. If you haven't installed them yet, the full walkthrough is in how to build an iOS app with Claude Code using the CFA AI Toolkit. The short version, run from the toolkit folder with Node.js 20 or newer, is:
node scripts/install.mjs --mode skills --skills-directory ~/.claude/skills
That copies the eight CFA skill folders into Claude Code's skills folder and adds a small cfa command to ~/.local/bin. Then, inside your new project folder, you can add CFA guidance for Claude Code and check everything is in place:
cd /path/to/your-new-app
cfa enable-project --host claude
cfa doctor
The first command writes or appends marked CFA guidance to a CLAUDE.md file. It doesn't touch your Swift code. The second confirms the CFA skills are installed and reports whether the project guidance is there. Both steps are optional, but they're a quick way to make sure Claude Code sees CFA in this project.
Step 3: Ask Claude Code for one feature, then run it in Xcode
Open Claude Code in the project folder and describe one feature a user can actually use. Start with "Using CFA" so your intention is clear:
Using CFA, add a Favourites feature to the tab bar.
Let me star a repository and see my starred
repositories in their own tab.
Because this is already a CFA project, the CFA Feature Work skill asks Claude Code to make the smallest complete change. It's written to:
Look at what's already there first: the app target, AppModel, the existing feature owners, the affected screens, storage and tests.
Put the new rules and state in the feature's own Feature Manager, behind a repository boundary.
Give every new SwiftUI View its own ViewModel, so screens stay simple.
Wire the new feature through AppModel, without global singletons or extra manager layers.
Add or update meaningful tests, build the target and run the affected tests.
Then switch to Xcode. Build and run, try the new tab in the Simulator, and check the navigator: the new View and ViewModel should sit together under 1 - View, and the new Feature Manager should have its own folder under 2 - AppModel/Features. If something looks off, tell Claude Code what you saw and ask it to fix it "using CFA". That loop of one feature in Claude Code, then one check in Xcode, keeps every change small enough to review.
Removing a feature works the same way. The skill asks Claude Code to remove the route, View, ViewModel, feature code, tests and Xcode membership together, after searching for every caller.
Already have an Xcode project? Review it first
You don't need the template to use CFA with an app you've already built. Start with a read-only look, so nothing changes until you've seen the findings:
Using CFA, analyse my Xcode project and produce a dashboard.
The CFA Architecture Review skill doesn't edit your app. It reports findings with source locations, and the dashboard it runs locally shows things like where Tasks are created and imported test results. The toolkit is upfront that this can't prove an app has no race conditions, so you still build, test and check the app yourself.
When you're ready to restructure, the CFA Architecture Adoption skill moves an existing modern app into CFA one feature at a time, keeping its behaviour the same and building and checking at each step. It also won't just relabel a flat ContentView as CFA by adding folders. If your app still relies on DispatchQueue and callbacks, the Legacy GCD migration skill handles the move to Swift Concurrency in separate, checked steps.
What to Remember
💡 What to Remember
Let Xcode build and run the app, and let Claude Code write and edit the code in the same folder.
Install the CFA App template, then choose File → New → Project → iOS → CFA App for a runnable starting point.
Install the CFA skills into ~/.claude/skills, and optionally run cfa enable-project --host claude in your project.
Ask for one feature at a time, starting with "Using CFA", then run it in Xcode before asking for the next.
For an existing app, ask for a read-only review before any changes.
Does Claude Code replace Xcode?
No. Claude Code writes and edits the code, but you still need a Mac with Xcode to build the app, run it in the Simulator or on a device, and ship it.
Will the template or skills change my existing projects?
No. The template only creates new projects, and installing the skills only copies instruction folders. The optional cfa enable-project command adds guidance to CLAUDE.md and doesn't change your Swift source.
Is the CFA AI Toolkit free?
Yes. It's open source under the MIT licence, so you can use, change and share it, including in commercial apps.
Related articles
About Us

3 Days of Swift Concurrency is created by Matthew Thomas, an iOS developer building in public since 2022. He publishes the free, MIT-licensed CFA AI Toolkit and reference apps on GitHub. Visit 3DaysOfSwiftConcurrency.com to follow along. The paid training programme is still being built: a soft launch is targeted for 1 December 2026, but that date depends on deadlines being met and isn't guaranteed.




Comments