swiftui-view-refactor

swiftui-view-refactor is a skill for Claude Code, Codex from steipete/agent-scripts. It costs 23 tokens per session (1,069 once invoked), scanned A, original, MIT.

A guide for reviewing and reorganising SwiftUI views, Apple's framework for building app interfaces in Swift. It recommends keeping views focused on displaying state and placing business logic in models or services, with shared dependencies supplied through the environment.

In plain words
What is it for?
Use it when refactoring SwiftUI layouts, splitting oversized views, deciding whether a view model is needed, or correcting state and dependency-injection patterns.
Why use it?
It gives a consistent structure for view files and helps prevent large views from becoming difficult to read, test, or maintain. It also explains how to handle state and dependencies safely.

Skill for Claude CodeCodex

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

Good fit Use it when refactoring SwiftUI layouts, splitting oversized views, deciding whether a view model is needed, or correcting state and dependency-injection patterns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/steipete/agent-scripts/swiftui-view-refactor
About the project

Agent Scripts is a repository of shared instructions, reusable skills, helper scripts, and local safeguards for coding-agent workflows across multiple workspaces. It is for maintaining common agent behavior and portable development utilities between repositories.

steipete/agent-scripts · 7,574 stars · on GitHub · steipete.me

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 steipete/agent-scripts --skill swiftui-view-refactor
Clone the repo
git clone --depth 1 https://github.com/steipete/agent-scripts

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 swiftui-view-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/steipete/agent-scripts/swiftui-view-refactor/github.svg)](https://agentmods.dev/skills/steipete/agent-scripts/swiftui-view-refactor)
Your own site
<a href="https://agentmods.dev/skills/steipete/agent-scripts/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/steipete/agent-scripts/swiftui-view-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 swiftui-view-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/steipete/agent-scripts/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/steipete/agent-scripts/swiftui-view-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,069 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.00023 $0.01069
Opus 5.5 $0.00009 $0.00428
Sonnet 5.5 $0.00005 $0.00214
Haiku 4.5 $0.00002 $0.00107

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

Security

Grade A, and why

swiftui-view-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 3mo 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/swiftui-view-refactor/SKILL.md · 135 lines

How it starts

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

SwiftUI View Refactor

Attribution: copied from @Dimillian’s Dimillian/Skills (2025-12-31).

Overview

Apply a consistent structure and dependency pattern to SwiftUI views, with a focus on ordering, Model-View (MV) patterns, careful view model handling, and correct Observation usage.

Core Guidelines

1) View ordering (top → bottom)

  • Environment
  • private/public let
  • @State / other stored properties
  • computed var (non-view)
  • init
  • body
  • computed view builders / other view helpers
  • helper / async functions

2) Prefer MV (Model-View) patterns

  • Default to MV: Views are lightweight state expressions; models/services own business logic.
  • Favor @State, @Environment, @Query, and task/onChange for orchestration.
  • Inject services and shared models via @Environment; keep views small and composable.
  • Split large views into subviews rather than introducing a view model.

3) Split large bodies and view properties

  • If body grows beyond a screen or has multiple logical sections, split it into smaller subviews.
  • Extract large computed view properties (var header: some View { ... }) into dedicated View types when they carry state or complex branching.
  • It's fine to keep related subviews as computed view properties in the same file; extract to a standalone View struct only when it structurally makes sense or when reuse is intended.
  • Prefer passing small inputs (data, bindings, callbacks) over reusing the entire parent view state.

Example (extracting a section):

var body: some View {
    VStack(alignment: .leading, spacing: 16) {
        HeaderSection(title: title, isPinned: isPinned)
        DetailsSection(details: details)
        ActionsSection(onSave: onSave, onCancel: onCancel)
    }
}

Example (long body → shorter body + computed views in the same file):

var body: some View {
    List {
        header
        filters
        results
        footer
    }
}

private var header: some View {
    VStack(alignment: .leading, spacing: 6) {
        Text(title).font(.title2)
        Text(subtitle).font(.subheadline)
    }
}

private var filters: some View {
    ScrollView(.horizontal, showsIndicators: false) {
        HStack {
            ForEach(filterOptions, id: \.self) { option in
                FilterChip(option: option, isSelected: option == selectedFilter)
                    .onTapGesture { selectedFilter = option }
            }
        }
    }
}

Read the full file on GitHub · 135 lines

Files

What ships with it

1 file 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. 3mo ago First seen · 135 lines · 23 tokens per session scan A 547d62229ae1

Subscribe to this mod's changes

swiftui-view-refactor is a skill published in the GitHub repository steipete/agent-scripts (7,574 stars, last pushed 2d ago), licensed MIT. It adds 23 tokens to every session and 1,069 once invoked, about $0.0001 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-08-30.

Related

swiftui-view-refactor compared with skills from other repositories

swiftui-view-refactor next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
swiftui-view-refactorsteipete/agent-scriptsSkill7.6k2d agoMITA23Claude Code, Codex
orca-emulator-androidstablyai/orcaSkill145ktodayMITA102Claude Code, Codex
glance-canonical-layoutsandroid/skillsSkill11k7d agoApache-2.0A56Claude Code
android-tombstone-symbolicationdotnet/skillsSkill6.4ktodayMITA176Claude Code
dogfoodcallstack/agent-deviceSkill5.6ktodayMITA55Claude Code
winapp-mauimicrosoft/winappCliSkill1.4ktodayMITA68Claude Code
flutter-devMiniMax-AI/skillsSkill14k19d agoMITA83Claude Code