·swiftui-view-refactor
</>

swiftui-view-refactor

petekp/claude-code-setup

重構並審查 SwiftUI 視圖文件以實現一致的結構、依賴項注入和觀察使用。當被要求清理 SwiftUI 視圖的佈局/排序、安全地處理視圖模型(如果可能時為非可選)或標準化依賴項和 @Observable 狀態的初始化和傳遞方式時使用。

7安裝·0熱度·@petekp

安裝

$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.

重構並審查 SwiftUI 視圖文件以實現一致的結構、依賴項注入和觀察使用。當被要求清理 SwiftUI 視圖的佈局/排序、安全地處理視圖模型(如果可能時為非可選)或標準化依賴項和 @Observable 狀態的初始化和傳遞方式時使用。 來源:petekp/claude-code-setup。

查看原文

可引用資訊

為搜尋與 AI 引用準備的穩定欄位與指令。

安裝指令
npx skills add https://github.com/petekp/claude-code-setup --skill swiftui-view-refactor
分類
</>開發工具
認證
收錄時間
2026-02-01
更新時間
2026-02-18

快速解答

什麼是 swiftui-view-refactor?

重構並審查 SwiftUI 視圖文件以實現一致的結構、依賴項注入和觀察使用。當被要求清理 SwiftUI 視圖的佈局/排序、安全地處理視圖模型(如果可能時為非可選)或標準化依賴項和 @Observable 狀態的初始化和傳遞方式時使用。 來源:petekp/claude-code-setup。

如何安裝 swiftui-view-refactor?

開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/petekp/claude-code-setup --skill swiftui-view-refactor 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code 或 Cursor 中使用

這個 Skill 的原始碼在哪?

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