plugins/swift-apple-expert/skills/solid-swift/SKILL.md
SOLID principles for Swift 6 and SwiftUI (iOS 26+). Files < 100 lines, protocols separated, @Observable, actors, Preview-driven development. Features Modular MANDATORY.
npx skillsauth add fusengine/agents solid-swiftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before ANY implementation, use TeamCreate to spawn 3 agents:
Before writing ANY new code:
Core/Extensions/, Core/Utilities/, Core/Protocols/Core/ directly| Layer | Location | Max Lines |
|-------|----------|-----------|
| Views | Features/[Feature]/Views/ | 80 |
| ViewModels | Features/[Feature]/ViewModels/ | 100 |
| Services | Features/[Feature]/Services/ | 100 |
| Protocols | Features/[Feature]/Protocols/ | 30 |
| Shared | Core/{Models,Protocols,Services,Extensions,Utilities}/ | - |
NEVER use flat Sources/ structure - always Features/[Feature]/
| Rule | Value |
|------|-------|
| File limit | 100 lines (split at 90) |
| ViewModels | @MainActor @Observable |
| Protocols | Features/[Feature]/Protocols/ or Core/Protocols/ ONLY |
| Models | Sendable structs |
| Documentation | /// on all public APIs |
| Previews | Every View MUST have #Preview |
| Topic | Reference | When to consult | |-------|-----------|-----------------| | SOLID Overview | solid-principles.md | Quick reference all principles | | SRP | single-responsibility.md | Fat views/VMs, splitting files | | OCP | open-closed.md | Adding providers, extensibility | | LSP | liskov-substitution.md | Protocol contracts, testing | | ISP | interface-segregation.md | Fat protocols, splitting | | DIP | dependency-inversion.md | Injection, testing, mocking | | Concurrency | concurrency-patterns.md | Actors, @MainActor, Sendable | | Anti-Patterns | anti-patterns.md | Code smells detection |
| Template | When to use | |----------|-------------| | view.md | SwiftUI View with subviews and #Preview | | viewmodel.md | @Observable ViewModel with @MainActor | | service.md | API Service, Mock, Cache actor | | protocol.md | Service protocol, CQRS, Auth | | model.md | Model, DTO, Error, Enum |
| Anti-Pattern | Fix |
|--------------|-----|
| Files > 100 lines | Split at 90 |
| Protocols in impl files | Move to Protocols/ directory |
| ObservableObject | Use @Observable |
| Completion handlers | Use async/await |
| Missing #Preview | Add preview for every View |
| Non-Sendable in async | Use struct with let |
| Flat Sources/ structure | Use Features/[Feature]/ |
testing
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.