swift-persistence — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited swift-persistence (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Ask if not already specified:
SwiftData or CoreData?
| SwiftData | CoreData | |
|---|---|---|
| Min iOS | iOS 17+ | iOS 8+ |
| Syntax | @Model macro, Swift-native | NSManagedObject, Objective-C roots |
| Recommended for | New projects on iOS 17+ | Legacy projects, complex migration needs |
Then load the matching reference:
references/swiftdata.mdreferences/coredata.mdAsk: what entities are needed? For each entity:
Task, UserProfile, Transaction)Models go in Core/Models/ — they are plain data types, framework-agnostic where possible.
Persistence infrastructure goes in Services/Storage/:
PersistenceController.swift — container setup, in-memory preview/test variant[Entity]Repository.swift — CRUD operations for each entity[Entity]RepositoryProtocol.swift — protocol for testabilityRule: ViewModels inject a repository protocol. They never touch ModelContext or NSManagedObjectContext directly.
Services/Storage/
├── PersistenceController.swift
├── TaskRepository.swift
└── TaskRepositoryProtocol.swiftAlways define a protocol first so ViewModels can be tested with a mock:
// Services/Storage/TaskRepositoryProtocol.swift
protocol TaskRepositoryProtocol {
func fetchAll() throws -> [Task]
func save(_ task: Task) throws
func delete(_ task: Task) throws
}ViewModels receive the repository via init:
@MainActor
@Observable
final class TaskListViewModel {
private(set) var tasks: [Task] = []
private let repository: TaskRepositoryProtocol
init(repository: TaskRepositoryProtocol = TaskRepository()) {
self.repository = repository
}
func loadTasks() {
tasks = (try? repository.fetchAll()) ?? []
}
}final class MockTaskRepository: TaskRepositoryProtocol {
var stubbedTasks: [Task] = []
var saveCallCount = 0
var deleteCallCount = 0
func fetchAll() throws -> [Task] { stubbedTasks }
func save(_ task: Task) throws { saveCallCount += 1 }
func delete(_ task: Task) throws { deleteCallCount += 1 }
}ModelContext / NSManagedObjectContext is never used in a ViewModel or ViewCore/Models/ have no direct framework import (SwiftData or CoreData) in the ViewModel layerUser says: "Add SwiftData to persist tasks with title, completion status, and due date"
Actions:
references/swiftdata.mdTask model with @ModelPersistenceController with .inMemory preview variantTaskRepository + TaskRepositoryProtocolTaskListViewModel to inject repositoryMockTaskRepository for testsUser says: "I need to add CoreData to my existing UIKit project to cache user profiles"
Actions:
references/coredata.mdUserProfile NSManagedObject subclassPersistenceController with in-memory optionUserProfileRepository + protocolProfileViewModelSwiftData: "Context is not available" — ModelContext is being accessed outside a SwiftData-aware environment. Ensure the ModelContainer is set up at the App level and injected via .modelContainer() modifier. Never create contexts manually in ViewModels.
CoreData: merge conflicts — You are writing on the main context from a background thread. Use performBackgroundTask or a dedicated background context. Always call context.save() on the correct thread.
Tests failing because model can't be found — The in-memory store is not configured. Use PersistenceController.preview (SwiftData) or an in-memory NSPersistentContainer in your test setup.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.