Skip to content
Skills Library
Programming · Building & coding

solid-swift

/solid-swift

Use when applying SOLID principles to Swift 6/SwiftUI code — file-size limits, protocol separation, @Observable, actors, feature-modular architecture.

Repository
agents ↗
Licence
MIT
Last repository change
12.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
14
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when applying SOLID principles to Swift 6/SwiftUI code — file-size limits, protocol separation, @Observable, actors, feature-modular architecture.

Original author description

Use when applying SOLID principles to Swift 6/SwiftUI code — file-size limits, protocol separation, @Observable, actors, feature-modular architecture.

How it works

  1. Agent Workflow (MANDATORY)
  2. DRY - Reuse Before Creating (MANDATORY)
  3. Architecture (Features Modular MANDATORY)
  4. Critical Rules (MANDATORY)
  5. Reference Guide
  6. Forbidden
Original SKILL.md headings · 99 lines, 588 words
SKILL.md preview
---
name: solid-swift
description: Use when applying SOLID principles to Swift 6/SwiftUI code — file-size limits, protocol separation, @Observable, actors, feature-modular architecture.
versions:
  swift: "6.4"
  ios: "27"
user-invocable: true
references: references/solid-principles.md, references/single-responsibility.md, references/open-closed.md, references/liskov-substitution.md, references/interface-segregation.md, references/dependency-inversion.md, references/concurrency-patterns.md, references/anti-patterns.md, references/templates/view.md, references/templates/viewmodel.md, references/templates/service.md, references/templates/protocol.md, references/templates/model.md
related-skills: swift-core, swiftui-core, ios, macos, ipados, watchos, visionos, tvos
---

<objective>
Enforces SOLID and DRY principles for Swift 6 and SwiftUI (iOS 27+) projects: a mandatory Features/[Feature]/ modular directory structure (never a flat Sources/ layout), one responsibility per file with the hook's ceiling (`FUSE_SOLID_MAX_LINES`) as the only line limit, protocols separated into their own Protocols/ directories, @Observable + @MainActor for ViewModels, Sendable structs for models, and mandatory #Preview on every View.

Covers all five SOLID principles with dedicated references (SRP, OCP, LSP, ISP, DIP), concurrency patterns (actors, @MainActor, Sendable), an anti-pattern catalog, and code templates for views, view models, services, protocols, and models.

Requires grepping the codebase for reusable protocols/services before writing new code, and checking shared locations (Core/Extensions/, Core/Utilities/, Core/Protocols/) before duplicating logic used by 2+ features.
</objective>

# SOLID Swift - Apple Best Practices 2026

## Agent Workflow (MANDATORY)

Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:

1. **fuse-ai-pilot:explore-codebase** - Analyze existing architecture
2. **fuse-ai-pilot:research-expert** - Verify Swift/Apple docs via Apple Docs MCP + Context7
3. **XcodeBuildMCP** - Build validation after code changes. Then run **fuse-ai-pilot:sniper**.

---

## DRY - Reuse Before Creating (MANDATORY)

**Before writing ANY new code:**
1. **Grep the codebase** for similar protocols, services, or logic
2. Check shared locations: `Core/Extensions/`, `Core/Utilities/`, `Core/Protocols/`
3. If similar code exists -> extend/reuse instead of duplicate
4. If code will be used by 2+ features -> create it in `Core/` directly

---

## Architecture (Features Modular MANDATORY)

| Layer | Location |
|-------|----------|
| Views | `Features/[Feature]/Views/` |
| ViewModels | `Features/[Feature]/ViewModels/` |
| Services | `Features/[Feature]/Services/` |
| Protocols | `Features/[Feature]/Protocols/` |
| Shared | `Core/{Models,Protocols,Services,Extensions,Utilities}/` |

File size: the only line limit is the hook ceiling (`FUSE_SOLID_MAX_LINES`). Split by responsibility well before it; if a legitimate fix cannot fit, report it - never bypass the hook.

