Skip to main content

AI-Assisted Development with Cursor & Bolt

SwiftAI Boilerplate Pro includes comprehensive AI coding assistant configurations for Cursor AI and Bolt AI, enabling you to build faster with consistent, enterprise-grade code quality.
Zero Setup Required - Just open the project in Cursor or Bolt and start coding. The AI automatically follows your architecture patterns!

Why This Matters

AI coding assistants are powerful, but without proper guidance they can generate:
  • ❌ Massive view files (500+ lines)
  • ❌ Hardcoded colors and fonts
  • ❌ Direct dependencies (tight coupling)
  • ❌ Inconsistent architecture patterns
  • ❌ Poor error handling
With our configurations, AI generates:
  • ✅ Views under 400 lines (properly composed)
  • ✅ DesignSystem usage everywhere (DSColors, DSFonts, DSSpacing)
  • ✅ Protocol-based dependencies (fully testable)
  • ✅ Consistent MVVM architecture
  • ✅ Comprehensive error handling

Cursor AI Rules (.cursor/rules/)

Cursor AI automatically reads .mdc (Markdown Code) files to understand your project patterns.

Included Rule Files

core.mdc

Applied to: All Swift files
  • File size limits (max 400 lines)
  • MVVM architecture patterns
  • Swift Package Manager best practices
  • Dependency injection
  • Error handling & logging
  • Swift Concurrency (async/await)
  • Testing requirements

swiftui-views.mdc

Applied to: View files (*View.swift)
  • View composition patterns
  • State management (@State, @StateObject)
  • List optimization (LazyVStack)
  • Navigation patterns
  • Form handling
  • Async operations
  • Accessibility (VoiceOver)

architecture.mdc

Applied to: Repositories, Clients, Packages
  • Modular package boundaries
  • Protocol-based API design
  • Repository pattern
  • Composition root (DI)
  • Domain-specific errors
  • Structured logging
  • Test doubles & mocks

design-system.mdc

Applied to: DesignSystem, AppShell
  • Color system (DSColors tokens)
  • Typography (DSFonts, DSText)
  • Spacing tokens (DSSpacing)
  • Component library usage
  • Loading & error states
  • Theme consistency

