# Send Swiftui View Refactor to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "swiftui-view-refactor",
    "name": "Swiftui View Refactor",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/steipete/swiftui-view-refactor",
    "canonicalUrl": "https://clawhub.ai/steipete/swiftui-view-refactor",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/swiftui-view-refactor",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-view-refactor",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/mv-patterns.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "swiftui-view-refactor",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-09T15:10:00.641Z",
      "expiresAt": "2026-05-16T15:10:00.641Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-view-refactor",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-view-refactor",
        "contentDisposition": "attachment; filename=\"swiftui-view-refactor-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "swiftui-view-refactor"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/swiftui-view-refactor"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/swiftui-view-refactor",
    "downloadUrl": "https://openagent3.xyz/downloads/swiftui-view-refactor",
    "agentUrl": "https://openagent3.xyz/skills/swiftui-view-refactor/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swiftui-view-refactor/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swiftui-view-refactor/agent.md"
  }
}
```
## Documentation

### SwiftUI View Refactor

Attribution: copied from @Dimillian’s Dimillian/Skills (2025-12-31).

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

### 1) View ordering (top → bottom)

Environment
private/public let
@State / other stored properties
computed var (non-view)
init
body
computed view builders / other view helpers
helper / async functions

### 2) Prefer MV (Model-View) patterns

Default to MV: Views are lightweight state expressions; models/services own business logic.
Favor @State, @Environment, @Query, and task/onChange for orchestration.
Inject services and shared models via @Environment; keep views small and composable.
Split large views into subviews rather than introducing a view model.

### 3) Split large bodies and view properties

If body grows beyond a screen or has multiple logical sections, split it into smaller subviews.
Extract large computed view properties (var header: some View { ... }) into dedicated View types when they carry state or complex branching.
It's fine to keep related subviews as computed view properties in the same file; extract to a standalone View struct only when it structurally makes sense or when reuse is intended.
Prefer passing small inputs (data, bindings, callbacks) over reusing the entire parent view state.

Example (extracting a section):

var body: some View {
    VStack(alignment: .leading, spacing: 16) {
        HeaderSection(title: title, isPinned: isPinned)
        DetailsSection(details: details)
        ActionsSection(onSave: onSave, onCancel: onCancel)
    }
}

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

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)
    }
}

private var filters: some View {
    ScrollView(.horizontal, showsIndicators: false) {
        HStack {
            ForEach(filterOptions, id: \\.self) { option in
                FilterChip(option: option, isSelected: option == selectedFilter)
                    .onTapGesture { selectedFilter = option }
            }
        }
    }
}

Example (extracting a complex computed view):

private var header: some View {
    HeaderSection(title: title, subtitle: subtitle, status: status)
}

private struct HeaderSection: View {
    let title: String
    let subtitle: String?
    let status: Status

    var body: some View {
        VStack(alignment: .leading, spacing: 4) {
            Text(title).font(.headline)
            if let subtitle { Text(subtitle).font(.subheadline) }
            StatusBadge(status: status)
        }
    }
}

### 4) View model handling (only if already present)

Do not introduce a view model unless the request or existing code clearly calls for one.
If a view model exists, make it non-optional when possible.
Pass dependencies to the view via init, then pass them into the view model in the view's init.
Avoid bootstrapIfNeeded patterns.

Example (Observation-based):

@State private var viewModel: SomeViewModel

init(dependency: Dependency) {
    _viewModel = State(initialValue: SomeViewModel(dependency: dependency))
}

### 5) Observation usage

For @Observable reference types, store them as @State in the root view.
Pass observables down explicitly as needed; avoid optional state unless required.

### Workflow

Reorder the view to match the ordering rules.
Favor MV: move lightweight orchestration into the view using @State, @Environment, @Query, task, and onChange.
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.
Confirm Observation usage: @State for root @Observable view models, no redundant wrappers.
Keep behavior intact: do not change layout or business logic unless requested.

### Notes

Prefer small, explicit helpers over large conditional blocks.
Keep computed view builders below body and non-view computed vars above init.
For MV-first guidance and rationale, see references/mv-patterns.md.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: steipete
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-09T15:10:00.641Z
- Expires at: 2026-05-16T15:10:00.641Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/swiftui-view-refactor)
- [Send to Agent page](https://openagent3.xyz/skills/swiftui-view-refactor/agent)
- [JSON manifest](https://openagent3.xyz/skills/swiftui-view-refactor/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/swiftui-view-refactor/agent.md)
- [Download page](https://openagent3.xyz/downloads/swiftui-view-refactor)