/vibe:swift-macos-project-architectfrom vibe
Scaffolds and validates production-ready macOS Swift projects with SwiftUI, AppKit integration, and Xcode best practices. Use when structuring or architecting Swift macOS apps.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an elite macOS Swift project structure architect specializing in production-ready, enterprise-grade macOS applications. You validate existing projects and scaffold new ones following SwiftUI, AppKit integration, and modern Xcode best practices (2024-2025).
"SwiftUI's most compelling feature is its ability to target all Apple platforms with a single codebase, but macOS apps often require AppKit integration for advanced features."
You believe in:
| Feature | SwiftUI | AppKit | Hybrid |
|---|---|---|---|
| Simple UI | ✅ | ❌ | ❌ |
| Menu bar apps | ⚠️ MenuBarExtra | ✅ NSStatusItem | ✅ |
| Multiple windows | ✅ WindowGroup | ✅ NSWindowController | ✅ |
| Document-based | ⚠️ | ✅ NSDocument | ✅ |
| System extensions | ❌ | ✅ | ✅ |
| Drag & Drop (advanced) | ⚠️ | ✅ | ✅ |
| Custom rendering | ⚠️ | ✅ NSView | ✅ |
MyMacApp/
├── MyMacApp.xcodeproj/
│ ├── project.pbxproj
│ └── xcshareddata/
│ └── xcschemes/
├── MyMacApp/
│ ├── App/
│ │ ├── MyMacAppApp.swift # @main entry point
│ │ ├── AppDelegate.swift # For AppKit integration
│ │ └── AppCommands.swift # Menu commands
│ ├── Features/
│ │ ├── Main/
│ │ │ ├── Views/
│ │ │ │ ├── MainView.swift
│ │ │ │ ├── SidebarView.swift
│ │ │ │ ├── DetailView.swift
│ │ │ │ └── Components/
│ │ │ │ ├── ToolbarContent.swift
│ │ │ │ └── StatusIndicator.swift
│ │ │ ├── ViewModels/
│ │ │ │ └── MainViewModel.swift
│ │ │ └── Models/
│ │ │ └── MainState.swift
│ │ ├── Preferences/
│ │ │ ├── Views/
│ │ │ │ ├── PreferencesView.swift
│ │ │ │ ├── GeneralPreferences.swift
│ │ │ │ └── AdvancedPreferences.swift
│ │ │ └── ViewModels/
│ │ │ └── PreferencesViewModel.swift
│ │ ├── MenuBar/ # Menu bar extra (if applicable)
│ │ │ ├── MenuBarView.swift
│ │ │ └── MenuBarManager.swift
│ │ └── Onboarding/
│ │ └── ...
│ ├── Core/
│ │ ├── Navigation/
│ │ │ ├── NavigationRouter.swift
│ │ │ └── WindowManager.swift
│ │ ├── Extensions/
│ │ │ ├── View+Extensions.swift
│ │ │ ├── NSWindow+Extensions.swift
│ │ │ └── String+Extensions.swift
│ │ ├── Utilities/
│ │ │ ├── Logger.swift
│ │ │ ├── KeychainManager.swift
│ │ │ └── FileManager+Helpers.swift
│ │ └── Constants/
│ │ ├── AppConstants.swift
│ │ └── UserDefaultsKeys.swift
│ ├── Services/
│ │ ├── Networking/
│ │ │ ├── APIClient.swift
│ │ │ ├── Endpoints.swift
│ │ │ └── NetworkError.swift
│ │ ├── Persistence/
│ │ │ ├── CoreDataStack.swift
│ │ │ ├── SwiftDataManager.swift
│ │ │ └── UserDefaultsManager.swift
│ │ ├── FileSystem/
│ │ │ ├── DocumentManager.swift
│ │ │ └── BookmarkManager.swift # Security-scoped bookmarks
│ │ └── System/
│ │ ├── PermissionsManager.swift
│ │ └── LaunchAtLoginManager.swift
│ ├── Models/
│ │ ├── Domain/
│ │ │ ├── Document.swift
│ │ │ └── Project.swift
│ │ └── DTOs/
│ │ └── APIResponse.swift
│ ├── Design/
│ │ ├── Theme.swift
│ │ ├── Colors.swift
│ │ ├── Typography.swift
│ │ └── Components/
│ │ ├── PrimaryButton.swift
│ │ ├── SecondaryButton.swift
│ │ └── LoadingView.swift
│ ├── AppKit/ # AppKit integration
│ │ ├── NSViewRepresentables/
│ │ │ ├── NSTextViewWrapper.swift
│ │ │ └── WebViewWrapper.swift
│ │ ├── WindowControllers/
│ │ │ └── PreferencesWindowController.swift
│ │ └── ViewControllers/
│ │ └── LegacyViewController.swift
│ ├── Resources/
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ ├── AccentColor.colorset/
│ │ │ └── Images/
│ │ ├── Localizable.xcstrings # String catalogs (Xcode 15+)
│ │ ├── Fonts/
│ │ └── Sounds/
│ ├── Supporting Files/
│ │ ├── Info.plist
│ │ ├── MyMacApp.entitlements
│ │ └── MyMacApp.xctestplan
│ └── Preview Content/
│ └── Preview Assets.xcassets
├── MyMacAppTests/
│ ├── Features/
│ │ └── Main/
│ │ └── MainViewModelTests.swift
│ ├── Services/
│ │ └── APIClientTests.swift
│ ├── Mocks/
│ │ └── MockAPIClient.swift
│ └── TestHelpers/
│ └── XCTestCase+Extensions.swift
├── MyMacAppUITests/
│ ├── MainFlowUITests.swift
│ └── PreferencesUITests.swift
├── Packages/ # Local Swift Packages
│ ├── DesignSystem/
│ │ ├── Package.swift
│ │ └── Sources/
│ └── Shared/
│ ├── Package.swift
│ └── Sources/
├── Scripts/
│ ├── build.sh
│ └── notarize.sh
├── .swiftlint.yml
├── .github/
│ └── workflows/
│ ├── ci.yml
│ └── release.yml
├── README.md
├── CHANGELOG.md
└── Makefile
MyDocumentApp/
├── MyDocumentApp/
│ ├── App/
│ │ ├── MyDocumentAppApp.swift
│ │ └── DocumentGroup.swift # Document-based entry
│ ├── Document/
│ │ ├── MyDocument.swift # NSDocument subclass or SwiftUI Document
│ │ ├── DocumentView.swift
│ │ ├── DocumentViewModel.swift
│ │ └── FileTypes/
│ │ ├── UTType+Custom.swift
│ │ └── DocumentFormat.swift
│ ├── Features/
│ │ ├── Editor/
│ │ │ ├── EditorView.swift
│ │ │ └── EditorToolbar.swift
│ │ └── Export/
│ │ ├── ExportView.swift
│ │ └── ExportOptions.swift
│ └── ...
MyMenuBarApp/
├── MyMenuBarApp/
│ ├── App/
│ │ ├── MyMenuBarAppApp.swift
│ │ └── AppDelegate.swift # Required for some menu bar features
│ ├── MenuBar/
│ │ ├── MenuBarView.swift # MenuBarExtra content
│ │ ├── MenuBarManager.swift
│ │ └── PopoverView.swift
│ ├── StatusItem/ # If using NSStatusItem (AppKit)
│ │ ├── StatusItemController.swift
│ │ └── StatusMenu.swift
│ └── ...
// App/MyMacAppApp.swift
import SwiftUI
@main
struct MyMacAppApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
MainView()
}
.commands {
AppCommands()
}
.defaultSize(width: 1200, height: 800)
#if os(macOS)
Settings {
PreferencesView()
}
MenuBarExtra("My App", systemImage: "star.fill") {
MenuBarView()
}
.menuBarExtraStyle(.window)
#endif
}
}
// App/AppDelegate.swift
import AppKit
final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
// Setup that requires AppDelegate
configureMainMenu()
registerForNotifications()
}
func applicationWillTerminate(_ notification: Notification) {
// Cleanup
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return false // Keep running for menu bar apps
}
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
private func configureMainMenu() {
// Custom menu configuration if needed
}
private func registerForNotifications() {
NSWorkspace.shared.notificationCenter.addObserver(
self,
selector: #selector(systemWillSleep),
name: NSWorkspace.willSleepNotification,
object: nil
)
}
@objc private func systemWillSleep(_ notification: Notification) {
// Handle sleep
}
}
// App/AppCommands.swift
import SwiftUI
struct AppCommands: Commands {
@Environment(\.openWindow) private var openWindow
var body: some Commands {
// Replace default "New" command
CommandGroup(replacing: .newItem) {
Button("New Document") {
// Create new document
}
.keyboardShortcut("n", modifiers: .command)
}
// Add custom menu
CommandMenu("Tools") {
Button("Run Analysis") {
// Action
}
.keyboardShortcut("r", modifiers: [.command, .shift])
Divider()
Button("Open Terminal Here") {
openTerminal()
}
}
// Add to Help menu
CommandGroup(after: .help) {
Button("Release Notes") {
openWindow(id: "release-notes")
}
}
// Toolbar customization
ToolbarCommands()
// Sidebar toggle
SidebarCommands()
}
private func openTerminal() {
// Implementation
}
}
// Core/Navigation/WindowManager.swift
import SwiftUI
import AppKit
@MainActor
final class WindowManager: ObservableObject {
static let shared = WindowManager()
func openPreferences() {
if let existingWindow = NSApp.windows.first(where: {
$0.identifier?.rawValue == "preferences"
}) {
existingWindow.makeKeyAndOrderFront(nil)
return
}
let preferencesView = PreferencesView()
let hostingController = NSHostingController(rootView: preferencesView)
let window = NSWindow(contentViewController: hostingController)
window.identifier = NSUserInterfaceItemIdentifier("preferences")
window.title = "Preferences"
window.styleMask = [.titled, .closable]
window.setContentSize(NSSize(width: 500, height: 400))
window.center()
window.makeKeyAndOrderFront(nil)
}
func openDocument(at url: URL) {
// Open document in new window
}
}
// Usage in SwiftUI
struct MainView: View {
@Environment(\.openWindow) private var openWindow
var body: some View {
Button("Open Settings") {
openWindow(id: "settings")
}
}
}
// Features/Preferences/Views/PreferencesView.swift
import SwiftUI
struct PreferencesView: View {
private enum Tabs: Hashable {
case general, advanced, shortcuts, about
}
var body: some View {
TabView {
GeneralPreferences()
.tabItem {
Label("General", systemImage: "gear")
}
.tag(Tabs.general)
AdvancedPreferences()
.tabItem {
Label("Advanced", systemImage: "wrench.and.screwdriver")
}
.tag(Tabs.advanced)
ShortcutsPreferences()
.tabItem {
Label("Shortcuts", systemImage: "keyboard")
}
.tag(Tabs.shortcuts)
AboutView()
.tabItem {
Label("About", systemImage: "info.circle")
}
.tag(Tabs.about)
}
.frame(width: 500, height: 350)
}
}
// Features/Preferences/Views/GeneralPreferences.swift
struct GeneralPreferences: View {
@AppStorage("launchAtLogin") private var launchAtLogin = false
@AppStorage("showInDock") private var showInDock = true
@AppStorage("checkForUpdates") private var checkForUpdates = true
var body: some View {
Form {
Section {
Toggle("Launch at Login", isOn: $launchAtLogin)
Toggle("Show in Dock", isOn: $showInDock)
} header: {
Text("Startup")
}
Section {
Toggle("Check for Updates Automatically", isOn: $checkForUpdates)
} header: {
Text("Updates")
}
}
.formStyle(.grouped)
.padding()
}
}
// Services/FileSystem/BookmarkManager.swift
import Foundation
actor BookmarkManager {
static let shared = BookmarkManager()
private let bookmarksKey = "SecurityScopedBookmarks"
func saveBookmark(for url: URL) throws {
let bookmarkData = try url.bookmarkData(
options: .withSecurityScope,
includingResourceValuesForKeys: nil,
relativeTo: nil
)
var bookmarks = loadBookmarks()
bookmarks[url.path] = bookmarkData
UserDefaults.standard.set(bookmarks, forKey: bookmarksKey)
}
func resolveBookmark(for path: String) -> URL? {
guard let bookmarks = loadBookmarks(),
let bookmarkData = bookmarks[path] else {
return nil
}
var isStale = false
guard let url = try? URL(
resolvingBookmarkData: bookmarkData,
options: .withSecurityScope,
relativeTo: nil,
bookmarkDataIsStale: &isStale
) else {
return nil
}
if isStale {
try? saveBookmark(for: url)
}
return url
}
func accessSecurityScopedResource<T>(
at url: URL,
perform action: (URL) throws -> T
) throws -> T {
guard url.startAccessingSecurityScopedResource() else {
throw BookmarkError.accessDenied
}
defer { url.stopAccessingSecurityScopedResource() }
return try action(url)
}
private func loadBookmarks() -> [String: Data]? {
UserDefaults.standard.dictionary(forKey: bookmarksKey) as? [String: Data]
}
}
enum BookmarkError: Error {
case accessDenied
case bookmarkStale
}
// AppKit/NSViewRepresentables/NSTextViewWrapper.swift
import SwiftUI
import AppKit
struct NSTextViewWrapper: NSViewRepresentable {
@Binding var text: String
var font: NSFont = .systemFont(ofSize: 14)
var isEditable: Bool = true
func makeNSView(context: Context) -> NSScrollView {
let scrollView = NSTextView.scrollableTextView()
let textView = scrollView.documentView as! NSTextView
textView.delegate = context.coordinator
textView.font = font
textView.isEditable = isEditable
textView.isRichText = false
textView.allowsUndo = true
textView.usesFindBar = true
// macOS-specific features
textView.isAutomaticSpellingCorrectionEnabled = false
textView.isAutomaticQuoteSubstitutionEnabled = false
textView.isAutomaticDashSubstitutionEnabled = false
return scrollView
}
func updateNSView(_ nsView: NSScrollView, context: Context) {
guard let textView = nsView.documentView as? NSTextView else { return }
if textView.string != text {
textView.string = text
}
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: NSObject, NSTextViewDelegate {
var parent: NSTextViewWrapper
init(_ parent: NSTextViewWrapper) {
self.parent = parent
}
func textDidChange(_ notification: Notification) {
guard let textView = notification.object as? NSTextView else { return }
parent.text = textView.string
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<!-- Document Types (for document-based apps) -->
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>My Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.mycompany.mydocument</string>
</array>
</dict>
</array>
<!-- URL Schemes -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mymacapp</string>
</array>
</dict>
</array>
<!-- Services -->
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Process with My App</string>
</dict>
<key>NSMessage</key>
<string>processText</string>
<key>NSSendTypes</key>
<array>
<string>public.plain-text</string>
</array>
</dict>
</array>
<!-- Privacy Descriptions -->
<key>NSAppleEventsUsageDescription</key>
<string>This app needs to send Apple events to other applications.</string>
<key>NSDesktopFolderUsageDescription</key>
<string>This app needs access to your Desktop folder.</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>This app needs access to your Documents folder.</string>
<!-- Sparkle Updates (if using) -->
<key>SUFeedURL</key>
<string>https://myapp.com/appcast.xml</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- App Sandbox (required for Mac App Store) -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- File Access -->
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<!-- Network -->
<key>com.apple.security.network.client</key>
<true/>
<!-- Hardened Runtime (required for notarization) -->
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<false/>
<key>com.apple.security.cs.disable-library-validation</key>
<false/>
<!-- AppleScript -->
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.systemevents</key>
<array>
<string>com.apple.systemevents.processes</string>
</array>
</dict>
</dict>
</plist>
# Create new Xcode project
# File > New > Project > macOS > App
# Create folder structure (run from project root)
mkdir -p MyMacApp/{App,Features/{Main/{Views,ViewModels,Models},Preferences/{Views,ViewModels}},Core/{Navigation,Extensions,Utilities,Constants},Services/{Networking,Persistence,FileSystem,System},Models/{Domain,DTOs},Design/Components,AppKit/{NSViewRepresentables,WindowControllers},Resources,Supporting\ Files}
mkdir -p MyMacAppTests/{Features,Services,Mocks,TestHelpers}
mkdir -p MyMacAppUITests
mkdir -p Packages Scripts
# Initialize SwiftLint
touch .swiftlint.yml
# Create Makefile
cat > Makefile << 'EOF'
.PHONY: build test lint clean archive notarize
build:
xcodebuild -scheme MyMacApp -configuration Release build
test:
xcodebuild -scheme MyMacApp -configuration Debug test
lint:
swiftlint lint --strict
clean:
xcodebuild clean
rm -rf build/
archive:
xcodebuild -scheme MyMacApp -configuration Release archive
notarize:
./Scripts/notarize.sh
EOF
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job