/ios-skills:swiftui-coding-guidelinefrom ios-skills
SwiftUI coding guidelines covering style, structure, patterns, formatting, and pure-functions methodology. Use when editing or generating SwiftUI code or Swift files containing SwiftUI views, view models, services, or related architecture.
Ships in ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Apply these guidelines when working on SwiftUI code. Prefer minimal, readable, and maintainable changes with explicit, testable state transitions.
Use swift-coding-guideline as the baseline for cross-cutting Swift language/tooling rules (import hygiene, mutation semantics, enum/file rules, naming, and general formatting). This skill defines SwiftUI- and UI-architecture-specific rules on top of that baseline.
ReadMarkdown/Markdown/View, ReadMarkdown/Directory/ControllerReadMarkdown/Shared/Model and ReadMarkdown/Shared/Service.Enum folder for enums.ReadMarkdown
├─ Directory
│ ├─ Controller
│ │ └─ DirectoryController.swift
│ ├─ Dispatcher
│ │ └─ DirectoryDispatcher.swift
│ ├─ Model
│ │ └─ DirectoryItemModel.swift
│ ├─ View
│ │ └─ DirectoryListView.swift
│ ├─ Store
│ │ └─ DirectoryStore.swift
│ └─ ViewModel
│ └─ DirectoryViewModel.swift
├─ Markdown
│ ├─ Controller
│ ├─ Dispatcher
│ ├─ Model
│ ├─ View
│ ├─ Store
│ └─ ViewModel
├─ Utility
│ ├─ View
│ │ └─ SidebarWidthReaderView.swift
│ └─ File
│ ├─ FileWatcherService.swift
│ └─ FileScannerService.swift
└─ Shared
├─ Enum
│ └─ ScanMode.swift
└─ Service
└─ DirectoryPickerService.swift
View (SwiftUI)
body (e.g., private var foo: some View) must live in its own file as a standalone View type instead of a computed property.ViewModel
final class by default; only use class when subclassing is required.swift-coding-guideline for mutation semantics (private(set), no-op mutator wrappers, and accessor/observer constraints).Controller / Dispatcher
Service
Service suffix for consistency (e.g., FileScannerService, DirectoryPickerService).Store
UserDefaults).Controller
Dispatcher
Model
View
ViewModel
Store
UserDefaults).Service
Example
struct DirectoryController {
func makeDirectoryItems(files: [MarkdownFileModel], rootURL: URL?) -> [DirectoryItemModel] {
// Pure transformation of inputs to outputs.
}
}
ObservableObject and @Published require Combine. Import Combine directly in non-view files (view models, stores, services) instead of SwiftUI.final class AppViewModel: ObservableObject {
@Published
private(set) var files: [MarkdownFileModel] = []
private let scanner: FileScannerService
init(scanner: FileScannerService = FileScannerService()) {
self.scanner = scanner
}
func scan(folderURL: URL) {
files = scanner.scan(folderURL: folderURL)
}
}
Binding(get:set:) is always a violation.get reads x and set only writes x = newValue, do not use Binding(get:set:).Binding(get:set:) only when set performs intentional behavior (mapping, validation, or calling explicit mutation methods).Example
Toggle("Enabled", isOn: $viewModel.isEnabled)
Example (avoid pass-through Binding(get:set:))
Toggle(
"Enabled",
isOn: Binding(
get: { viewModel.isEnabled },
set: { viewModel.isEnabled = $0 }
)
)
Example
Toggle("Full scan") {
Binding(
get: { viewModel.scanMode == .full },
set: { viewModel.setScanMode($0 ? .full : .topLevel) }
)
}
Example stub
final class StubFileScannerService {
var files: [MarkdownFileModel] = []
func scan(folderURL: URL) -> [MarkdownFileModel] {
files
}
}
let declarations inside SwiftUI view-building closures for derived values that are reused or improve readability.View types in their own files over computed properties.@EnvironmentObject on a separate line).@Published, @State, @EnvironmentObject). Treat this as a strict formatting rule.Example
@Published
private(set) var scanMode: ScanMode = .full
private let defaults: UserDefaults
Example (blank line between consecutive property wrappers) Bad
@Published
private(set) var fileAvailability: FileAvailability = .available
@Published
private(set) var missingSelectedFile: MarkdownFile?
Good
@Published
private(set) var fileAvailability: FileAvailability = .available
@Published
private(set) var missingSelectedFile: MarkdownFile?
Example
final class AppViewModel: ObservableObject {
@Published
private(set) var files: [MarkdownFileModel] = []
}
Example
@EnvironmentObject
private var settings: SettingsViewModel
Example (prefer computed properties to inline let declarations)
Bad
private var contentView: some View {
let bottomInset = showsTerminal ? terminalHeight + terminalPadding * 2 : 0
return MarkdownViewerView(bottomInset: bottomInset)
}
Good
private var contentView: some View {
MarkdownViewerView(bottomInset: terminalBottomInset)
}
private var terminalBottomInset: CGFloat {
showsTerminal ? terminalHeight + terminalPadding * 2 : 0
}
didSet, global state).What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jordancoin/ios-skills-collection --plugin ios-skills206 skills in this plugin
/aso-appstore-screenshotsGenerate high-converting App Store screenshots by analyzing your app's codebase, discovering core benefits, and creating ASO-optimized screenshot images using Nano Banana Pro./cleanseReview code for readability, then simplify it to be easy to follow and understand. Use this skill when the user wants to simplify code, improve readability, clean up for handoff, make code skimmable, reduce complexity, refactor for clarity, strip boilerplate, prepare code for future maintainers, or make a codebase easier to pick up. Trigger liberally — any request touching readability, simplification, cleanup, or "make this easier to understand" should use this skill. Also trigger when the user says things like "review this", "clean this up", "tidy this", "make this simpler", "reduce complexity", "flatten this", "strip the noise", or "I want to understand this code quickly next time I open it".
/critical-reasoningApply critical rationalist epistemology (Popper, Deutsch) to evaluate reasoning, identify errors, and refine understanding. Use when the user explicitly requests help with reasoning - phrases like "help me think this through", "does this make sense", "any flaws in this", "what am I missing", "critique this", "is this reasoning sound", "stress test this idea", "devil's advocate", or any request to evaluate arguments, identify logical problems, or improve thinking. Also use when errors in reasoning are significant enough to materially affect the user's goals, even if not explicitly requested.Other plugins' skills for the same job