Agent skill

macOS View Refactor

by robinebers in robinebers/openusage

Refactor macOS SwiftUI views and scenes into stable structure.

MITAuto-check passedMobile

Install macOS View Refactor

skills CLI
$ npx skills add robinebers/openusage --skill macos-view-refactor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install robinebers/openusage macos-view-refactor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/robinebers/openusage.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/macos-view-refactor .claude/skills/macos-view-refactor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
macos-view-refactor
GitHub stars
4.3k
Token cost
~1.4k tokens
SKILL.md length
741 words
Files
1
Skills in repo
25
Repo updated
First seen
Licence
MIT

At a glance

Refactor macOS SwiftUI views and scenes into stable structure.

  • Works in 8 steps: Model scenes explicitly → Keep a predictable file shape → Prefer dedicated subview types over many… → …
  • Splitting large views
  • SKILL.md covers Overview, Core Guidelines, Workflow and Refactor Checklist, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

macOS View Refactor is an agent skill from robinebers/openusage. Refactor macOS SwiftUI views and scenes into stable structure. Use when splitting large views, tightening scene state, or narrowing AppKit escapes.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile, covering Refactoring and iOS development. It works with macOS and SwiftUI. The repository describes itself as: Burning through your subscriptions too fast? Paying for stuff you never use? Stop guessing. OpenUsage is free and open source. The licence is MIT.

When your agent uses it

  • Splitting large views
  • Tightening scene state
  • Narrowing AppKit escapes

Example prompts

  • “/macos-view-refactor”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Model scenes explicitly
  2. Keep a predictable file shape
  3. Prefer dedicated subview types over many computed some View fragments
  4. Keep selection and layout stable
  5. Extract commands, toolbars, and actions out of body
  6. Use scene and app storage intentionally
  7. Keep AppKit escape hatches narrow
  8. Observation usage

What it can do on your machine

Read from SKILL.md and the folder at commit cb21465. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

macOS View Refactor loads about 1.4k tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 741 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~42
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from robinebers/openusage at commit cb21465, republished under its MIT licence (© robinebers). 741 words, ~1,384 tokens.

Download SKILL.mdSave it as .claude/skills/macos-view-refactor/SKILL.md (or your agent's skills folder).
name
macos-view-refactor
description
Refactor macOS SwiftUI views and scenes into stable structure. Use when splitting large views, tightening scene state, or narrowing AppKit escapes.

View Refactor

Overview

Refactor macOS views toward small, explicit, stable scene and view types. Default to native SwiftUI for layout, selection, commands, and settings. Reach for AppKit only at the narrow edges where desktop behavior truly requires it.

Core Guidelines

1) Model scenes explicitly
  • Break the app into meaningful scene roots: main window, settings, utility windows, inspectors, or menu bar extras.
  • Do not let one giant root view silently own every desktop surface.
2) Keep a predictable file shape
  • Follow this ordering unless the file already has a stronger local convention:
  • Environment
  • private/public let
  • @State / other stored properties
  • computed var (non-view)
  • init
  • body
  • computed view builders / other view helpers
  • helper / async functions
