swift-refactor

swift-refactor is a skill for Claude Code, Codex from pproenca/dot-skills. It costs 98 tokens per session (2,746 once invoked), scanned A, original, MIT.

A guide for reorganizing Swift and SwiftUI iOS code into a modular MVVM-C structure. MVVM-C separates screens, their state, and navigation, while modules keep parts of an app's code independent.

In plain words
What is it for?
It helps migrate iOS projects, structure Swift packages, define ViewModels and coordinators, and keep data access separate from screens.
Why use it?
It gives refactoring work a fixed set of boundaries and dependency rules for separating app, feature, data, and domain code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps migrate iOS projects, structure Swift packages, define ViewModels and coordinators, and keep data access separate from screens.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pproenca/dot-skills/swift-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add pproenca/dot-skills --skill swift-refactor
Clone the repo
git clone --depth 1 https://github.com/pproenca/dot-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/pproenca/dot-skills/swift-refactor/github.svg)](https://agentmods.dev/skills/pproenca/dot-skills/swift-refactor)
Your own site
<a href="https://agentmods.dev/skills/pproenca/dot-skills/swift-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/swift-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/pproenca/dot-skills/swift-refactor"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/swift-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,746 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00098 $0.02746
Opus 5.5 $0.00039 $0.01098
Sonnet 5.5 $0.00020 $0.00549
Haiku 4.5 $0.00010 $0.00275

Measured 2mo ago against content hash 54076ad9eed9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

swift-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/.experimental/swift-refactor/SKILL.md · 188 lines

How it starts

The opening of the file, as written. The whole thing — 188 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 188 lines

Files

What ships with it

60 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 188 lines · 98 tokens per session scan A 54076ad9eed9

Subscribe to this mod's changes

swift-refactor is a skill published in the GitHub repository pproenca/dot-skills (231 stars, last pushed 3mo ago), licensed MIT. It adds 98 tokens to every session and 2,746 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

swift-refactor compared with skills from other repositories

swift-refactor next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
swift-refactorpproenca/dot-skillsSkill2313mo agoMITA98Claude Code, Codex
kotlin-specialistJeffallan/claude-skillsSkill13ktodayMITA86Claude Code
wear-compose-m3android/skillsSkill11k8d agoApache-2.0A108Claude Code
ink-custom-brush-builderandroid/skillsSkill11k8d agoApache-2.0A159Claude Code
swiftui-devOrkas-AI/OrkasSkill8.1ktodayMITA3Claude Code, Codex
build-android-binarymicrosoft/power-platform-skillsSkill1.2ktodayMITA150Claude Code
kotlin-androidericrisco/rsc-harnessSkill6916d agoMITA78Claude Code, Codex