Swiftui View Refactor
harperreed/dotfiles
Refactor and review SwiftUI view files for consistent structure, dependency injection, and Observation usage.
Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install Dimillian/Skills swiftui-view-refactor --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/swiftui-view-refactor .claude/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .claude/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install Dimillian/Skills swiftui-view-refactor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/swiftui-view-refactor .agents/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .agents/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install Dimillian/Skills swiftui-view-refactor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/swiftui-view-refactor .cursor/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .cursor/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/Dimillian/Skills.git --path swiftui-view-refactor--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install Dimillian/Skills swiftui-view-refactor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/swiftui-view-refactor .gemini/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .gemini/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install Dimillian/Skills swiftui-view-refactorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/swiftui-view-refactor .github/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .github/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Dimillian/Skills --skill swiftui-view-refactor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install Dimillian/Skills swiftui-view-refactor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Dimillian/Skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/swiftui-view-refactor .opencode/skills/swiftui-view-refactor && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "swiftui-view-refactor" agent skill from https://github.com/Dimillian/Skills/tree/main/swiftui-view-refactor into .opencode/skills/swiftui-view-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-view-refactor", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
swiftui-view-refactorRefactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.
Swiftui View Refactor is an agent skill from Dimillian/Skills. Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage. Use when cleaning up a SwiftUI view, splitting long bodies, removing inline actions or side effects, reducing computed some View helpers, or standardizing @Observable and view model initialization patterns.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `agents/openai.yaml` and `references/mv-patterns.md`).
It sits in Development, covering Refactoring and Design patterns. It works with SwiftUI. The licence is MIT.
6 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 05ba982. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Swiftui View Refactor loads about 2k tokens when it runs, and up to ~3.4k if it reads all its reference files. Until then it costs about 107 tokens; SKILL.md has 763 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from Dimillian/Skills at commit 05ba982, republished under its MIT licence (© Dimillian). 763 words, ~1,989 tokens.
.claude/skills/swiftui-view-refactor/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Refactor SwiftUI views toward small, explicit, stable view types. Default to vanilla SwiftUI: local state in the view, shared dependencies in the environment, business logic in services/models, and view models only when the request or existing code clearly requires one.
private/public let@State / other stored propertiesvar (non-view)initbody@State, @Environment, @Query, .task, .task(id:), and onChange before reaching for a view model.@Environment; keep domain logic in services/models, not in the view body.some View helpersbody properties that are longer than roughly one screen or contain multiple logical sections.View types for non-trivial sections, especially when they have state, async work, branching, or deserve their own preview.some View helpers rare and small. Do not build an entire screen out of private var header: some View-style fragments.Prefer:
var body: some View {
List {
HeaderSection(title: title, subtitle: subtitle)
FilterSection(
filterOptions: filterOptions,
selectedFilter: $selectedFilter
)
ResultsSection(items: filteredItems)
FooterSection()
}
}
private struct HeaderSection: View {
let title: String
let subtitle: String
var body: some View {
VStack(alignment: .leading, spacing: 6) {
Text(title).font(.title2)
Text(subtitle).font(.subheadline)
}
}
}
private struct FilterSection: View {
let filterOptions: [FilterOption]
@Binding var selectedFilter: FilterOption
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(filterOptions, id: \.self) { option in
FilterChip(option: option, isSelected: option == selectedFilter)
.onTapGesture { selectedFilter = option }
}
}
}
}
}Avoid:
var body: some View {
List {
header
filters
results
footer
}
}
private var header: some View {
VStack(alignment: .leading, spacing: 6) {
Text(title).font(.title2)
Text(subtitle).font(.subheadline)
}
}body.task, .onAppear, .onChange, or .refreshable.Button("Save", action: save)
.disabled(isSaving)
.task(id: searchText) {
await reload(for: searchText)
}
private func save() {
Task { await saveAsync() }
}
private func reload(for searchText: String) async {
guard !searchText.isEmpty else {
results = []
return
}
await searchService.search(searchText)
}body or computed views that return completely different root branches via if/else.overlay, opacity, disabled, toolbar, etc.).Prefer:
var body: some View {
List {
documentsListContent
}
.toolbar {
if canEdit {
editToolbar
}
}
}Avoid:
var documentsListView: some View {
if canEdit {
editableDocumentsList
} else {
readOnlyDocumentsList
}
}init, then create the view model in the view's init.bootstrapIfNeeded patterns and other delayed setup workarounds.Example (Observation-based):
@State private var viewModel: SomeViewModel
init(dependency: Dependency) {
_viewModel = State(initialValue: SomeViewModel(dependency: dependency))
}@Observable reference types on iOS 17+, store them as @State in the owning view.@StateObject at the owner and @ObservedObject when injecting legacy observable models.body; move business logic into services/models and keep only thin orchestration in the view.some View helpers.if-based branch swapping; move conditions to localized sections/modifiers.@State view model initialized in init.@State for root @Observable models on iOS 17+, legacy wrappers only when the deployment target requires them.some View properties.body and non-view computed vars above init.references/mv-patterns.md.When a SwiftUI view file exceeds ~300 lines, split it aggressively. Extract meaningful sections into dedicated View types instead of hiding complexity in many computed properties. Use private extensions with // MARK: - comments for actions and helpers, but do not treat extensions as a substitute for breaking a giant screen into smaller view types. If an extracted subview is reused or independently meaningful, move it into its own file.
© Dimillian, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files (references) in swiftui-view-refactor of Dimillian/Skills.
Open the folder on GitHubat commit 05ba982
We found 15 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 5 other GitHub owners. This page covers the copy in Dimillian/Skills, which our catalogue first saw on October 7, 2026.
Swiftui View Refactor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Swiftui View Refactor this skillDimillian/Skills | 4k | 5 repos | ~2k | Automated safety check: Pass | MIT | |
| Swiftui View Refactorharperreed/dotfiles | 334 | 5 repos | ~1.3k | Automated safety check: Pass | None | |
| RTK Rust Design Patternsrtk-ai/rtk | 83k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Architecture PatternsKartikLabhshetwar/better-shot | 2.4k | 2 repos | ~1.4k | Automated safety check: Pass | Custom licence | |
| AST Visitor Pattern for Unionsprisma/orm | 48k | — | ~830 | Automated safety check: Pass | Apache-2.0 | |
| Coding Best PracticesKartikLabhshetwar/better-shot | 2.4k | 2 repos | ~1.8k | Automated safety check: Pass | Custom licence |
harperreed/dotfiles
Refactor and review SwiftUI view files for consistent structure, dependency injection, and Observation usage.
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
KartikLabhshetwar/better-shot
Deep dive into software architecture for macOS. An agent skill from KartikLabhshetwar/better-shot.
prisma/orm
Replaces a plain TypeScript union plus switch statements with frozen subclasses and a visitor interface when several places dispatch on the same variants.
KartikLabhshetwar/better-shot
Reviews macOS Swift 6+ code for modern idioms, SOLID principles, SwiftData patterns, and concurrency best practices.
ramziddin/solid-skills
A skill your agent uses when writing code, implementing features, refactoring, planning architecture, designing systems, reviewing code, or debugging.
Dimillian/Skills
Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project.
Dimillian/Skills
Analyze and optimize React component performance issues (slow renders, re-render thrash, laggy lists, expensive computations).
Dimillian/Skills
Best practices and example-driven guidance for building SwiftUI views and components, including navigation hierarchies, custom view modifiers, and responsive layouts with stacks and grids.
Dimillian/Skills
Swift Concurrency review and remediation for Swift 6.2+. An agent skill from Dimillian/Skills.
Dimillian/Skills
Interact with GitHub using the gh CLI. An agent skill from Dimillian/Skills.
Dimillian/Skills
Build, refactor, or review macOS menubar apps that use Tuist and SwiftUI.
Works with
Categories
Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage. Swiftui View Refactor is an agent skill from Dimillian/Skills. Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.
Swiftui View Refactor fits situations like: cleaning up a SwiftUI view; splitting long bodies; removing inline actions; reducing computed some View helpers.
Run `npx skills add Dimillian/Skills --skill swiftui-view-refactor -a claude-code`. Or copy the skill folder (swiftui-view-refactor in Dimillian/Skills) into .claude/skills/swiftui-view-refactor in your project. Claude Code loads it when a task matches its description.
Run `npx skills add Dimillian/Skills --skill swiftui-view-refactor -a codex`. Or copy the skill folder (swiftui-view-refactor in Dimillian/Skills) into .agents/skills/swiftui-view-refactor in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Dimillian/Skills --skill swiftui-view-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swiftui-view-refactor, .gemini/skills/swiftui-view-refactor, .github/skills/swiftui-view-refactor and .opencode/skills/swiftui-view-refactor in your project.
SKILL.md names no scripts, command-line tools or credentials: Swiftui View Refactor is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Swiftui View Refactor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.4k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Swiftui View Refactor: Swiftui View Refactor (harperreed/dotfiles, 334 stars), RTK Rust Design Patterns (rtk-ai/rtk, 83k stars), Architecture Patterns (KartikLabhshetwar/better-shot, 2.4k stars) and AST Visitor Pattern for Unions (prisma/orm, 48k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Dimillian (a GitHub user) maintains it in Dimillian/Skills, which has 3,984 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on March 29, 2026.
Source: Dimillian/Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.