Agent skill

Swift Refactor

by pproenca in pproenca/dot-skills

Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).

MITAuto-check passedMobile

Install Swift Refactor

skills CLI
$ npx skills add pproenca/dot-skills --skill swift-refactor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pproenca/dot-skills swift-refactor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pproenca/dot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.experimental/swift-refactor .claude/skills/swift-refactor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
swift-refactor
GitHub stars
215
Token cost
~3k tokens
SKILL.md length
851 words
Files
64 (incl. references, assets)
Skills in repo
41
Repo updated
First seen
Licence
MIT

At a glance

Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).

  • Works in 12 steps: View Identity & Diffing (CRITICAL) → API Modernization (CRITICAL) → State Architecture (CRITICAL) → …
  • Refactoring existing SwiftUI code into the clinic architecture
  • SKILL.md covers Mandated Architecture Stack, Clinic Architecture Contract…, When to Apply and Non-Negotiable Constraints…, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swift Refactor is an agent skill from pproenca/dot-skills. Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout). Enforces @Observable ViewModels/coordinators, App-target DependencyContainer + route shells, Domain repository/coordinator/error-routing protocols, and Data-owned I/O with stale-while-revalidate plus optimistic queued sync boundaries. Use when refactoring existing SwiftUI code into the clinic architecture.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 66 other files, including reference files and assets (for example `assets/templates/_template.md`, `metadata.json` and `references/_sections.md`).

It sits in Mobile, covering iOS development and Refactoring. It works with SwiftUI, Swift and iOS. The repository describes itself as: A collection of AI agent skills following the Agent Skills open format. The licence is MIT.

When your agent uses it

  • Refactoring existing SwiftUI code into the clinic architecture
  • Tasks that involve iOS development
  • Tasks that involve Refactoring

Example prompts

  • “/swift-refactor”

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. View Identity & Diffing (CRITICAL)
  2. API Modernization (CRITICAL)
  3. State Architecture (CRITICAL)
  4. View Composition (HIGH)
  5. Navigation & Coordination (HIGH)
  6. Layer Architecture (HIGH)
  7. Architecture Patterns (HIGH)
  8. Dependency Injection (MEDIUM-HIGH)
  9. Type Safety & Protocols (MEDIUM-HIGH)
  10. List & Collection Performance (MEDIUM)
  11. Async & Data Flow (MEDIUM)
  12. Swift Language Fundamentals (MEDIUM)

What it can do on your machine

Read from SKILL.md and the folder at commit cf93c57. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Swift Refactor loads about 3k tokens when it runs, and up to ~42k if it reads all its reference files. Until then it costs about 115 tokens; SKILL.md has 851 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~42k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pproenca/dot-skills at commit cf93c57, republished under its MIT licence (© pproenca). 851 words, ~3,030 tokens.

Download SKILL.mdSave it as .claude/skills/swift-refactor/SKILL.md (or your agent's skills folder). This skill also uses 63 other files; get the full folder from GitHub.
name
swift-refactor
description
Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout). Enforces @Observable ViewModels/coordinators, App-target `DependencyContainer` + route shells, Domain repository/coordinator/error-routing protocols, and Data-owned I/O with stale-while-revalidate plus optimistic queued sync boundaries. Use when refactoring existing SwiftUI code into the clinic architecture.

Swift/SwiftUI Refactor (Modular MVVM-C)

Comprehensive refactoring guide for migrating Swift/SwiftUI code to modular MVVM-C with local SPM package boundaries and App-target composition root wiring.

Mandated Architecture Stack

┌───────────────────────────────────────────────────────────────┐
│ App target: DependencyContainer, Coordinators, Route Shells   │
├───────────────────────────────────────────────────────────────┤
│ Feature modules: View + ViewModel (Domain + DesignSystem deps)│
├───────────────────────────────────────────────────────────────┤
│ Data package: repositories, remote/local stores, sync, retry  │
├───────────────────────────────────────────────────────────────┤
│ Domain package: models, repository/coordinator/error protocols │
└───────────────────────────────────────────────────────────────┘

Dependency Rule: Feature modules never import Data and never import sibling features.

Clinic Architecture Contract (iOS 26 / Swift 6.2)

All guidance in this skill assumes the clinic modular MVVM-C architecture:

  • Feature modules import Domain + DesignSystem only (never Data, never sibling features)
  • App target is the convergence point and owns DependencyContainer, concrete coordinators, and Route Shell wiring
  • Domain stays pure Swift and defines models plus repository, *Coordinating, ErrorRouting, and AppError contracts
  • Data owns SwiftData/network/sync/retry/background I/O and implements Domain protocols
  • Read/write flow defaults to stale-while-revalidate reads and optimistic queued writes
  • ViewModels call repository protocols directly (no default use-case/interactor layer)