**NEVER use flat `Sources/` structure - always `Features/[Feature]/`**

---

## Critical Rules (MANDATORY)

| Rule | Value |
|------|-------|
| File limit | Hook ceiling `FUSE_SOLID_MAX_LINES` only; one responsibility per file |
| 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` |

---

## Reference Guide

### Concepts

| Topic | Reference | When to consult |
|-------|-----------|-----------------|
| **SOLID Overview** | [solid-principles.md](references/solid-principles.md) | Quick reference all principles |
| **SRP** | [single-responsibility.md](references/single-responsibility.md) | Fat views/VMs, splitting files |
| **OCP** | [open-closed.md](references/open-closed.md) | Adding providers, extensibility |
| **LSP** | [liskov-substitution.md](references/liskov-substitution.md) | Protocol contracts, testing |
| **ISP** | [interface-segregation.md](references/interface-segregation.md) | Fat protocols, splitting |
| **DIP** | [dependency-inversion.md](references/dependency-inversion.md) | Injection, testing, mocking |
| **Concurrency** | [concurrency-patterns.md](references/concurrency-patterns.md) | Actors, @MainActor, Sendable |
| **Anti-Patterns** | [anti-patterns.md](references/anti-patterns.md) | Code smells detection |

### Templates

| Template | When to use |
|----------|-------------|
| [view.md](references/templates/view.md) | SwiftUI View with subviews and #Preview |
| [viewmodel.md](references/templates/viewmodel.md) | @Observable ViewModel with @MainActor |
| [service.md](references/templates/service.md) | API Service, Mock, Cache actor |
| [protocol.md](references/templates/protocol.md) | Service protocol, CQRS, Auth |
| [model.md](references/templates/model.md) | Model, DTO, Error, Enum |

---

## Forbidden

| Anti-Pattern | Fix |
|--------------|-----|
| File with several responsibilities, or blocked by the hook ceiling | Split by responsibility |
| 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]/` |
Files in this package (14)
  • SKILL.md 5 KB
  • references/anti-patterns.md 4 KB
  • references/concurrency-patterns.md 3 KB
  • references/dependency-inversion.md 4 KB
  • references/interface-segregation.md 4 KB
  • references/liskov-substitution.md 4 KB
  • references/open-closed.md 4 KB
  • references/single-responsibility.md 3 KB
  • references/solid-principles.md 2 KB
  • references/templates/model.md 3 KB
  • references/templates/protocol.md 3 KB
  • references/templates/service.md 3 KB
  • references/templates/view.md 2 KB
  • references/templates/viewmodel.md 3 KB

Versions

The database has no other skills named solid-swift.

Database snapshot: 13.11.2026 · package version a60136bdf80a (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100solid-react
    Use when applying SOLID principles to React architecture — file-size limits, hook separation, src/interfaces/, JSDoc.
  • 100solid-nextjs
    Use when applying SOLID principles to Next.js architecture — modular structure, file size limits, interface separation, JSDoc.
  • 100trove-swift
    Swift 6 and SwiftUI coding conventions for iOS development. Auto-activates when working with Swift files. Covers @Observable, async/await, NavigationStack, Swift Testing, and accessibility. Use when: swift conventions; swiftui view; swift testing.
  • 100swiftui-pro
    Use when writing, reviewing, or refactoring SwiftUI code — covers modern state management (@Observable), NavigationStack, layout, performance, and accessibility for iOS 26 / Swift 6.
  • 100ios-swiftui-architecture-and-state
    Production-grade iOS SwiftUI architecture, state management (@Observable, @State, @Binding, @Environment), Modern Swift Concurrency (async/await, Actors, Task Groups), NavigationStack routing, and Clean Architecture implementation patterns. Use when designing, building, or…
  • 86swift
    Always use when creating and editing Swift files (*.swift)

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.