swiftdata-code-review
Reviews SwiftData code for model design, queries, concurrency, and migrations. Use when reviewing .swift files with import SwiftData, @Model, @Query, @ModelActor, or VersionedSchema.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anderskev/swiftdata-code-reviewWhat This Skill Does
The swiftdata-code-review skill is a specialized diagnostic tool designed for developers working with Apple's SwiftData framework. It acts as an automated architectural auditor, analyzing Swift source code for common pitfalls, anti-patterns, and performance bottlenecks associated with persistent data storage. By parsing @Model definitions, @Query implementations, @ModelActor usage, and migration logic, the skill provides actionable feedback based on industry-standard best practices.
Installation
To add this skill to your OpenClaw environment, execute the following command in your terminal:
clawhub install openclaw/skills/skills/anderskev/swiftdata-code-review
Ensure your local environment is configured to access the OpenClaw repository and that you have the necessary permissions to install community-provided skill modules.
Use Cases
- Model Architecture Audit: Use this skill to verify that your data models are configured correctly, specifically checking that relationships are defined on one side only to prevent graph circularity and that delete rules are explicitly defined to prevent unexpected data loss.
- Performance Tuning: Leverage the tool to analyze
@Queryobjects. It helps determine if a fetch request might block the main thread by checking for high-volume data retrieval without proper predicates or batching. - Concurrency Management: Verify that background operations are wrapped in a
@ModelActorand that data transfer between actors usesPersistentIdentifieror DTOs to avoid cross-thread crashes. - Schema Evolution: Ensure that your migration strategy is robust before shipping updates, verifying that your
VersionedSchemaandMigrationPlanare correctly configured to handle evolving data schemas without database corruption.
Example Prompts
- "Review this file: [attached SwiftData model file]. Check for circular relationships and ensure that I have explicitly set the delete rules for all properties."
- "I am running into a performance issue with my persistent store. Can you audit my usage of @Query and predicates to see if they are causing main thread contention?"
- "Here is my MigrationPlan implementation. Does this align with the requirements for moving from schema v1 to v2 without losing user data?"
Tips & Limitations
- Scope: The skill is strictly limited to SwiftData. It will not provide general debugging for UI or networking code unless those components interact directly with the data layer.
- Context is Key: To get the best results, provide the entire file or context regarding the relationship between different models in your schema. Isolated snippets may hide relationship-based bugs.
- Not a Compiler: While this tool identifies logic errors and architectural anti-patterns, it is not a replacement for the Swift compiler. Always verify suggestions in Xcode.
- Safety Note: This tool performs static analysis on your local files. It does not alter your code automatically but provides specific modification suggestions for you to review and implement manually.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anderskev-swiftdata-code-review": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
Related Skills
tutorial-docs
Tutorial patterns for documentation - learning-oriented guides that teach through guided doing
fetch-pr-feedback
Fetch review comments from a PR and evaluate with receive-feedback skill
swift-testing-code-review
Reviews Swift Testing code for proper use of
rust-testing-code-review
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Covers Rust 2024 edition changes including async fn in traits for mocks,
explanation-docs
Explanation documentation patterns for understanding-oriented content - conceptual guides that explain why things work the way they do