2b) Split files by responsibility
  • For non-trivial apps, do not keep the full app, all views, models, stores, networking clients, process clients, and helpers in one Swift file.
  • Accept a single Swift file only for tiny throwaway examples or snippets: roughly under 50 lines, one screen, no persistence, no networking/process client, and no reusable models.
  • Use App/<AppName>App.swift for the @main app and AppDelegate only.
  • Keep Views/ContentView.swift focused on root layout and composition; move feature UI into files such as Views/SidebarView.swift, Views/DetailView.swift, and Views/ComposerView.swift.
  • Move value types and selection enums into Models/*.swift, stores into Stores/*.swift, app-server/network/process clients into Services/*.swift, and small formatters/resolvers/extensions into Support/*.swift.
  • Keep files small and named after the primary type they contain.
3) Prefer dedicated subview types over many computed some View fragments
  • Extract meaningful desktop sections like sidebar rows, detail panels, inspectors, or toolbar content into focused subviews.
  • Keep computed some View helpers small and rare.
  • Pass explicit data, bindings, and actions into subviews instead of handing down the whole scene model.
4) Keep selection and layout stable
  • Prefer one stable split or window layout with local conditionals inside it.
  • Avoid top-level branch swapping between radically different roots when selection changes.
  • Let the layout be constant; let state drive the content inside it.
5) Extract commands, toolbars, and actions out of body
  • Do not bury non-trivial button logic inline.
  • Do not mix command routing, menu state, and layout in the same block if they can be named clearly.
  • Keep body readable as UI, not as a desktop view controller.
6) Use scene and app storage intentionally
  • Use @SceneStorage for per-window ephemeral state when it truly helps restore the scene.
  • Use @AppStorage for durable preferences, not transient UI toggles that only matter in one window.
  • Keep scene-owned state close to the scene root.
7) Keep AppKit escape hatches narrow
  • If a representable or NSWindow bridge exists, isolate it behind a small wrapper or helper.
  • Do not let AppKit references spread through unrelated SwiftUI views.
  • If the bridge starts owning the feature, re-evaluate the architecture.
Show full SKILL.md (293 more words)Show less
8) Observation usage
  • For @Observable reference types on modern macOS targets, store them as @State in the owning view.
  • Pass observables explicitly to children.
  • On older deployment targets, fall back to @StateObject and @ObservedObject where needed.

Workflow

  1. Identify the current scene boundary and whether the file is trying to do too much.
  2. Reorder the file into a predictable top-to-bottom structure.
  3. Extract desktop-specific sections into dedicated subview types.
  4. Stabilize the root layout around selection, scenes, and commands rather than top-level branching.
  5. Move action logic, command routing, and toolbar behavior into named helpers or separate types.
  6. Tighten any AppKit bridge so the imperative edge is small and explicit.
  7. Keep behavior intact unless the request explicitly asks for structural and behavioral changes together.

Refactor Checklist

  • Split oversized view files before adding more UI.
  • Move pure models, identifiers, and selection enums out of view files.
  • Move Process, URLSession, app-server, and platform client code out of SwiftUI views into Services/.
  • Keep AppDelegate and the @main app entrypoint minimal.
  • Build after each major split so compile errors stay local.

Common Smells

  • A root view that mixes window scaffolding, settings, toolbar code, command handling, and detail layout.
  • A single app file that mixes app entrypoint, root layout, feature views, models, stores, service clients, and support extensions.
  • iOS-style push navigation forced into a Mac sidebar-detail problem.
  • Several booleans for mutually exclusive inspectors, sheets, or utility windows.
  • AppKit objects passed through many SwiftUI layers without a clear ownership reason.
  • Large computed view fragments standing in for real subviews.

Notes

  • A good macOS refactor should make scene structure, selection flow, and command ownership obvious.
  • When the problem is fundamentally a missing desktop pattern, use macos-swiftui-patterns.
  • When the problem is fundamentally a boundary with AppKit, use macos-appkit-interop.

© robinebers, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/macos-view-refactor of robinebers/openusage.

Open the folder on GitHubat commit cb21465

Compare with similar skills

macOS View Refactor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

macOS View Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
macOS View Refactor this skillrobinebers/openusage4.3k—~1.4kAutomated safety check: PassMIT
Protect Knowledge BoundaryShiinaLabs/wifi-lens118—~1.6kAutomated safety check: PassApache-2.0
Capture Usage4claude Screenshotsf-is-h/Usage4Claude400—~3kAutomated safety check: PassMIT
macOS DevelopmentKartikLabhshetwar/better-shot2.4k2 repos~735Automated safety check: PassCustom licence
Code ReviewRobertoMachorro/Moped115—~2.1kAutomated safety check: PassGPL-3.0
Swiftui Debuggingst0012/cctop154—~2kAutomated safety check: PassMIT

Similar skills

  • Protect Knowledge Boundary

    ShiinaLabs/wifi-lens

    Invoke only when the user explicitly requests a WiFi Lens knowledge-boundary audit or the active task names that audit as a required deliverable.

    118 GitHub stars~1.6k tokensUpdated yesterday
    MobileAuto-check passed
  • Produce every Usage4Claude interface image used by the READMEs and docs.

    400 GitHub stars~3k tokensUpdated 9 days ago
    MobileAuto-check passed
  • macOS Development

    KartikLabhshetwar/better-shot

    Comprehensive macOS development guidance including Swift 6+, SwiftUI, SwiftData, architecture patterns, AppKit bridging, and macOS 26 Tahoe APIs.

    2.4k GitHub starsUsed in 2 repos~735 tokens
    MobileAuto-check passed
  • Code Review

    RobertoMachorro/Moped

    Review guidance for Moped, a sandboxed macOS SwiftUI text editor with a homegrown TextKit 1 editor core in the local MopedEditor package.

    115 GitHub stars~2.1k tokensUpdated 3 days ago
    MobileAuto-check passed
  • Swiftui Debugging

    st0012/cctop

    A skill your agent uses when debugging SwiftUI issues in this macOS app — views not updating, layout problems, unnecessary re-renders, state ownership bugs, Preview crashes, or NSHostingView/NSPanel…

    154 GitHub stars~2k tokensUpdated 7 days ago
    MobileAuto-check passed
  • Swift Expert

    Jeffallan/claude-skills

    Builds Swift apps for Apple platforms with SwiftUI, protocol-oriented design, async/await, actors and Sendable checks, verified with swift build and swift test.

    12k GitHub stars~1.5k tokensUpdated 5 days ago
    MobileAuto-check passed

More from robinebers/openusage

All 25 skills in this repo
  • Swiftui Patterns

    robinebers/openusage

    Best practices and example-driven guidance for building native macOS SwiftUI scenes and components, including windows, commands, toolbars, settings, split views, inspectors, menu bar extras, and…

    4.3k GitHub stars~3.4k tokensUpdated 2 days ago
    Auto-check passed
  • macOS Telemetry

    robinebers/openusage

    Add and verify lightweight macOS runtime telemetry. An agent skill from robinebers/openusage.

    4.3k GitHub stars~934 tokensUpdated 2 days ago
    Auto-check passed
  • Release Swift

    robinebers/openusage

    Cut a release of OpenUsage (Swift menu-bar app): pick a version, generate a categorized changelog, tag from main, and publish the GitHub Release with notes.

    4.3k GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed
  • Telemetry

    robinebers/openusage

    Add lightweight runtime telemetry and debug instrumentation to macOS apps, then verify those events after building and running.

    4.3k GitHub stars~977 tokensUpdated 2 days ago
    Auto-check passed
  • Window Management

    robinebers/openusage

    Customize macOS 15+ SwiftUI windows and scene behavior using Window, WindowGroup, and macOS window modifiers.

    4.3k GitHub stars~2.6k tokensUpdated 2 days ago
    Auto-check passed
  • Appkit Interop

    robinebers/openusage

    Decide when and how to bridge a macOS app from SwiftUI into AppKit.

    4.3k GitHub stars~741 tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about macOS View Refactor

What does macOS View Refactor do?

Refactor macOS SwiftUI views and scenes into stable structure. macOS View Refactor is an agent skill from robinebers/openusage. Refactor macOS SwiftUI views and scenes into stable structure.

When should I use macOS View Refactor?

macOS View Refactor fits situations like: splitting large views; tightening scene state; narrowing AppKit escapes.

How do I install macOS View Refactor in Claude Code?

Run `npx skills add robinebers/openusage --skill macos-view-refactor -a claude-code`. Or copy the skill folder (.agents/skills/macos-view-refactor in robinebers/openusage) into .claude/skills/macos-view-refactor in your project. Claude Code loads it when a task matches its description.

How do I install macOS View Refactor in Codex?

Run `npx skills add robinebers/openusage --skill macos-view-refactor -a codex`. Or copy the skill folder (.agents/skills/macos-view-refactor in robinebers/openusage) into .agents/skills/macos-view-refactor in your project. Codex loads it when a task matches its description.

Can I use macOS View Refactor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add robinebers/openusage --skill macos-view-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/macos-view-refactor, .gemini/skills/macos-view-refactor, .github/skills/macos-view-refactor and .opencode/skills/macos-view-refactor in your project.

What does macOS View Refactor need to run?

SKILL.md names no scripts, command-line tools or credentials: macOS View Refactor is instructions for the agent only.

Does macOS View Refactor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is macOS View Refactor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does macOS View Refactor use?

macOS View Refactor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does macOS View Refactor use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to macOS View Refactor?

Skills that share tags, products or a category with macOS View Refactor: Protect Knowledge Boundary (ShiinaLabs/wifi-lens, 118 stars), Capture Usage4claude Screenshots (f-is-h/Usage4Claude, 400 stars), macOS Development (KartikLabhshetwar/better-shot, 2.4k stars) and Code Review (RobertoMachorro/Moped, 115 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains macOS View Refactor?

robinebers (a GitHub user) maintains it in robinebers/openusage, which has 4,333 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on October 6, 2026.

Source: robinebers/openusage on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.