Build iPhone App with Claude Code: How to Start from the CFA Habit Tracker Template
The short answer
Yes, you can build an iPhone app with Claude Code. The quickest way to get a well-structured one is to not start from an empty folder. The free, open-source CFA AI Toolkit for iOS now includes a Habit Tracker Xcode template: a complete, runnable iPhone app with four tabs, saved data and tests. Create your project from it in Xcode, install the CFA skills into Claude Code, and then ask Claude Code to change the app one feature at a time.
Using CFA, add a new feature to the tab bar but keep it locked under an IAP.
💡 What this article covers
What the Habit Tracker template gives you, how to install it, how to point Claude Code at it, and the paid-feature example that sits beside it. For the smaller starter template, read How to Use Claude Code with Xcode: Start From the CFA App Template.
Why start from a template instead of a blank prompt?
When you ask an AI tool to build a whole app from a single sentence, it has to invent the structure as it goes. Files end up wherever the first answer put them, and every later change has to work around that.
A template fixes the structure before the AI writes anything. The Habit Tracker uses CFA, short for Cooperative Feature Architecture, where every kind of code has one clear home and every screen follows the same path:
View → dedicated ViewModel → Feature API → Feature → Repository
So when Claude Code adds or changes something, it can copy a pattern that already works in your project instead of guessing.
What's inside the Habit Tracker template?
According to the template's README, it's a complete habit app built only with Apple frameworks:
Four tabs: Today, Habits, Day Streak, and Settings on the right.
Two kinds of habit: ones you simply complete, and ones you count towards a target.
Daily streaks: current and longest streaks, completed-day totals and the last seven days of activity.
Saved data: SwiftData storage that opens only when the app first needs it.
Colour themes: seven themes plus Automatic.
Tests: focused Swift Testing suites for every screen's ViewModel and every Feature.
Each tab has its own ViewModel and its own Feature: TodayFeature, HabitsFeature, DayStreakFeature and SettingsFeature. Today and Day Streak both read the same HabitsFeature rather than keeping their own copy of your habits, so the tabs can't drift out of step. That's the kind of decision you want an AI to follow, not reinvent.
The project needs Xcode 26 or later and runs on iOS 18 and newer.
Step 1: Install the Xcode templates
The Habit Tracker template is newer than the toolkit's v0.3.0 release download, which only contains the CFA App template. To get it, clone the toolkit repository or download it from its GitHub page.
Then double-click Install Xcode Template.command in that folder. It doesn't need Node.js. You can also run it from Terminal:
./Install\ Xcode\ Template.command
It installs both the CFA App and Habit Tracker templates, and prints the folder it created. If you don't see "CFA App is installed in Xcode", read the message in Terminal before closing it, because the install didn't finish. Running it again later updates templates it installed and keeps backup copies.
Step 2: Create your app in Xcode
Quit and reopen Xcode, then choose File → New → Project → iOS → Habit Tracker. Enter your product name and organisation identifier, and Xcode creates a new project with the CFA folders already in place.
Choose an iPhone simulator and press Run before you change anything. Then try Product → Test, so you know the starting point builds and passes. If you'd rather look around first, the same app is in the repository as a ready-to-open project in templates/Xcode/Habit Tracker iOS.
Step 3: Give Claude Code the CFA skills
The template gives Claude Code a good structure to copy. The skills tell it the rules behind that structure. Install the eight portable skill folders into Claude Code's skills folder from the toolkit folder you downloaded:
node scripts/install.mjs --mode skills --skills-directory ~/.claude/skills
That needs Node.js 20 or newer. You can also copy the eight folders from the skills folder by hand, without renaming them. Start a new Claude Code conversation and ask whether it has access to create and maintain iOS projects with CFA.
The cfa Terminal command, which includes cfa doctor for checking the setup, comes with the Codex plugin install and the installer script. If you copied the skill folders by hand, it may be missing, and the skills still work without it. Claude Code iOS App Skills: How to Install the CFA Skills and Keep Them in CLAUDE.md walks through this step in detail.
Step 4: Ask for one change at a time
Open Claude Code in your new project's folder. Start each request with "Using CFA" so your intention is clear. The toolkit's README suggests prompts like these:
Using CFA, add a new feature to the tab bar but keep it locked under an IAP.
Using CFA, now that we added a new feature, tidy up the code.
Using CFA, make sure each exposed feature is unit tested, for all features.
After each change, build and run the app in Xcode yourself and run the tests. The CFA AI Toolkit gives Claude Code a blueprint to follow; it doesn't replace your own review. For adding and removing features cleanly, see Using Claude Code to Build an iOS App: How to Add and Remove Features Cleanly.
What does a paid feature look like? Habit Tracker Pro
The repository also contains Habit Tracker Pro, a separate example that adds a Trends tab with Swift Charts behind a one-time StoreKit unlock. It's not a template yet: you open it as a ready-to-open project in Xcode 26.2 or later, and the toolkit's template installer doesn't install it.
It's useful as a reference for what "locked under an IAP" means in CFA. A PurchasesFeature owns who has access, the Trends tab gets its own TrendsFeature that checks access before showing paid charts, and the free tabs keep working even if products fail to load. Local StoreKit testing uses simulated money, not a real App Store charge, and you'd still need your own App Store Connect product before release.
What to Remember
💡 What to Remember
Start from the Habit Tracker template instead of a blank prompt, so Claude Code has a working structure to copy.
Get it by cloning or downloading the repository, then run Install Xcode Template.command and restart Xcode.
Build, run and test the new project before asking for changes.
Install the eight CFA skills into Claude Code and start prompts with "Using CFA". The cfa command may be missing if you copied the folders by hand.
Ask for one feature at a time, and check every change in Xcode yourself.
Can you build an iPhone app with Claude Code if you're new to Swift?
You can start, but you'll still need Xcode on a Mac to build, run and test what Claude Code writes. A template helps because the app already works and every file has an obvious place.
Does the Habit Tracker template need any third-party libraries?
No. Its README says it uses only Apple frameworks, with SwiftData for storage.
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 for iOS 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