swift-refactor

📁 pproenca/dot-skills 📅 5 days ago
29
总安装量
5
周安装量
#12856
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill swift-refactor

Agent 安装分布

claude-code 5
amp 4
gemini-cli 4
github-copilot 4
codex 4
kimi-cli 4

Skill 文档

Swift Refactor — Code Quality & Modernization

Comprehensive guide for refactoring Swift and SwiftUI code. Contains 42 rules across 7 categories covering API modernization, state architecture, view decomposition, navigation refactoring, architecture patterns, type safety, and Swift fundamentals.

When to Apply

Reference these guidelines when:

  • Migrating from deprecated SwiftUI APIs (ObservableObject, NavigationView, old onChange)
  • Restructuring state management to reduce re-renders
  • Decomposing large views into maintainable components
  • Refactoring navigation to use NavigationStack and NavigationPath
  • Improving architecture with protocol dependencies and Environment keys
  • Strengthening type safety with tagged identifiers and Result types
  • Writing idiomatic Swift with proper naming, optionals, and closures

Rule Categories by Priority

Priority Category Impact Prefix
1 API Modernization CRITICAL api-
2 State Architecture CRITICAL state-
3 View Decomposition HIGH view-
4 Navigation Refactoring HIGH nav-
5 Architecture Patterns HIGH arch-
6 Type Safety & Protocols MEDIUM-HIGH type-
7 Swift Language Fundamentals MEDIUM swift-

Quick Reference

1. API Modernization (CRITICAL)

2. State Architecture (CRITICAL)

3. View Decomposition (HIGH)

4. Navigation Refactoring (HIGH)

5. Architecture Patterns (HIGH)

6. Type Safety & Protocols (MEDIUM-HIGH)

7. Swift Language Fundamentals (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

File Description
references/_sections.md Category definitions and ordering
assets/templates/_template.md Template for new rules