guide-swiftui-view-refactor

guide-swiftui-view-refactor is a skill for Claude Code from Prisma-Labs-Dev/apple-skills. It costs 87 tokens per session (1,812 once invoked), scanned A, a copy of swiftui-view-refactor, MIT.

A guide for cleaning up SwiftUI screens, Apple's framework for building app interfaces, by keeping views small, stable, and focused on displaying state.

In plain words
What is it for?
Use it when splitting long SwiftUI views, improving data flow, injecting services, moving business logic out of layouts, or applying SwiftUI Observation correctly.
Why use it?
It helps prevent view files from becoming difficult-to-read mixtures of layout, business rules, dependencies, and side effects.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the apple-skills plugin — 36 skills shipped together

Good fit Use it when splitting long SwiftUI views, improving data flow, injecting services, moving business logic out of layouts, or applying SwiftUI Observation correctly.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/prisma-labs-dev/apple-skills/guide-swiftui-view-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 Prisma-Labs-Dev/apple-skills --skill guide-swiftui-view-refactor
Clone the repo
git clone --depth 1 https://github.com/Prisma-Labs-Dev/apple-skills

Made for: Claude Code.

Or install apple-skills, the plugin that ships this one along with the rest of its 36 skills.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/prisma-labs-dev/apple-skills/guide-swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/prisma-labs-dev/apple-skills/guide-swiftui-view-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,812 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 98% copy Near-identical to another mod 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.00087 $0.01812
Opus 5 $0.00044 $0.00906
Sonnet 5 $0.00017 $0.00362
Haiku 4.5 $0.00009 $0.00181

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

Security

Grade A, and why

guide-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 9d 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.

Origin

This is a copy

98% identical to swiftui-view-refactor — 9 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

disabled-skills/guide-swiftui-view-refactor/SKILL.md · 210 lines

How it starts

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

Guide Skill — This is an expert workflow/pattern guide, not API reference documentation. Originally from Dimillian/Skills by Thomas Ricouard. MIT License.

SwiftUI View Refactor

Overview

Refactor SwiftUI views toward small, explicit, stable view types. Default to vanilla SwiftUI: local state in the view, shared dependencies in the environment, business logic in services/models, and view models only when the request or existing code clearly requires one.

Core Guidelines

1) View ordering (top → bottom)

  • Enforce this ordering unless the existing file has a stronger local convention you must preserve.
  • Environment
  • private/public let
  • @State / other stored properties
  • computed var (non-view)
  • init
  • body
  • computed view builders / other view helpers
  • helper / async functions

2) Default to MV, not MVVM

  • Views should be lightweight state expressions and orchestration points, not containers for business logic.
  • Favor @State, @Environment, @Query, .task, .task(id:), and onChange before reaching for a view model.
  • Inject services and shared models via @Environment; keep domain logic in services/models, not in the view body.
  • Do not introduce a view model just to mirror local view state or wrap environment dependencies.
  • If a screen is getting large, split the UI into subviews before inventing a new view model layer.

3) Strongly prefer dedicated subview types over computed some View helpers

  • Flag body properties that are longer than roughly one screen or contain multiple logical sections.
  • Prefer extracting dedicated View types for non-trivial sections, especially when they have state, async work, branching, or deserve their own preview.
  • Keep computed some View helpers rare and small. Do not build an entire screen out of private var header: some View-style fragments.
  • Pass small, explicit inputs (data, bindings, callbacks) into extracted subviews instead of handing down the entire parent state.
  • If an extracted subview becomes reusable or independently meaningful, move it to its own file.

Read the full file on GitHub · 210 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. 9d ago First seen · 210 lines · 87 tokens per session scan A b9b7aa64776c

Subscribe to this mod's changes

guide-swiftui-view-refactor is a skill published in the GitHub repository Prisma-Labs-Dev/apple-skills (325 stars, last pushed 28d ago), licensed MIT. It adds 87 tokens to every session and 1,812 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. It is 98% identical to swiftui-view-refactor, differing in 9 lines, and is treated as a copy.

Related

Other skills, from other repositories

expo-design-system

Framework (OSS). Build and maintain a design system inside an Expo app - a reusable theme of design tokens (color, spacing, typography, radius, shadow, motion), reusable component structure with variant/size/state prop conventions, and rules for when to extract a repeated view into a shared component. Use when…

expo/skills · 181 tokens

display-glasses-with-jetpack-compose-glimmer

Provides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. This skill covers foundational Glimmer design principles, workflows for implementing Jetpack Compose Glimmer, and interaction models for the glasses form factor. Use this skill to build an…

android/skills · 91 tokens

flutter-build-responsive-layout

Use LayoutBuilder, MediaQuery, or Expanded/Flexible to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet/desktop form factors.

flutter/agent-plugins · 51 tokens

omh-apple-design

This is a Hermes-native apple-design workflow skill.

rlaope/oh-my-hermes · 73 tokens

axiom-audit-liquid-glass

Use when the user mentions Liquid Glass review, iOS 26 UI updates, toolbar improvements, or visual effect migration.

CharlesWiltgen/Axiom · 32 tokens

axiom-audit-ux-flow

Use when the user mentions UX flow issues, dead-end views, dismiss traps, missing empty states, broken user journeys, or wants a UX audit of their iOS app.

CharlesWiltgen/Axiom · 43 tokens