CFA Reference: FAQ
Formal CFA AI Toolkit for iOS Documentation · Reference 25 of 26
Short answers to questions developers and AI assistants ask about CFA. Each answer links to the reference page with the full rules.
Definitions
- CFA: Cooperative Feature Architecture.
- Toolkit: The CFA AI Toolkit for iOS repository: skills, templates, starter apps and the Xcode Project Dashboard.
Rules
- Is CFA a library? No. It is a set of rules and plain Swift types. There is no package to import (Reference 1).
- Which AI tools does it work with? Codex through Install.command or node scripts/install.mjs; Claude Code and other tools that read plain skill folders through --mode skills (Reference 9).
- Does the toolkit need Node.js? The skills installer and dashboard need Node.js 20 or newer. The Xcode template installer does not.
- Why is there no protocol for each Feature? Features are concrete. Tests inject a fake repository or provider into the real Feature (change gate rule 7).
- Why not a LoadState enum? Data, loading state and errors are separate values, so cached data stays visible while a refresh runs or fails (rule 8).
- Where does @MainActor go? On every Feature, ViewModel and AppModel, written explicitly (Reference 7).
- How do I stop two refreshes running at once? The Feature shares one retained in-flight task and clears it in defer (Reference 15).
- Where does launch work start? In the app delegate, through AppModel.applicationDidFinishLaunching() (Reference 14).
- SwiftData or a JSON file? A JSON cache for remote snapshots; SwiftData for structured, growing local data (Reference 6).
- What if the database cannot open? The affected feature shows a retryable error; the root UI and other screens stay usable (rule 18).
- Can I upgrade my GCD app one feature at a time? On this site the guidance is to upgrade the whole app in one move and not release a partly upgraded app (Reference 24).
- Does the review skill change my code? No. CFA Architecture Review is read-only.
- Does the dashboard send my code anywhere? It creates a local HTML report.
- Will CFA restyle my existing app? No. In established-product maintenance, design is preserved; themes, footers and branding are new-app defaults only.
- How do I know a change is finished? It passes the change gate and the 20-question review checklist (References 19 and 20).
Decision rules
- When an answer here is not enough, follow its reference number.
- When your question is about a compiler error, go to Reference 18.
- When your question is “why does CFA do this?”, read the matching CFA Explanation.
Example
A one-line answer to “what does a CFA Feature look like?”, in compiled form:
Compiled example (excerpt)
import Foundation
import Observation
// MARK: Settings feature, present in every new CFA app
@MainActor
@Observable
final class SettingsFeature {
private let defaults: UserDefaults
private(set) var prefersCompactList: Bool
init(defaults: UserDefaults) {
self.defaults = defaults
prefersCompactList = defaults.bool(forKey: "prefersCompactList")
}
func updatePrefersCompactList(_ newValue: Bool) {
defaults.set(newValue, forKey: "prefersCompactList")
prefersCompactList = newValue
}
}Compiled with Swift 6 language mode and warnings treated as errors: type-checked on Swift 6.2 and built on Swift 6.4 (Linux toolchains, Foundation and Observation only).
Common mistakes
- Reading an FAQ answer as the whole rule; the linked reference page is authoritative on this site, and the repository is the canonical source.