When to Apply

Reference these guidelines when:

  • Migrating from deprecated SwiftUI APIs (ObservableObject, NavigationView, old onChange)
  • Restructuring state management to use @Observable ViewModels
  • Adding @Equatable diffing to views for performance
  • Decomposing large views into 10-node maximum bodies
  • Refactoring navigation to coordinator + route shell pattern
  • Refactoring to Domain/Data/Feature/App package boundaries
  • Setting up dependency injection through DependencyContainer
  • Improving list/collection scroll performance
  • Replacing manual Task management with .task(id:) and cancellable loading

Non-Negotiable Constraints (iOS 26 / Swift 6.2)

  • @Observable ViewModels/coordinators, ObservableObject / @Published never
  • NavigationStack is owned by App-target route shells and coordinators
  • @Equatable macro on every view, AnyView never
  • Domain defines repository/coordinator/error-routing protocols; no framework-coupled I/O
  • No dedicated use-case/interactor layer; ViewModels call repository protocols directly
  • Views never access repositories directly

Rule Categories by Priority

PriorityCategoryImpactPrefixRules
1View Identity & DiffingCRITICALdiff-4
2API ModernizationCRITICALapi-7
3State ArchitectureCRITICALstate-6
4View CompositionHIGHview-7
5Navigation & CoordinationHIGHnav-5
6Layer ArchitectureHIGHlayer-5
7Architecture PatternsHIGHarch-5
8Dependency InjectionMEDIUM-HIGHdi-2
9Type Safety & ProtocolsMEDIUM-HIGHtype-4
10List & Collection PerformanceMEDIUMlist-4
11Async & Data FlowMEDIUMdata-3
12Swift Language FundamentalsMEDIUMswift-8

Quick Reference

