AgentLint Verified 89/10080 Swift repos analyzed
Swift CLAUDE.md & AGENTS.md Template
SwiftPM targeted tests, strict concurrency, and SwiftLint rules distilled from Swift repos.
# Swift Project — Swift Harness Swift 6 package/app built with SwiftPM, tested with XCTest / Swift Testing, and linted with SwiftLint. ## Commands - Fast test filter: `swift test --filter TargetTests` - Full test suite: `swift test` - Lint: `swiftlint lint --strict` - Build: `swift build` ## Rules - Don't use force-unwraps (`!`) or `try!` outside test files. Instead use `guard let` and typed `throws`. Because unexpected nil values crash macOS/iOS apps instantly. - Don't touch UI state off the main actor. Instead isolate view models with `@MainActor`. Because Swift 6 strict concurrency rejects unsynchronized UI mutations. - When editing entitlements or signing configs, read `docs/release-signing.md`. ## Continuity - Never commit provisioning profiles, API keys, or `CLAUDE.local.md`. Log visual verification evidence in `HANDOFF.md`.
Most Adopted Swift Rules Across Real Open-Source Repos
Measured across 80 public Swift repositories in the 4,533-repo harness study:
swiftuiframework
SwiftUI for UI
49.1%28 repos
unit-teststesting
Write unit tests for all changes
43.9%25 repos
async-await-swiftpatterns
Swift async/await concurrency
35.1%20 repos
mvvmpatterns
MVVM architecture pattern
26.3%15 repos
error-handlingpatterns
Proper error handling with context
24.6%14 repos
spmtooling
Swift Package Manager
22.8%13 repos
conventional-commitsworkflow
Use conventional commit messages
21.1%12 repos
swift-datatooling
SwiftData for persistence
19.3%11 repos
Essential Commands (Checks W1 & W7)
- install
- swift package resolve
- fastTest
- swift test --filter TargetTests
- fullTest
- swift test
- lint
- swiftlint lint --strict
- build
- swift build
Common Swift Agent Pitfalls
- 01Agents use force-unwraps (
!) andtry!in production code paths. - 02Mixing MainActor UI state with background tasks triggers Swift 6 concurrency errors.