swiftui-view-refactor
Refactor and review SwiftUI view files for consistent structure, dependency injection, and Observation usage. Use when asked to clean up a SwiftUI view’s layout/ordering, handle view models safely (non-optional when possible), or standardize how dependencies and @Observable state are initialized and passed.
Why use this skill?
Standardize your SwiftUI codebase with the swiftui-view-refactor skill. Automatically organize views, manage dependencies, and apply modern @Observable patterns.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/steipete/swiftui-view-refactorWhat This Skill Does
The swiftui-view-refactor skill is a specialized refactoring tool designed to standardize SwiftUI codebase architecture. It enforces a strict, industry-vetted structure for views, focusing on readability, maintainability, and modern observation patterns. The skill automates the organization of view properties, optimizes the use of dependency injection, and encourages the transition from bloated, monolithic views to modular, composable subviews. By applying these consistent patterns, it ensures that your SwiftUI files remain clean and easier to debug, even as feature complexity grows.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/steipete/swiftui-view-refactor
Use Cases
This skill is ideal for:
- Refactoring legacy SwiftUI code that uses outdated patterns like
ObservableObjectin favor of@Observable. - Cleaning up massive, unreadable View files that exceed hundreds of lines of code.
- Standardizing dependency injection patterns across team projects to ensure consistency.
- Improving the performance of complex views by breaking them into smaller, granular components.
- Enforcing a uniform coding style across a team to facilitate faster onboarding and peer reviews.
Example Prompts
- "Refactor this HomeView file to follow the standard SwiftUI ordering guidelines and move the header section into a separate subview."
- "Review my ProfileView and suggest how to replace @ObservedObject with the new @Observable macro pattern while keeping dependency injection clean."
- "My body property in the DashboardView is too large; extract the logical sections into private computed view builders to improve readability."
Tips & Limitations
- Manual Verification: While the skill is highly proficient at structural refactoring, always review the generated code to ensure that custom logic, particularly complex state binding transitions, remains intact after extraction.
- Scope: This tool works best when applied file-by-file. Avoid running it on an entire directory at once to maintain better control over architectural changes.
- Performance: When extracting complex views, ensure you are passing only the necessary data rather than the entire parent model, as this can trigger unnecessary view invalidations in SwiftUI. Use
@Environmentfor cross-cutting concerns like theme or session state to keep initializer signatures concise.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-steipete-swiftui-view-refactor": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write, code-execution
Related Skills
swiftui-liquid-glass
Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.
qmd
Local search/indexing CLI (BM25 + vectors + rerank) with MCP mode.
songsee
Generate spectrograms and feature-panel visualizations from audio with the songsee CLI.
summarize
Summarize URLs or files with the summarize CLI (web, PDFs, images, audio, YouTube).
bird
X/Twitter CLI for reading, searching, and posting via cookies or Sweetistics.