coding-best-practices

Reviews macOS Swift 6+ code against SOLID principles, SwiftData patterns, and concurrency best practices.

70|4|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/AlexW00/Zettel --skill coding-best-practices-alexw00
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coding-best-practices
Source: https://github.com/AlexW00/Zettel/tree/main/.agents/skills/macos-development/coding-best-practices
Command: npx skills add https://github.com/AlexW00/Zettel --skill coding-best-practices-alexw00

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing maintainable macOS code requires keeping up with Swift 6 concurrency rules, SwiftData patterns, and architecture principles, and inconsistent code reviews let violations slip through. This Skill provides a structured, checklist-driven review process that catches architecture violations, concurrency bugs, and persistence anti-patterns before they reach production. ## Core Features & Use Cases - Systematic Code Review: Evaluates Swift code against five reference modules covering Swift 6 language idioms, SOLID/DRY principles, SwiftData persistence, code organization, and modern concurrency. - Prioritized Feedback: Categorizes findings as critical (crashes, memory leaks), important (architecture violations), or nice-to-have (style improvements) with concrete fix examples. - Use Case: A developer finishes a SwiftData-backed article feature and asks for a review; the Skill checks actor isolation, @MainActor usage, repository pattern adherence, and model relationships, then returns actionable fixes with code examples. ## Quick Start Ask the assistant to review your Swift file for macOS best practices and concurrency safety.

Frequently Asked Questions about coding-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Swift code for SOLID principle violations?▼

Review each class for single responsibility, check that abstractions use protocols instead of concrete dependencies, and verify subtypes honor their base contracts. This Skill walks through each SOLID principle with good and bad Swift examples and provides prioritized fixes.

How to use async/await and actors correctly in Swift 6?▼

Mark UI code with @MainActor, use actors for mutable shared state, and ensure types crossing concurrency boundaries conform to Sendable. Replace completion handlers with async/await and prefer structured concurrency with task groups over unstructured tasks.

Should I use SwiftData or Core Data for macOS persistence?▼

Use SwiftData for new projects since it offers modern @Model macros, @Query integration with SwiftUI, and simpler migration via VersionedSchema. Core Data remains appropriate for legacy migrations, complex fetched results controllers, or features SwiftData does not yet support.

Does this Skill work with SwiftUI and AppKit code?▼

Yes, the review guidance covers both SwiftUI patterns like @StateObject, @Query, and environment injection, and AppKit patterns like NSViewController separation. It targets macOS 26 development with Swift 6 strict concurrency checking.

What causes retain cycles in Swift closures and how do I fix them?▼

Retain cycles occur when closures strongly capture self while self holds the closure, common in observers and callbacks. Fix them with [weak self] capture lists and guard let self, or use unowned only when the referenced object is guaranteed to outlive the closure.