macos-view-refactor
Skill by robinebers
Refactors macOS SwiftUI views and scenes into small, explicit, stable structure. It is for developers splitting large views, tightening scene state, or narrowing AppKit escapes in Mac apps.
Install macos-view-refactor
Built from the published package, never by AI.
git clone --depth 1 https://github.com/robinebers/openusage /tmp/openusage && mkdir -p ~/.claude/skills && cp -r /tmp/openusage/.agents/skills/macos-view-refactor ~/.claude/skills/macos-view-refactorRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/robinebers/openusage /tmp/openusage && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/openusage/.agents/skills/macos-view-refactor ~/.gemini/antigravity-cli/skills/macos-view-refactorAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install macos-view-refactor in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
The macos-view-refactor skill guides an AI assistant through refactoring macOS SwiftUI views and scenes into small, explicit, stable scene and view types. It sets a predictable file order, splits large files by responsibility, and moves Process, URLSession and service clients out of SwiftUI views into Services/. It keeps the root layout stable, extracts commands and toolbar logic out of body, and isolates AppKit bridges behind small wrappers.
The skill defaults to native SwiftUI for layout, selection, commands and settings, and uses AppKit only where desktop behavior requires it. It also covers scene storage with @SceneStorage and @AppStorage, observation with @State or @StateObject on older targets, and a workflow that builds after each major split. It is aimed at developers working on macOS SwiftUI apps who need to split oversized views or tighten scene state. For related problems, it points to macos-swiftui-patterns and macos-appkit-interop.
Written from the project's SKILL.md and checked against it.
What it can do
- Model scenes explicitlyBreaks an app into scene roots such as main window, settings, utility windows, inspectors or menu bar extras.
- Keep a predictable file shapeOrders Swift type contents from environment and properties through init, body and helper functions.
- Split files by responsibilityMoves the app entrypoint, views, models, stores, services and support code into separate files and folders.
- Extract dedicated subviewsTurns sidebar rows, detail panels, inspectors and toolbar content into focused subview types with explicit inputs.
- Stabilize root layoutKeeps one split or window layout and lets state drive content instead of swapping top-level roots.
- Move actions out of bodyMoves command routing, menu state and toolbar behavior into named helpers or separate types.
- Tighten scene and app storageGuides use of @SceneStorage for per-window state and @AppStorage for durable preferences.
- Narrow AppKit bridgesIsolates NSViewRepresentable and NSWindow bridges behind a small wrapper or helper.
- Apply observation patternsCovers @State for @Observable on modern macOS and @StateObject with @ObservedObject on older targets.
What you need
- A macOS SwiftUI codebase
Try asking
- Split this large macOS SwiftUI ContentView into sidebar, detail and toolbar subviews.
- Reorder this Swift view file into the predictable structure used for macOS views.
- Move the Process and URLSession calls out of my SwiftUI views into Services files.
Good to know
- Keeps behavior intact unless the request explicitly asks for structural and behavioral changes together.
- Covers macOS SwiftUI views and scenes only, and points to other skills for patterns and AppKit boundaries.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/macos-view-refactor/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md5 KB
Alternatives to macos-view-refactor
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
macos-view-refactor: common questions
When should I split a SwiftUI view file on macOS?
The skill says to split oversized view files before adding more UI. It also says non-trivial apps should not keep the full app, views, models and clients in one Swift file.
Does this skill use AppKit for macOS layouts?
It defaults to native SwiftUI for layout, selection, commands and settings. AppKit is used only at narrow edges where desktop behavior truly requires it.
What does it recommend for @Observable state?
On modern macOS targets it recommends storing @Observable reference types as @State in the owning view. On older targets it falls back to @StateObject and @ObservedObject.
How do I install macos-view-refactor?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is macos-view-refactor free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is macos-view-refactor safe to use?
It scores 89 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to macos-view-refactor?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