How It Works

  1. Open project in Cursor
    open SwiftAIBoilerplatePro.xcodeproj
    
  2. Start coding with AI
    • Cursor automatically reads .cursor/rules/*.mdc files
    • AI follows your architecture patterns
    • No configuration needed!
  3. Get perfect code
    You: "Create a new chat settings view"
    
    Cursor AI generates:
    - Uses DSColors, DSFonts, DSSpacing ✅
    - Protocol-based dependencies ✅
    - Under 400 lines ✅
    - Proper state management ✅
    - Loading & error states ✅
    - Accessibility labels ✅
    

Example Prompts

Prompts that work perfectly:
"Create a new settings view using DesignSystem components"
"Add a profile page with avatar, name, email, and sign-out"
"Build a subscription paywall with three tiers"
"Create a chat message list with bubble style"
AI will automatically:
  • Use DSColors for all colors
  • Use DSFonts/DSText for typography
  • Use DSSpacing for padding/spacing
  • Create proper ViewModels
  • Add loading states
  • Include error handling
Prompts that work perfectly:
"Add a ProfileViewModel with user info and sign-out"
"Create SettingsViewModel with theme switching"
"Build ChatViewModel with message streaming"
AI will automatically:
  • Mark as @MainActor
  • Use @Published for state
  • Inject dependencies via initializer
  • Use protocol types
  • Add comprehensive error handling
  • Include proper logging
Prompts that work perfectly:
"Create a new feature package for Notifications"
"Add a feature package for User Profile"
"Build a package for Image Picker integration"
AI will automatically:
  • Create proper Package.swift
  • Define protocol-based public API
  • Keep implementation internal
  • Add comprehensive tests
  • Follow SPM best practices
Prompts that work perfectly:
"Refactor this to use repository pattern"
"Extract this logic to a separate package"
"Convert this to use DesignSystem components"
"Add dependency injection to this ViewModel"
AI will automatically:
  • Follow established patterns
  • Maintain consistency
  • Update tests
  • Preserve functionality

Bolt AI Chat Modes (.bolt/)

Bolt AI provides 12 specialized AI assistants for different development tasks.

Available Chat Modes

iOS Developer

Shortcut: /dev (default)General iOS/SwiftUI development with MVVM patterns and async/await

Architecture

Shortcut: /archModular design, package boundaries, protocol-based APIs, clean architecture

SwiftUI

Shortcut: /uiView composition, DesignSystem usage, state management, accessibility

Feature Dev

Shortcut: /featureCreating self-contained feature modules with protocol APIs and tests

Integration

Shortcut: /integrationSupabase, RevenueCat, Firebase setup and troubleshooting

Testing

Shortcut: /testUnit tests, mock protocols, test doubles, async testing

Debug

Shortcut: /debugBug diagnosis, crash analysis, memory leaks, performance issues

Performance

Shortcut: /perfMemory management, lazy loading, rendering optimization

Package Dev

Shortcut: /packageSwift Package Manager, API design, dependencies

Deploy

Shortcut: /deployApp Store submission, TestFlight, provisioning, CI/CD

Accessibility

Shortcut: /a11yVoiceOver, Dynamic Type, inclusive design, WCAG compliance

Documentation

Shortcut: /docTechnical writing, API docs, integration guides, tutorials

How to Use Chat Modes

Select a mode using shortcuts:
/ui      # Switch to SwiftUI specialist
/arch    # Switch to architecture advisor
/test    # Switch to testing engineer
/debug   # Switch to debug specialist
Or type the full name:
"Switch to ios-integration mode"
"Use the performance expert mode"
Each mode provides:
  • Specialized context - Only loads relevant files
  • Expert system prompts - Domain-specific knowledge
  • Focused tools - Appropriate capabilities
  • Consistent patterns - Follows project standards

Mode Selection Guide

For new features: Use /dev or /featureFor UI work: Use /uiFor architecture decisions: Use /archFor packages: Use /package

Real-World Example

Let’s see the difference AI configurations make:

Without Configurations ❌

Prompt: “Create a user profile view with avatar and sign-out” AI generates:
struct ProfileView: View {
  @State var user: User?
  
  var body: some View {
    VStack {
      Image(systemName: "person.circle")
        .font(.system(size: 80))
        .foregroundColor(.blue)  // ❌ Hardcoded color
      
      Text(user?.name ?? "")
        .font(.title)  // ❌ Not from DesignSystem
      
      Button("Sign Out") {  // ❌ No error handling
        AuthManager.shared.signOut()  // ❌ Direct dependency
      }
      .padding()
      .background(Color.red)  // ❌ Hardcoded color
    }
  }
}
Problems:
  • ❌ Hardcoded colors
  • ❌ Not using DesignSystem
  • ❌ No ViewModel
  • ❌ Direct dependency on singleton
  • ❌ No error handling
  • ❌ No loading states
  • ❌ Not testable

With Configurations ✅

Same prompt: “Create a user profile view with avatar and sign-out” AI generates:
import SwiftUI
import DesignSystem
import Auth

struct ProfileView: View {
  @StateObject private var viewModel: ProfileViewModel
  
  var body: some View {
    ScrollView {
      VStack(spacing: DSSpacing.large) {
        // Avatar
        Circle()
          .fill(DSColors.brandPrimary)
          .frame(width: 80, height: 80)
          .overlay {
            Text(viewModel.user?.initials ?? "")
              .font(DSFonts.title1)
              .foregroundStyle(DSColors.textOnPrimary)
          }
        
        // User info
        VStack(spacing: DSSpacing.small) {
          DSText(
            viewModel.user?.name ?? "Loading...",
            style: .title2
          )
          
          if let email = viewModel.user?.email {
            DSText(email, style: .body, color: DSColors.textSecondary)
          }
        }
        
        // Sign out button
        DSButton("Sign Out", style: .secondary) {
          Task { await viewModel.signOut() }
        }
        .padding(.top, DSSpacing.large)
      }
      .dsPadding()
    }
    .navigationTitle("Profile")
    .loading(viewModel.isLoading)
    .errorAlert(error: $viewModel.errorMessage)
    .task { await viewModel.load() }
  }
}

@MainActor
final class ProfileViewModel: ObservableObject {
  @Published var user: User?
  @Published var isLoading = false
  @Published var errorMessage: String?
  
  private let authClient: AuthClient
  
  init(authClient: AuthClient) {
    self.authClient = authClient
  }
  
  func load() async {
    isLoading = true
    defer { isLoading = false }
    
    user = await authClient.currentUser()
  }
  
  func signOut() async {
    isLoading = true
    errorMessage = nil
    defer { isLoading = false }
    
    do {
      try await authClient.signOut()
      AppLogger.info("User signed out", category: .auth)
    } catch {
      errorMessage = AppError.from(error).userMessage
      AppLogger.error("Sign out failed: \(error)", category: .auth)
    }
  }
}
Improvements:
  • ✅ Uses DSColors everywhere
  • ✅ Uses DSFonts, DSText, DSSpacing
  • ✅ Uses DSButton component
  • ✅ Proper MVVM with ViewModel
  • ✅ Protocol-based dependency (AuthClient)
  • ✅ Comprehensive error handling
  • ✅ Loading states
  • ✅ Structured logging
  • ✅ @MainActor for UI updates
  • ✅ Async/await
  • ✅ Fully testable
That’s the power of AI configurations! 🚀

Benefits for Your Business

Faster Development

Build features 2-3x faster with AI that understands your architecture

Consistent Quality

Every line of AI-generated code follows your standards

Lower Maintenance

Less technical debt, easier refactoring, better testability

Team Onboarding

New developers immediately productive with AI assistance

Design System

UI consistency enforced automatically across all features

Best Practices

Swift Concurrency, protocols, error handling - all automatic

SEO Keywords

This boilerplate is optimized for discovery around:
  • Cursor AI - AI-powered code editor
  • Cursor Rules - .mdc rule files for Cursor
  • Bolt AI - AI development platform
  • AI-Assisted iOS Development - Build iOS apps with AI
  • SwiftUI AI Code Generation - Generate SwiftUI with AI
  • iOS Boilerplate with AI - Pre-configured for AI assistance
  • Cursor AI Swift - Cursor AI for Swift development
  • Bolt AI iOS - Bolt AI for iOS apps
  • .MDC Files - Markdown Code for AI rules
  • AI Code Quality - Maintain quality with AI

Customization

Modifying Cursor Rules

Edit .mdc files in .cursor/rules/:
---
description: What this rule covers
globs: ["**/*.swift"]
alwaysApply: true
---

