·swiftui-view-refactor
</>

swiftui-view-refactor

petekp/claude-code-setup

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.

7Installs·0Trend·@petekp

Installation

$npx skills add https://github.com/petekp/claude-code-setup --skill swiftui-view-refactor

SKILL.md

Overview Apply a consistent structure and dependency pattern to SwiftUI views, with a focus on ordering, Model-View (MV) patterns, careful view model handling, and correct Observation usage.

Example (long body → shorter body + computed views in the same file):

1) Reorder the view to match the ordering rules. 2) Favor MV: move lightweight orchestration into the view using @State, @Environment, @Query, task, and onChange. 3) If a view model exists, replace optional view models with a non-optional @State view model initialized in init by passing dependencies from the view.

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. Source: petekp/claude-code-setup.

View raw

Facts (cite-ready)

Stable fields and commands for AI/search citations.

Install command
npx skills add https://github.com/petekp/claude-code-setup --skill swiftui-view-refactor
Category
</>Dev Tools
Verified
First Seen
2026-02-01
Updated
2026-02-18

Quick answers

What is 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. Source: petekp/claude-code-setup.

How do I install swiftui-view-refactor?

Open your terminal or command line tool (Terminal, iTerm, Windows Terminal, etc.) Copy and run this command: npx skills add https://github.com/petekp/claude-code-setup --skill swiftui-view-refactor Once installed, the skill will be automatically configured in your AI coding environment and ready to use in Claude Code or Cursor

Where is the source repository?

https://github.com/petekp/claude-code-setup