view-refactor
Skill by openai
Refactors macOS SwiftUI views and scenes into smaller, stable structures. It is for developers who maintain Mac apps and want clearer scene boundaries and narrower AppKit bridges.
Install view-refactor
Built from the published package, never by AI.
git clone --depth 1 https://github.com/openai/plugins /tmp/plugins && mkdir -p ~/.claude/skills && cp -r /tmp/plugins/plugins/build-macos-apps/skills/view-refactor ~/.claude/skills/view-refactorRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/openai/plugins /tmp/plugins && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/plugins/plugins/build-macos-apps/skills/view-refactor ~/.gemini/antigravity-cli/skills/view-refactorAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
View Refactor is a SKILL.md guide for restructuring macOS SwiftUI code. It asks the assistant to model the app as explicit scene roots, keep a fixed ordering inside each Swift file, and split large files by responsibility into App, Views, Models, Stores, Services and Support folders. It also covers extracting subviews, moving commands and toolbar logic out of body, and using @SceneStorage and @AppStorage with clear intent.
The guide favors native SwiftUI for layout, selection, commands and settings, and asks that AppKit usage stay in small, isolated wrappers. It recommends one stable split or window layout with state driving the content, and building after each major split. It is aimed at developers working on macOS apps who want clearer structure while keeping behavior intact unless a request asks for behavior changes. Related problems point to the swiftui-patterns and appkit-interop skills.
Written from the project's SKILL.md and checked against it.
What it can do
- Scene modelingBreaks an app into meaningful scene roots such as main window, settings and inspectors.
- File shape orderingReorders a Swift file into a predictable top-to-bottom structure.
- File splittingSplits large apps into App, Views, Models, Stores, Services and Support files by responsibility.
- Subview extractionTurns large computed view fragments into focused subview types with explicit data and actions.
- Stable root layoutKeeps one stable split or window layout and lets state drive the content inside it.
- Command extractionMoves non-trivial button logic, command routing and toolbar behavior out of body into named helpers.
- Storage guidanceAdvises when to use @SceneStorage for per-window state and @AppStorage for durable preferences.
- AppKit bridge narrowingIsolates representable and NSWindow bridges behind small wrappers.
- Observation usageExplains storing @Observable objects as @State and falling back to @StateObject on older targets.
What you need
- A macOS SwiftUI app codebase
Try asking
- Split this large macOS SwiftUI ContentView into smaller subviews and files.
- Reorder this SwiftUI view file into the predictable structure from view-refactor.
- Narrow the AppKit bridge in this Mac app so it stays in one small wrapper.
Good to know
- Keeps behavior intact unless the request explicitly asks for structural and behavioral changes together.
- Observation guidance differs for older deployment targets.
- Focused on macOS SwiftUI; other platforms are not covered.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: plugins/build-macos-apps/skills/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 -
agents/openai.yaml328 B
Alternatives to 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
view-refactor: common questions
What does the view-refactor skill change in a SwiftUI app?
It restructures views and scenes into smaller, stable types and splits large files by responsibility. The source says to keep behavior intact unless the request asks for behavior changes.
When should AppKit be used according to this skill?
The skill says to default to native SwiftUI and reach for AppKit only at narrow edges where desktop behavior truly requires it. Bridges should be isolated behind a small wrapper.
Which skill should be used for AppKit boundary problems?
The source says that when the problem is fundamentally a boundary with AppKit, the appkit-interop skill should be used instead.
How do I install view-refactor?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is view-refactor free?
The code is public, but no licence file was found, so check the repository before commercial use.
Is view-refactor safe to use?
It scores 87 of 100. Grades: maintenance A, licence F, 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 view-refactor?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
