swift-code-review
Reviews Swift code for concurrency safety, error handling, memory management, and common mistakes. Use when reviewing .swift files for async/await patterns, actor isolation, Sendable conformance, or general Swift best practices.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anderskev/swift-code-reviewWhat This Skill Does
The swift-code-review skill is a specialized diagnostic tool designed to analyze Swift source code for architectural integrity and runtime safety. It acts as an automated senior peer reviewer, specifically focusing on the complexities of modern Swift. The skill evaluates code against rigorous standards regarding memory management, thread safety, and asynchronous execution. By leveraging a structured checklist and referencing comprehensive documentation, it detects common pitfalls that lead to crashes or undefined behavior, such as retain cycles, improper actor isolation, and unsafe force unwrapping. It provides clear, actionable feedback to ensure your codebase adheres to Apple’s latest paradigms.
Installation
To integrate this skill into your environment, use the OpenClaw CLI tool. Run the following command in your terminal:
clawhub install openclaw/skills/skills/anderskev/swift-code-review
This will download the skill dependencies and add the review capabilities to your active agent session, enabling context-aware analysis for any .swift file you provide.
Use Cases
- Concurrency Audits: Validate the use of
async/await,TaskGroups, andActorisolation to ensure no data races occur across suspension points. - Memory Safety: Automated detection of potential retain cycles in closure-based APIs and ensuring delegate patterns are marked
weak. - Error Handling Refinement: Transforming
try?calls into robustdo-catchblocks withLocalizedErrorimplementations. - Modern Swift Migration: Checking for the correct implementation of
@Observablemacros and proper usage of@Bindablein SwiftUI projects.
Example Prompts
- "Review this View model for potential memory leaks and check if the async network calls are properly using TaskGroup for concurrency."
- "Can you audit this actor implementation to see if it suffers from reentrancy bugs or if the state is correctly protected?"
- "Analyze this file for force unwraps and improve the error handling by adding meaningful localized messages for the UI layer."
Tips & Limitations
To get the best results, always provide the full context of a type or module rather than isolated snippets. While the skill is excellent at identifying logical flaws and unsafe patterns, it should not replace comprehensive unit tests or full integration testing. Note that the skill relies on the provided documentation references; if you are using custom internal libraries, ensure those libraries are documented in the skill’s reference folder for deep analysis. Always treat the suggestions as advice and verify the behavior in your test suite before merging into production.
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-swift-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