swift-project-setup
Skill4 starsChanged 9 months agoMITView on GitHub
Bootstraps a new Swift/SwiftUI/UIKit project with MVVM architecture, standard folder structure, testing targets, and CLAUDE.md configuration. Use when user says "create a new project", "setup a new app", "start a new iOS project", "scaffold a Swift project", "initialize an Xcode project", or "new SwiftUI app".
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- swift-architecture-auditSkill
- swift-code-reviewSkill
- swift-networkingSkill
- swift-persistenceSkill
- swift-testingSkill
- swiftui-componentSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Ask the user (if not already provided):
- Distinctive: line 27
Ask if not already provided: SwiftUI, UIKit, or Mixed (SwiftUI + UIKit)?
- Distinctive: line 38
Create core protocol files:
- Very specific: line 107
Create .claude/skills/ in the project root.
- Distinctive: line 134
Create placeholder tests to validate the setup compiles:
- Very specific: line 166
Create TaskMateApp.swift, HomeView.swift, HomeViewModel.swift
- Distinctive: line 167
Create CLAUDE.md with filled-in config
- Very specific: line 192
Preview not working: Ensure @Observable is imported from Observation (iOS 17+).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Swift Project Setup
Instructions
Step 1: Gather Requirements
Ask the user (if not already provided):
- Project name and bundle identifier
- Target platforms (iOS, macOS, watchOS, visionOS)
- Minimum iOS version
- UI framework: SwiftUI, UIKit, or both
- Testing mode: enterprise or indie (see
references/inswift-testingskill) - Persistence: None / SwiftData (iOS 17+) / CoreData
- Any SPM dependencies to add upfront
Step 2: Define Folder Structure
Ask if not already provided: SwiftUI, UIKit, or Mixed (SwiftUI + UIKit)?
Then load the matching reference:
- SwiftUI →
references/structure-swiftui.md - UIKit →
references/structure-uikit.md - Mixed →
references/structure-mixed.md
Apply the template exactly. Then consult references/file-naming.md for group naming rules and the "What Never Goes Where" table before placing any file.
Step 3: Generate Architecture Skeleton
Create core protocol files:
// Core/Protocols/ViewModelProtocol.swift
import Foundation
@MainActor
protocol ViewModelProtocol: AnyObject {
func onAppear() async
}// Core/Protocols/RepositoryProtocol.swift
import Foundation
protocol RepositoryProtocol {
associatedtype Model
func fetch() async throws -> [Model]
}Generate a placeholder feature (e.g., Home):
// Features/Home/HomeView.swift
import SwiftUI
struct HomeView: View {
@State private var viewModel = HomeViewModel()
var body: some View {
Text("Hello, \(viewModel.title)")
.task { await viewModel.onAppear() }
}
}
#Preview {
HomeView()
}// Features/Home/HomeViewModel.swift
import Foundation
import Observation
@MainActor
@Observable
final class HomeViewModel {
private(set) var title: String = ""
func onAppear() async {
title = "World"
}
}Step 4: CLAUDE.md Setup
Copy CLAUDE.md from swift-unit-test-instructions into the project root.
Fill in the Project Configuration block:
- Project Name
- Testing Mode (enterprise or indie)
- UI Framework
- Min iOS Version
Step 5: Skills Setup
Create .claude/skills/ in the project root.
Copy the following skills from swift-unit-test-instructions/skills/:
swift-testing/(mandatory)swift-architecture-audit/(recommended)swiftui-component/(if using SwiftUI)swift-networking/(if networking needed)swift-persistence/(if persistence selected)swift-code-review/(recommended)
Also copy .claude/commands/ and .claude/agents/ from swift-unit-test-instructions/ into the project's .claude/ folder.
STOP. Present the plan to the user and wait for confirmation before generating any files.
Plan: [ProjectName]
Structure: [SwiftUI | UIKit | Mixed]
Persistence: [None | SwiftData | CoreData]
Testing: [enterprise | indie]
Files to create:
- [list key files]
Confirm to proceed?Step 6: Initial Testing Files
Create placeholder tests to validate the setup compiles:
// ProjectNameTests/HomeViewModelTests.swift
import Testing
@testable import ProjectName
@MainActor
struct HomeViewModelTests {
@Test func test_when_onAppear_should_setTitle() async {
// Arrange
let sut = HomeViewModel()
// Act
await sut.onAppear()
// Assert
#expect(sut.title == "World")
}
}Examples
Example 1: New SwiftUI app
User says: "Create a new SwiftUI project called TaskMate for iOS 17+"
Actions:
- Confirm: bundle ID, testing mode, any dependencies
- Generate folder structure with explanation
- Create
TaskMateApp.swift,HomeView.swift,HomeViewModel.swift - Create
CLAUDE.mdwith filled-in config - Output next steps checklist
Example 2: UIKit project
User says: "Start a new UIKit project called BankingApp, enterprise testing"
Actions:
- Generate UIKit-oriented structure (SceneDelegate, AppDelegate, Coordinators)
- Create
HomeViewController+HomeViewModel - Set testing mode to enterprise in CLAUDE.md
References
references/structure-swiftui.md— SwiftUI folder structure + test targetsreferences/structure-uikit.md— UIKit folder structure + test targetsreferences/structure-mixed.md— Mixed SwiftUI + UIKit structure + Bridge/ rulesreferences/file-naming.md— file naming good/bad, group naming, "What Never Goes Where"references/gitignore-xcode.md— .gitignore for Xcode/Swift projectsreferences/spm-skeleton.md— Package.swift skeleton for extracting modules
Troubleshooting
Xcode targets not created: The skill generates source files and folder structure, but Xcode targets (Unit Test Target, UI Test Target) must be added manually in Xcode → File → New → Target.
Preview not working: Ensure @Observable is imported from Observation (iOS 17+). For older targets, use ObservableObject + @Published.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

