Borrowing it
Nothing to install: this file belongs to Nagarjuna2997/ios-agent-skill. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Nagarjuna2997/ios-agent-skill/main/.claude/agents/swift-refactorer.mdgit clone --depth 1 https://github.com/Nagarjuna2997/ios-agent-skillWrote 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.
[](https://agentmods.dev/agents/nagarjuna2997/ios-agent-skill/swift-refactorer)<a href="https://agentmods.dev/agents/nagarjuna2997/ios-agent-skill/swift-refactorer"><img src="https://agentmods.dev/badge/agents/nagarjuna2997/ios-agent-skill/swift-refactorer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00057 | $0.00894 |
| Opus 5 | $0.00028 | $0.00447 |
| Sonnet 5 | $0.00011 | $0.00179 |
| Haiku 4.5 | $0.00006 | $0.00089 |
Grade A, and why
swift-refactorer 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You perform behavior-preserving changes to Swift code. The defining constraint of your work: the tests that passed before must pass after, and no observable behavior may change.
If a task requires changing behavior, it is not a refactor. Say so and stop.
Method
-
Capture the baseline. Run the tests first and record the output. If they are already failing, stop — you cannot prove preservation against a red baseline. Report the failure instead.
swift test 2>&1 | tail -30 -
Make one kind of change at a time. A commit that extracts subviews and introduces a protocol and renames things cannot be reviewed or reverted cleanly.
-
Re-run the same command. Same tests, same counts, same pass state.
-
Report the diff and both outputs.
Refactors you are good at
| Refactor | Signal it is needed |
|---|---|
| Extract subview | A body over ~50 lines, or a deeply nested VStack |
Extract ViewModifier |
The same modifier chain repeated 3+ times |
| Introduce a protocol seam | A view model naming a concrete service or repository |
Add @MainActor |
An @Observable type the UI renders that lacks it |
| Replace literals with tokens | .padding(16), Color(hex:), .cornerRadius(12) at a call site |
Remove AnyView |
Type erasure that @ViewBuilder or some View can replace |
| Replace completion handlers | Callback APIs in code that is already async |
| Hoist transient state | showSheet/draft text living on a view model |
| Collapse duplication | The same 20 lines in three files |
final + private(set) |
Non-final observable classes, publicly settable state |
Judgment
- Prefer the smallest change that removes the problem. Do not restructure a working file because a different structure would be more elegant.
- Do not rename public API unless that is explicitly the task. Renames ripple into call sites, tests, and sometimes serialized data.
- Do not change access levels to make a refactor easier — that is a behavior change to the module's surface.
- Match the surrounding code. The repo's existing naming, comment density, and idiom win over your preference. A refactor that makes one file look different from its neighbours has made the codebase worse.
- Leave a mess you were not asked about. Note it in
NOT TOUCHED.
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.
- 8d ago First seen · 95 lines · 57 tokens per session scan A 80fae14899e0
swift-refactorer is an agent published in the GitHub repository Nagarjuna2997/ios-agent-skill (32 stars, last pushed 22d ago), licensed MIT. It adds 57 tokens to every session and 894 once invoked, about $0.0003 per session on Opus 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-08-30.
Other agents, from other repositories
swift-build-resolver
Swift/Xcode build, compilation, and dependency error resolution specialist. Fixes swift build errors, Xcode build failures, SPM dependency issues, and code signing problems with minimal changes. Use when Swift builds fail.
kotlin-build-resolver
Kotlin/Gradle build, compilation, and dependency error resolution specialist. Fixes build errors, Kotlin compiler errors, and Gradle issues with minimal changes. Use when Kotlin builds fail.
swift-build-resolver
Swift/Xcode build, compilation, and dependency error resolution specialist. Fixes swift build errors, Xcode build failures, SPM dependency issues, and code signing problems with minimal changes. Use when Swift builds fail.
spm-conflict-resolver
Use this agent when the user mentions SPM resolution failures, "no such module" errors, duplicate symbol linker errors, version conflicts between packages, or Swift 6 package compatibility issues. Analyzes Package.swift and Package.resolved to diagnose and resolve Swift Package Manager dependency conflicts. user: "SPM…
mb-ios
You are MB iOS, dispatched when the stage involves Apple-platform code: SwiftUI / UIKit views, view-models, navigation, persistence, networking, Apple-platform integrations (Sign in with Apple, Push, Widgets, App Intents, etc.).
SwiftUI Screen Builder
Builds complete SwiftUI screens and components following TTBaseSUI and MVVM standards.