Agent skill

View Refactor

by robinebers in robinebers/openusage

Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and…

MITAuto-check passedMobile

Install View Refactor

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

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

GitHub CLI
$ gh skill install robinebers/openusage 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/view-refactor .claude/skills/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
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 with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and…

  • Works in 8 steps: Model scenes explicitly → Keep a predictable file shape → Prefer dedicated subview types over many… → …
  • Cleaning up a macOS view file
  • 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

View Refactor is an agent skill from robinebers/openusage. Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and narrow AppKit escape hatches. Use when cleaning up a macOS view file, splitting oversized scene roots, removing iOS-centric patterns, or tightening mixed SwiftUI/AppKit architecture.

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, SwiftUI and iOS. 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

  • Cleaning up a macOS view file
  • Splitting oversized scene roots
  • Removing iOS-centric patterns
  • Tightening mixed SwiftUI/AppKit architecture

Example prompts

  • “/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

View Refactor loads about 1.4k tokens when it runs. Until then it costs about 98 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
~98
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,437 tokens.

Download SKILL.mdSave it as .claude/skills/view-refactor/SKILL.md (or your agent's skills folder).
name
view-refactor
description
Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and narrow AppKit escape hatches. Use when cleaning up a macOS view file, splitting oversized scene roots, removing iOS-centric patterns, or tightening mixed SwiftUI/AppKit architecture.

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 swiftui-patterns.
  • When the problem is fundamentally a boundary with AppKit, use 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/view-refactor of robinebers/openusage.

Open the folder on GitHubat commit cb21465

Compare with similar skills

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.

View Refactor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
View Refactor this skillrobinebers/openusage4.3k—~1.4kAutomated safety check: PassMIT
Protect Knowledge BoundaryShiinaLabs/wifi-lens118—~1.6kAutomated safety check: PassApache-2.0
Swift ExpertJeffallan/claude-skills12k—~1.5kAutomated safety check: PassMIT
Swift Refactorpproenca/dot-skills215—~3kAutomated safety check: PassMIT
Swiftui Expert Skillomarshahine/HomeClaw1764 repos~2.8kAutomated safety check: PassMIT
Hig Project Contextraintree-technology/hig-doctor1435 repos~1.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
  • 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 4 days ago
    MobileAuto-check passed
  • Swift Refactor

    pproenca/dot-skills

    Swift and SwiftUI refactoring patterns aligned with the iOS 26 / Swift 6.2 clinic modular MVVM-C architecture (Airbnb + OLX SPM layout).

    215 GitHub stars~3k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Swiftui Expert Skill

    omarshahine/HomeClaw

    A skill your agent uses when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state management, view composition, performance, Liquid Glass adoption, or Instruments .trace…

    176 GitHub starsUsed in 4 repos~2.8k tokens
    MobileAuto-check passed
  • Hig Project Context

    raintree-technology/hig-doctor

    Create or update a shared Apple design context document that other HIG skills use to tailor guidance.

    143 GitHub starsUsed in 5 repos~1.2k tokens
    MobileAuto-check passed
  • Swiftui Expert Skill

    Eslzzyl/Pixiv-SwiftUI

    A skill your agent uses when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state and @Observable data flow, view composition, resizable layouts, safe areas, display…

    111 GitHub starsUsed in 1 repo~2.9k tokens
    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 yesterday
    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 yesterday
    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 yesterday
    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 yesterday
    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 yesterday
    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 yesterday
    Auto-check passed

Works with

Questions about View Refactor

What does View Refactor do?

Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and…. View Refactor is an agent skill from robinebers/openusage. Refactor macOS SwiftUI views and scenes with strong defaults for small dedicated subviews, stable sidebar and selection structure, explicit command and toolbar ownership, scene-aware state, and narrow AppKit escape hatches.

When should I use View Refactor?

View Refactor fits situations like: cleaning up a macOS view file; splitting oversized scene roots; removing iOS-centric patterns; tightening mixed SwiftUI/AppKit architecture.

How do I install View Refactor in Claude Code?

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

How do I install View Refactor in Codex?

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

Can I use 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 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/view-refactor, .gemini/skills/view-refactor, .github/skills/view-refactor and .opencode/skills/view-refactor in your project.

What does View Refactor need to run?

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

Does 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 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 View Refactor use?

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 View Refactor use?

About 1.4k tokens (SKILL.md is roughly 5.7k 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 View Refactor?

Skills that share tags, products or a category with View Refactor: Protect Knowledge Boundary (ShiinaLabs/wifi-lens, 118 stars), Swift Expert (Jeffallan/claude-skills, 12k stars), Swift Refactor (pproenca/dot-skills, 215 stars) and Swiftui Expert Skill (omarshahine/HomeClaw, 176 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains 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.