swiftui-view-refactor
Skill by sickn33
Refactors SwiftUI views into smaller components with stable, explicit data flow. It is aimed at developers who want cleaner view files and clearer dependency injection.
Install swiftui-view-refactor
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/swiftui-view-refactor ~/.claude/skills/swiftui-view-refactorRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agentic-awesome-skills/skills/swiftui-view-refactor ~/.gemini/antigravity-cli/skills/swiftui-view-refactorAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install swiftui-view-refactor in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
The swiftui-view-refactor skill guides an AI assistant in splitting large SwiftUI views into smaller, explicit view types. It sets a fixed ordering for the members of a view, favors dedicated View types over computed some View helpers, and moves button actions and side effects out of body into small private methods or services.
The skill defaults to MV patterns that use @State, @Environment, @Query, .task, and onChange, rather than view models. It keeps a stable view tree by avoiding top-level if/else branch swapping, and it covers Observation wrappers for iOS 17+ as well as legacy wrappers for iOS 16 and earlier. It is written for developers refactoring SwiftUI code who need to keep layout and business logic unchanged unless they ask for changes.
Written from the project's SKILL.md and checked against it.
What it can do
- View orderingArranges view members from environment and properties through init, body, view helpers and functions.
- MV over MVVMFavors @State, @Environment and services or models over introducing a view model.
- Dedicated subview typesExtracts non-trivial sections into their own View types instead of large computed some View helpers.
- Actions out of bodyMoves non-trivial button actions and task or onChange logic into small private methods and services.
- Stable view treeReplaces top-level if/else root branch swapping with conditions inside sections and modifiers.
- Observation wrappersAdvises @State for owned @Observable models on iOS 17+ and @StateObject or @ObservedObject for legacy models.
What you need
- Swift and SwiftUI code
Try asking
- Refactor this long SwiftUI body into smaller subview types
- Move the inline button actions in this SwiftUI view into private methods
- Check my SwiftUI view for member ordering and stable view structure
Good to know
- Use only when the task clearly matches the skill's scope.
- Not a substitute for environment-specific validation, testing or expert review.
- Keeps layout and business logic unchanged unless a change is requested.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/swiftui-view-refactor/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB -
agents/openai.yaml226 B -
references/mv-patterns.md6 KB
Alternatives to swiftui-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
swiftui-view-refactor: common questions
Does this skill introduce view models?
Not by default. The source treats view models as a legacy or explicit-need pattern and only uses one if the request or existing code clearly calls for it.
When should a SwiftUI view be split into subviews?
The source flags body properties longer than roughly one screen or with multiple logical sections. It also says files over about 300 lines should be split aggressively.
Which Observation wrapper does it recommend for iOS 17 and later?
For @Observable reference types on iOS 17+, the source says to store them as @State in the owning view. Legacy wrappers are only for deployment targets that require them.
How do I install swiftui-view-refactor?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is swiftui-view-refactor free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is swiftui-view-refactor safe to use?
It scores 92 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 swiftui-view-refactor?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
