apple-pim: Skill for Claude Code

.claude/skills/swiftui-view-refactor/SKILL.md

swiftui-view-refactor is a skill for Claude Code, Codex from omarshahine/apple-pim. It costs 85 tokens per session (1,774 once invoked), scanned A, a copy of swiftui-view-refactor, MIT.

A guide for refactoring SwiftUI views, which are the screens and interface components used in Apple's SwiftUI framework. It favors small subviews, straightforward state handling, explicit dependencies, and keeping business logic outside the view.

In plain words
What is it for?
Use it to review or split SwiftUI views, improve state and dependency flow, move domain logic into services or models, and apply correct Observation patterns.
Why use it?
It helps make large or tangled views easier to understand and less likely to change unpredictably. It also avoids adding unnecessary view-model layers for simple screen state.

Skill for Claude CodeCodex

Written for Claude Code and Codex: installed under .claude/, but also agents/openai.yaml present.

This is omarshahine/apple-pim's own configuration. It tells Claude Code and Codex how to work on apple-pim 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 apple-pim configures →

Part of the apple-pim plugin — 16 skills, 7 commands shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to omarshahine/apple-pim. 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/omarshahine/apple-pim/main/.claude/skills/swiftui-view-refactor/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/omarshahine/apple-pim

Made for: Claude Code, Codex.

Or install apple-pim, the plugin that ships this one along with the rest of its 16 skills, 7 commands.

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/omarshahine/apple-pim/swiftui-view-refactor/github.svg)](https://agentmods.dev/skills/omarshahine/apple-pim/swiftui-view-refactor)
Your own site
<a href="https://agentmods.dev/skills/omarshahine/apple-pim/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/omarshahine/apple-pim/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/omarshahine/apple-pim/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/omarshahine/apple-pim/swiftui-view-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,774 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.00085 $0.01774
Opus 5 $0.00043 $0.00887
Sonnet 5 $0.00017 $0.00355
Haiku 4.5 $0.00009 $0.00177

Measured 9d ago against content hash 5ed2af6c5d7f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 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 — 1 line 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/swiftui-view-refactor/SKILL.md · 204 lines

How it starts

The opening of the file, as written. The whole thing — 204 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.

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.

Prefer:

var body: some View {
    List {
        HeaderSection(title: title, subtitle: subtitle)
        FilterSection(
            filterOptions: filterOptions,
            selectedFilter: $selectedFilter
        )
        ResultsSection(items: filteredItems)
        FooterSection()
    }
}

private struct HeaderSection: View {
    let title: String
    let subtitle: String

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

private struct FilterSection: View {
    let filterOptions: [FilterOption]
    @Binding var selectedFilter: FilterOption

    var body: 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 · 204 lines

Files

What ships with it

2 files 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 · 204 lines · 85 tokens per session scan A 5ed2af6c5d7f

Subscribe to this mod's changes

swiftui-view-refactor is a skill published in the GitHub repository omarshahine/apple-pim (52 stars, last pushed 2d ago), licensed MIT. It adds 85 tokens to every session and 1,774 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 1 line, and is treated as a copy.

Related

Other skills, from other repositories

hz-unity-meta-quest-ui

Configures Unity UI for Meta Quest and Horizon OS VR development — world-space canvases, TextMesh Pro setup, comfortable sizing, viewing distances, and interaction readiness.

meta-quest/agentic-tools · 41 tokens

troubleshoot-tcc

A troubleshooting guide for macOS permissions that control access to Calendar and Reminders.

PsychQuant/che-ical-mcp · 119 tokens

archive-event

Archive a meeting or event into Calendar from a narrative source — a meeting notice, an announcement, a message thread — deriving the time from the thread's authoritative correction, recording the source in the event notes, and labelling any value the source did not state. Use when the user hands over a notice…

PsychQuant/che-ical-mcp · 0 tokens

build-swiftui-interface

Use when a coding agent must design, scaffold, implement, or verify an iOS or macOS SwiftUI interface with Apple-platform state, accessibility, availability, testing, and Xcode evidence.

memi-design/memi · 45 tokens

calendar-management

Guide for effective use of che-ical-mcp for macOS Calendar & Reminders management. Use when user asks about calendar events, reminders, scheduling, or time management.

PsychQuant/che-ical-mcp · 38 tokens

rem-cli

Create, list, update, complete, tag, and search macOS Reminders via the rem CLI. Use when the user wants to manage Apple Reminders from the terminal, automate reminder workflows, reference reminders in shell scripts, or schedule anything on macOS.

BRO3886/rem · 55 tokens