1. View Identity & Diffing (CRITICAL)
2. API Modernization (CRITICAL)
3. State Architecture (CRITICAL)
4. View Composition (HIGH)
Show full SKILL.md (346 more words)Show less
5. Navigation & Coordination (HIGH)
6. Layer Architecture (HIGH)
7. Architecture Patterns (HIGH)
8. Dependency Injection (MEDIUM-HIGH)
9. Type Safety & Protocols (MEDIUM-HIGH)
10. List & Collection Performance (MEDIUM)
11. Async & Data Flow (MEDIUM)
12. Swift Language Fundamentals (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules

© pproenca, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 63 other files (references, assets) in skills/.experimental/swift-refactor of pproenca/dot-skills.

  • SKILL.md
  • assets/templates/_template.md
  • metadata.json
  • references/_sections.md
  • references/api-alert-confirmation-dialog.md
  • references/api-environment-object-removal.md
  • references/api-list-foreach-identifiable.md
  • references/api-navigationstack-migration.md
  • references/api-observable-macro.md
  • references/api-onchange-signature.md
  • references/api-toolbar-migration.md
  • references/arch-environment-key-injection.md
  • references/arch-feature-module-extraction.md
  • references/arch-model-view-separation.md
  • references/arch-protocol-dependencies.md
  • references/arch-viewmodel-elimination.md
  • references/data-cancellation.md
  • references/data-error-loadable.md
  • … and 46 more

Open the folder on GitHubat commit cf93c57

Compare with similar skills

Swift Refactor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Swift Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swift Refactor this skillpproenca/dot-skills215—~3kAutomated safety check: PassMIT
View Refactorrobinebers/openusage4.3k—~1.4kAutomated safety check: PassMIT
Swiftui Expert SkillAFK-surf/OpenBridge4302 repos~3.9kAutomated safety check: PassMIT
Swiftui AnimationAstraFoundry/KumoApp290—~4.1kAutomated safety check: PassAGPL-3.0
Snapshot Testsmicrosoft/SwiftStreamingMarkdown378—~2.2kAutomated safety check: PassMIT
Bootstrap iOSRayFernando1337/rayfernando-skills130—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • View Refactor

    robinebers/openusage

    Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and…

    4.3k GitHub stars~1.4k tokensUpdated 2 days ago
    MobileAuto-check passed
  • Swiftui Expert Skill

    AFK-surf/OpenBridge

    Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption.

    430 GitHub starsUsed in 2 repos~3.9k tokens
    MobileAuto-check passed
  • Swiftui Animation

    AstraFoundry/KumoApp

    Implement, review, or improve SwiftUI animations and transitions.

    290 GitHub stars~4.1k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Snapshot Tests

    microsoft/SwiftStreamingMarkdown

    Official

    Record and validate swift-snapshot-testing snapshots in the SwiftStreamingMarkdown package: regenerate reference PNGs, run snapshot tests, and diff failed snapshots.

    378 GitHub stars~2.2k tokensUpdated 13 days ago
    MobileAuto-check passed
  • Bootstrap iOS

    RayFernando1337/rayfernando-skills

    Bootstrap agents for iOS, iPadOS, macOS, Swift, SwiftUI, SwiftData/Core Data, Swift Testing, Xcode build/test/debug, Simulator, App Intents, or XcodeBuildMCP work.

    130 GitHub stars~1.1k tokensUpdated 2 mo ago
    MobileAuto-check passed
  • Swiftui Animation

    dpearson2699/swift-ios-skills

    Implement, diagnose, or review SwiftUI motion using explicit and scoped implicit animations, springs, transitions, PhaseAnimator, KeyframeAnimator, matched geometry or navigation zoom, SF Symbol…

    1.2k GitHub stars~3.9k tokensUpdated 2 mo ago
    MobileAuto-check passed

More from pproenca/dot-skills

All 41 skills in this repo
  • Audio Voice Recovery

    pproenca/dot-skills

    Audio forensics and voice recovery guidelines for CSI-level audio analysis.

    215 GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Codemod React Pipeline

    pproenca/dot-skills

    Guided, scripted pipeline for running JSX/TSX/React codemods safely across large legacy codebases.

    215 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Dev Rfc

    pproenca/dot-skills

    Create well-structured RFCs and technical proposals for software projects.

    215 GitHub stars~3.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Dx Harness

    pproenca/dot-skills

    Developer-experience friction auditing and fixing — slow onboarding, repeated manual setup steps, missing bootstrap/reset/seed scripts, undiscoverable conventions.

    215 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Language Spec Author

    pproenca/dot-skills

    Turn a rough idea for a language into a complete, implementable specification — a DSL, query, config/data, template, or protocol language — by interviewing the author dimension by dimension until…

    215 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Python Pep Author

    pproenca/dot-skills

    Drafting Python Enhancement Proposals (PEPs) — proposing a Python language feature, a standard library change, an interoperability standard, or an informational/process document for the Python…

    215 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Swift Refactor

What does Swift Refactor do?

Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout). Swift Refactor is an agent skill from pproenca/dot-skills.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).

When should I use Swift Refactor?

Swift Refactor fits situations like: refactoring existing SwiftUI code into the clinic architecture; tasks that involve iOS development; tasks that involve Refactoring.

How do I install Swift Refactor in Claude Code?

Run `npx skills add pproenca/dot-skills --skill swift-refactor -a claude-code`. Or copy the skill folder (skills/.experimental/swift-refactor in pproenca/dot-skills) into .claude/skills/swift-refactor in your project. Claude Code loads it when a task matches its description.

How do I install Swift Refactor in Codex?

Run `npx skills add pproenca/dot-skills --skill swift-refactor -a codex`. Or copy the skill folder (skills/.experimental/swift-refactor in pproenca/dot-skills) into .agents/skills/swift-refactor in your project. Codex loads it when a task matches its description.

Can I use Swift Refactor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pproenca/dot-skills --skill swift-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swift-refactor, .gemini/skills/swift-refactor, .github/skills/swift-refactor and .opencode/skills/swift-refactor in your project.

What does Swift Refactor need to run?

SKILL.md names no scripts, command-line tools or credentials: Swift Refactor is instructions for the agent only.

Does Swift Refactor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Swift Refactor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Swift Refactor use?

Swift Refactor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Swift Refactor use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 39k tokens, read only when the agent opens those files.

What are the alternatives to Swift Refactor?

Skills that share tags, products or a category with Swift Refactor: View Refactor (robinebers/openusage, 4.3k stars), Swiftui Expert Skill (AFK-surf/OpenBridge, 430 stars), Swiftui Animation (AstraFoundry/KumoApp, 290 stars) and Snapshot Tests (microsoft/SwiftStreamingMarkdown, 378 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swift Refactor?

pproenca (a GitHub user) maintains it in pproenca/dot-skills, which has 215 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on August 15, 2026.

Source: pproenca/dot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.