ios-agent-skill: Agent for Claude Code

.claude/agents/swift-refactorer.md

swift-refactorer is an agent for Claude Code from Nagarjuna2997/ios-agent-skill. It costs 57 tokens per session (894 once invoked), scanned A, original, MIT.

An agent for making mechanical improvements to Swift code without changing what the app does. It can reorganize views, reduce duplication, introduce interfaces, isolate UI code to the main thread, and replace repeated values with design tokens.

In plain words
What is it for?
Use it to extract SwiftUI subviews, simplify repeated code, add protocol boundaries, apply @MainActor to UI-facing types, and replace hard-coded design values while preserving behavior.
Why use it?
Swift code can become difficult to read and test as views and dependencies grow. This keeps refactoring safe by requiring tests to pass before and after the change and stopping when behavior must change.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is Nagarjuna2997/ios-agent-skill's own configuration. It tells Claude Code how to work on ios-agent-skill itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ios-agent-skill configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/Nagarjuna2997/ios-agent-skill/main/.claude/agents/swift-refactorer.md
Clone the repo
git clone --depth 1 https://github.com/Nagarjuna2997/ios-agent-skill

Made for: Claude Code.

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-refactorer

README.md
[![agentmods](https://agentmods.dev/badge/agents/nagarjuna2997/ios-agent-skill/swift-refactorer.svg)](https://agentmods.dev/agents/nagarjuna2997/ios-agent-skill/swift-refactorer)
Your own site
<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>
Per session 57 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 894 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.
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.00057 $0.00894
Opus 5 $0.00028 $0.00447
Sonnet 5 $0.00011 $0.00179
Haiku 4.5 $0.00006 $0.00089

Measured 8d ago against content hash 80fae14899e0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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.

.claude/agents/swift-refactorer.md · 95 lines

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

  1. 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
    
  2. 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.

  3. Re-run the same command. Same tests, same counts, same pass state.

  4. 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.

Read the full file on GitHub · 95 lines

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. 8d ago First seen · 95 lines · 57 tokens per session scan A 80fae14899e0

Subscribe to this mod's changes

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.

Related

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.

Fmarzochi/EGC · 48 tokens

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.

Fmarzochi/EGC · 44 tokens

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.

affaan-m/ECC · 48 tokens

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…

CharlesWiltgen/Axiom · 234 tokens

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.).

fockus/skill-memory-bank · 39 tokens

SwiftUI Screen Builder

Builds complete SwiftUI screens and components following TTBaseSUI and MVVM standards.

tqtuan1201/TTBaseUIKit · 22 tokens