core-data-expert

Warn

Audited by Runlayer on Feb 22, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
78%
Files
16
Flagged
16
Chunks
25
Flagged Files (16)
SKILL.mdHIGH
78.3%

Malicious tool definition detected

Tool: SKILL.md Description: --- name: core-data-expert description: 'Expert Core Data guidance (iOS/macOS): stack setup, fetch requests & NSFetchedResultsController, saving/merge conflicts, threading & Swift Concurrency, batch operations & persistent history, migrations, performance, and NSPersistentCloudKitContainer/CloudKit sync.' --- # Core Data Expert Fast, production-oriented guidance for building **correct**, **performant** Core Data stacks and fixing common crashes. ## Agent behavior cont

references/_index.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/_index.md Description: # Reference Index Quick navigation for Core Data topics.

references/batch-operations.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/batch-operations.md [1/2] Description: # Batch Operations Batch operations provide significant performance improvements for large-scale data modifications.

Tool: references/batch-operations.md [2/2] Description: container: NSPersistentContainer init(container: NSPersistentContainer) { self.container = container } func importArticles(_ data: [ArticleData]) { let context = container.newBackgroundContext() context.perform { var index = 0 let batchInsert = NSBatchInsertRequest( entity: Article.entity() ) { (object: NSManagedObject) -> Bool in guard index < data.count else { return true } guard let article = object as?

references/cloudkit-integration.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/cloudkit-integration.md Description: # CloudKit Integration `NSPersistentCloudKitContainer` syncs Core Data with CloudKit, enabling seamless data synchronization across devices. ## Setup ### Basic Setup ```swift import CoreData import CloudKit let container = NSPersistentCloudKitContainer(name: "Model") container.loadPersistentStores { description, error in if let error = error { fatalError("Failed to load store: \(error)") } } ``` ### Configure CloudKit Container In Xcode: 1.

references/concurrency.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/concurrency.md [1/2] Description: # Core Data and Swift Concurrency Thread-safe patterns for using Core Data with Swift Concurrency.

Tool: references/concurrency.md [2/2] Description: Scene { WindowGroup { ContentView() .environment(\.managedObjectContext, persistentContainer.viewContext) } } } ``` ### View usage ```swift struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Article.timestamp, ascending: true)] ) private var articles: FetchedResults<Article> var body: some View { List(articles) { article in Text(article.title ?? "")

references/fetch-requests.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/fetch-requests.md [1/2] Description: # Fetch Requests and Querying Optimizing fetch requests is crucial for app performance.

Tool: references/fetch-requests.md [2/2] Description: print("Total views: \(totalViews)") } ``` ### Group By with Aggregates ```swift let fetchRequest = Article.fetchRequest() fetchRequest.resultType = .dictionaryResultType // Category name let categoryExpression = NSExpression(forKeyPath: "category.name") let categoryDescription = NSExpressionDescription() categoryDescription.name = "categoryName" categoryDescription.expression = categoryExpression categoryDescription.expressionResultType = .st

references/glossary.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/glossary.md Description: # Core Data Glossary Quick reference for Core Data terminology. ## Core Concepts **Core Data** Apple's framework for object graph management and persistence. **Persistent Store** The underlying storage (typically SQLite database) where data is saved. **Managed Object Model** Describes your data schema (entities, attributes, relationships). **Entity** A class definition in your data model (like a database table).

references/migration.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/migration.md [1/2] Description: # Schema Migration Schema migration is the process of updating your Core Data model as your app evolves. Core Data provides three migration strategies: lightweight, staged (iOS 17+), and deferred (iOS 14+).

Tool: references/migration.md [2/2] Description: large datasets 8.

references/model-configuration.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/model-configuration.md [1/2] Description: # Model Configuration Core Data's data model offers powerful configuration options beyond basic attributes and relationships. This guide covers constraints, derived attributes, transformables, validation, and lifecycle events.

Tool: references/model-configuration.md [2/2] Description: !name.isEmpty else { throw NSError( domain: "ArticleValidation", code: 1000, userInfo: [NSLocalizedDescriptionKey: "Name cannot be empty"] ) } } } ``` ### Handling Validation Errors ```swift do { try context.save() } catch let error as NSError { if error.domain == NSCocoaErrorDomain { switch error.code { case NSValidationStringTooShortError: print("String too short") case NSValidationStringTooLongError: print("String too long") case NSMa

references/performance.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/performance.md Description: # Performance Optimization Optimizing Core Data performance requires understanding where bottlenecks occur and applying targeted solutions. ## Profiling with Instruments ### Time Profiler 1.

references/persistent-history.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/persistent-history.md [1/2] Description: # Persistent History Tracking Persistent history tracking enables Core Data to track changes across contexts, app extensions, and batch operations.

Tool: references/persistent-history.md [2/2] Description: this matters:** - Filter out your own transactions (avoid redundant merges) - Identify which target made changes - Debug multi-target issues ## Filtering Transactions ### By Author ```swift let fetchRequest = NSPersistentHistoryChangeRequest.fetchHistory(after: lastToken) if let request = fetchRequest.fetchRequest { request.predicate = NSPredicate(format: "author != %@", "MainApp") } ``` ### By Date ```swift let cutoffDate = Calendar.curr

references/project-audit.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/project-audit.md Description: # Project Audit (Core Data) Use this checklist to quickly discover how a project uses Core Data and which constraints apply (platform availability, CloudKit, history tracking, etc.).

references/saving.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/saving.md [1/2] Description: # Saving in Core Data Saving data efficiently is crucial for app performance and user experience.

Tool: references/saving.md [2/2] Description: every 100 objects to avoid memory buildup if index % 100 == 0 && context.hasChanges { try?

references/stack-setup.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/stack-setup.md [1/2] Description: # Core Data Stack Setup Setting up your Core Data stack correctly is foundational to a well-architected app.

Tool: references/stack-setup.md [2/2] Description: } // Usage in async context func setupCoreData() async throws { let container = NSPersistentContainer(name: "Model") try await container.loadPersistentStores() // Stores are guaranteed loaded here } ``` **Benefits:** - Cleaner async/await syntax - Better error handling with try/catch - Easier to compose with other async operations - Explicit about async nature **When to use:** - iOS 15+ deployment target - Modern Swift concurrency codebase - Whe

references/testing.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/testing.md Description: # Testing Core Data Testing Core Data requires special setup to avoid conflicts and ensure fast, reliable tests.

references/threading.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/threading.md [1/2] Description: # Threading and Concurrency Core Data threading rules are strict but essential for data integrity. This guide covers safe multi-threading patterns, common pitfalls, and debugging techniques.

Tool: references/threading.md [2/2] Description: ) @objc func contextDidSave(_ notification: Notification) { viewContext.perform { viewContext.mergeChanges(fromContextDidSave: notification) } } ``` ## Async/Await with Core Data (iOS 15+) ### Using async/await ```swift func fetchArticles() async throws -> [Article] { let context = container.newBackgroundContext() return try await context.perform { let fetchRequest = Article.fetchRequest() return try context.fetch(fetchRequest) } } // Usage Task {

Audit Metadata
Max File Score
78%
Classification
UNKNOWN_SERVER
Files Scanned
16
Files Flagged
16
Chunks Analyzed
25
Analyzed
Feb 22, 2026, 08:27 AM
Security Audit — runlayer — core-data-expert