# Rule Title

## Section

### ✅ GOOD: Pattern Name
```swift
// Example code

❌ BAD: Anti-pattern

// What to avoid

**Changes take effect immediately** when you save the file.

### Adding Bolt Chat Modes

Edit `.bolt/chat-modes.json`:

```json
{
  "chatModes": {
    "my-mode": {
      "name": "My Mode",
      "description": "What this mode does",
      "systemPrompt": "Instructions for AI",
      "context": ["paths/to/focus/on"],
      "tools": ["codeGeneration", "fileManagement"],
      "model": "claude-3.5-sonnet",
      "temperature": 0.1
    }
  },
  "shortcuts": {
    "mymode": "my-mode"
  }
}

Documentation


Get Started

1

Open in Cursor

Download and install Cursor AI, then open the project
2

Start Coding

Ask Cursor to build features - it automatically follows your rules
3

Use Chat Modes (Optional)

If using Bolt, select specialized modes with /ui, /arch, etc.
4

Customize (Optional)

Edit .cursor/rules/*.mdc to adjust patterns for your needs
No configuration required! The AI rules work automatically when you open the project.

Questions?

Cursor rules work with Cursor AI (free and paid versions).Bolt chat modes work with Bolt.new and similar tools.The configurations are optional but highly recommended for AI-assisted development.
Yes! While optimized for Cursor and Bolt, the patterns documented in .mdc files serve as excellent reference for any AI assistant. You can copy examples to ChatGPT, Claude, or other tools.
No! The rules make AI faster and more accurate. You spend less time fixing AI-generated code because it’s correct the first time.
Absolutely! Edit .cursor/rules/*.mdc files to match your preferences. Changes take effect immediately when you save.
The rules only guide AI code generation. They don’t lint or enforce anything on your manually-written code. Think of them as “AI training documentation.”

Next Steps