swiftui-view-refactor

swiftui-view-refactor is a skill for Claude Code, Codex from beel-collab/presets.dev. It costs 15 tokens per session (1,810 once invoked), scanned A, a copy of swiftui-view-refactor, MIT.

A guide to splitting large SwiftUI views into smaller view components with clear data flow. SwiftUI is Apple’s code-based framework for building app interfaces.

In plain words
What is it for?
Use it when cleaning up a large SwiftUI view, extracting subviews, injecting shared services, or improving how view data is passed around.
Why use it?
It reduces oversized view files and makes state, dependencies, and business logic easier to understand and maintain.

Skill for Claude CodeCodex

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

Good fit Use it when cleaning up a large SwiftUI view, extracting subviews, injecting shared services, or improving how view data is passed around.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/beel-collab/presets.dev/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 beel-collab/presets.dev --skill swiftui-view-refactor
Clone the repo
git clone --depth 1 https://github.com/beel-collab/presets.dev

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/beel-collab/presets.dev/swiftui-view-refactor.svg)](https://agentmods.dev/skills/beel-collab/presets.dev/swiftui-view-refactor)
Your own site
<a href="https://agentmods.dev/skills/beel-collab/presets.dev/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/beel-collab/presets.dev/swiftui-view-refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,810 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 89% 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.00015 $0.01810
Opus 5 $0.00008 $0.00905
Sonnet 5 $0.00003 $0.00362
Haiku 4.5 $0.00002 $0.00181

Measured 4d ago against content hash 45959688dfbc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 4d 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

89% identical to swiftui-view-refactor — 19 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.

claude/skills/mobile/swiftui-view-refactor/SKILL.md · 216 lines

How it starts

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

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.

When to Use

  • When cleaning up a large SwiftUI view or splitting long body implementations.
  • When you need smaller subviews, explicit dependency injection, or better Observation usage.

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 · 216 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. 4d ago First seen · 216 lines · 15 tokens per session scan A 45959688dfbc

Subscribe to this mod's changes

swiftui-view-refactor is a skill published in the GitHub repository beel-collab/presets.dev (2 stars, last pushed 4mo ago), licensed MIT. It adds 15 tokens to every session and 1,810 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 89% identical to swiftui-view-refactor, differing in 19 lines, and is treated as a copy.

Related

Other skills, from other repositories

swift-development

You MUST activate this skill when working on Swift projects.

sammcj/agentic-coding · 13 tokens

skill-creator-primer

You MUST load this skill before the skill-creator skill AND before making ANY change to, or conducting a review of ANY Agent Skill. Triggers include creating, editing, reviewing, or contributing to any part of an Agent Skill (description, frontmatter, body, references, scripts, trigger evals, conflicts, etc).

sammcj/agentic-coding · 74 tokens

llm-wiki

Use when building or maintaining a self-contained personal knowledge base (an LLM wiki) in plain markdown. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki health, auditing article claims against their sources, critiquing a wiki source's reasoning, superseding stale knowledge, 'add to…

sammcj/agentic-coding · 82 tokens

extract-wisdom

Extract wisdom, insights, and actionable takeaways from YouTube videos, blog posts, articles, or text files. Use when asked to extract wisdom or key insights from a given content source.

sammcj/agentic-coding · 43 tokens

apply-mantel-styles

Provides guidelines for applying Mantel's brand styles to diagrams and frontend components. Use when asked to create visuals that need to align with Mantel's branding.

sammcj/agentic-coding · 37 tokens

home-assistant

This skill should be used when helping with Home Assistant setup, including creating automations, modifying dashboards, checking entity states, debugging automations, and managing the smart home configuration. Use this for queries about HA entities, YAML automation/dashboard generation, or troubleshooting HA issues.

sammcj/agentic-coding · 57 tokens