[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M720K15EF30REN63H0SPB5AQ":3,"skill-same:01M720K15EF30REN63H0SPB5AQ":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M720K15EF30REN63H0SPB5AQ","swiftui-view-refactor",null,"SwiftUI view refactor\u002Freview: layout order, DI, Observation, view models, @Observable state init\u002Fpass.","BramVR\u002Fmac-agent-scripts","BramVR","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F30230797?v=4","01M720C63442005A69G8VB2XS8","Bram Van Rompuy","01M720C63TQABCP40HMH3FCGFC",0,"MIT","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fswiftui-view-refactor\u002FSKILL.md",[],[],"2026-11-10 18:39:20",false,"---\nname: swiftui-view-refactor\ndescription: \"SwiftUI view refactor\u002Freview: layout order, DI, Observation, view models, @Observable state init\u002Fpass.\"\n---\n\n# SwiftUI View Refactor\n\n_Attribution: copied from @Dimillian’s `Dimillian\u002FSkills` (2025-12-31)._\n\n## Overview\nApply 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.\n\n## Core Guidelines\n\n### 1) View ordering (top → bottom)\n- Environment\n- `private`\u002F`public` `let`\n- `@State` \u002F other stored properties\n- computed `var` (non-view)\n- `init`\n- `body`\n- computed view builders \u002F other view helpers\n- helper \u002F async functions\n\n### 2) Prefer MV (Model-View) patterns\n- Default to MV: Views are lightweight state expressions; models\u002Fservices own business logic.\n- Favor `@State`, `@Environment`, `@Query`, and `task`\u002F`onChange` for orchestration.\n- Inject services and shared models via `@Environment`; keep views small and composable.\n- Split large views into subviews rather than introducing a view model.\n\n### 3) Split large bodies and view properties\n- If `body` grows beyond a screen or has multiple logical sections, split it into smaller subviews.\n- Extract large computed view properties (`var header: some View { ... }`) into dedicated `View` types when they carry state or complex branching.\n- 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.\n- Prefer passing small inputs (data, bindings, callbacks) over reusing the entire parent view state.\n\nExample (extracting a section):\n\n```swift\nvar body: some View {\n    VStack(alignment: .leading, spacing: 16) {\n        HeaderSection(title: title, isPinned: isPinned)\n        DetailsSection(details: details)\n        ActionsSection(onSave: onSave, onCancel: onCancel)\n    }\n}\n```\n\nExample (long body → shorter body + computed views in the same file):\n\n```swift\nvar body: some View {\n    List {\n        header\n        filters\n        results\n        footer\n    }\n}\n\nprivate var header: some View {\n    VStack(alignment: .leading, spacing: 6) {\n        Text(title).font(.title2)\n        Text(subtitle).font(.subheadline)\n    }\n}\n\nprivate var filters: some View {\n    ScrollView(.horizontal, showsIndicators: false) {\n        HStack {\n            ForEach(filterOptions, id: \\.self) { option in\n                FilterChip(option: option, isSelected: option == selectedFilter)\n                    .onTapGesture { selectedFilter = option }\n            }\n        }\n    }\n}\n```\n\nExample (extracting a complex computed view):\n\n```swift\nprivate var header: some View {\n    HeaderSection(title: title, subtitle: subtitle, status: status)\n}\n\nprivate struct HeaderSection: View {\n    let title: String\n    let subtitle: String?\n    let status: Status\n\n    var body: some View {\n        VStack(alignment: .leading, spacing: 4) {\n            Text(title).font(.headline)\n            if let subtitle { Text(subtitle).font(.subheadline) }\n            StatusBadge(status: status)\n        }\n    }\n}\n```\n\n### 4) View model handling (only if already present)\n- Do not introduce a view model unless the request or existing code clearly calls for one.\n- If a view model exists, make it non-optional when possible.\n- Pass dependencies to the view via `init`, then pass them into the view model in the view's `init`.\n- Avoid `bootstrapIfNeeded` patterns.\n\nExample (Observation-based):\n\n```swift\n@State private var viewModel: SomeViewModel\n\ninit(dependency: Dependency) {\n    _viewModel = State(initialValue: SomeViewModel(dependency: dependency))\n}\n```\n\n### 5) Observation usage\n- For `@Observable` reference types, store them as `@State` in the root view.\n- Pass observables down explicitly as needed; avoid optional state unless required.\n\n## Workflow\n\n1) Reorder the view to match the ordering rules.\n2) Favor MV: move lightweight orchestration into the view using `@State`, `@Environment`, `@Query`, `task`, and `onChange`.\n3) 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.\n4) Confirm Observation usage: `@State` for root `@Observable` view models, no redundant wrappers.\n5) Keep behavior intact: do not change layout or business logic unless requested.\n\n## Notes\n\n- Prefer small, explicit helpers over large conditional blocks.\n- Keep computed view builders below `body` and non-view computed vars above `init`.\n- For MV-first guidance and rationale, see `references\u002Fmv-patterns.md`.\n","# SwiftUI View Refactor\n\n_Attribution: copied from @Dimillian’s `Dimillian\u002FSkills` (2025-12-31)._\n\n## Overview\nApply 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.\n\n## Core Guidelines\n\n### 1) View ordering (top → bottom)\n- Environment\n- `private`\u002F`public` `let`\n- `@State` \u002F other stored properties\n- computed `var` (non-view)\n- `init`\n- `body`\n- computed view builders \u002F other view helpers\n- helper \u002F async functions\n\n### 2) Prefer MV (Model-View) patterns\n- Default to MV: Views are lightweight state expressions; models\u002Fservices own business logic.\n- Favor `@State`, `@Environment`, `@Query`, and `task`\u002F`onChange` for orchestration.\n- Inject services and shared models via `@Environment`; keep views small and composable.\n- Split large views into subviews rather than introducing a view model.\n\n### 3) Split large bodies and view properties\n- If `body` grows beyond a screen or has multiple logical sections, split it into smaller subviews.\n- Extract large computed view properties (`var header: some View { ... }`) into dedicated `View` types when they carry state or complex branching.\n- 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.\n- Prefer passing small inputs (data, bindings, callbacks) over reusing the entire parent view state.\n\nExample (extracting a section):\n\n```swift\nvar body: some View {\n    VStack(alignment: .leading, spacing: 16) {\n        HeaderSection(title: title, isPinned: isPinned)\n        DetailsSection(details: details)\n        ActionsSection(onSave: onSave, onCancel: onCancel)\n    }\n}\n```\n\nExample (long body → shorter body + computed views in the same file):\n\n```swift\nvar body: some View {\n    List {\n        header\n        filters\n        results\n        footer\n    }\n}\n\nprivate var header: some View {\n    VStack(alignment: .leading, spacing: 6) {\n        Text(title).font(.title2)\n        Text(subtitle).font(.subheadline)\n    }\n}\n\nprivate var filters: some View {\n    ScrollView(.horizontal, showsIndicators: false) {\n        HStack {\n            ForEach(filterOptions, id: \\.self) { option in\n                FilterChip(option: option, isSelected: option == selectedFilter)\n                    .onTapGesture { selectedFilter = option }\n            }\n        }\n    }\n}\n```\n\nExample (extracting a complex computed view):\n\n```swift\nprivate var header: some View {\n    HeaderSection(title: title, subtitle: subtitle, status: status)\n}\n\nprivate struct HeaderSection: View {\n    let title: String\n    let subtitle: String?\n    let status: Status\n\n    var body: some View {\n        VStack(alignment: .leading, spacing: 4) {\n            Text(title).font(.headline)\n            if let subtitle { Text(subtitle).font(.subheadline) }\n            StatusBadge(status: status)\n        }\n    }\n}\n```\n\n### 4) View model handling (only if already present)\n- Do not introduce a view model unless the request or existing code clearly calls for one.\n- If a view model exists, make it non-optional when possible.\n- Pass dependencies to the view via `init`, then pass them into the view model in the view's `init`.\n- Avoid `bootstrapIfNeeded` patterns.\n\nExample (Observation-based):\n\n```swift\n@State private var viewModel: SomeViewModel\n\ninit(dependency: Dependency) {\n    _viewModel = State(initialValue: SomeViewModel(dependency: dependency))\n}\n```\n\n### 5) Observation usage\n- For `@Observable` reference types, store them as `@State` in the root view.\n- Pass observables down explicitly as needed; avoid optional state unless required.\n\n## Workflow\n\n1) Reorder the view to match the ordering rules.\n2) Favor MV: move lightweight orchestration into the view using `@State`, `@Environment`, `@Query`, `task`, and `onChange`.\n3) 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.\n4) Confirm Observation usage: `@State` for root `@Observable` view models, no redundant wrappers.\n5) Keep behavior intact: do not change layout or business logic unless requested.\n\n## Notes\n\n- Prefer small, explicit helpers over large conditional blocks.\n- Keep computed view builders below `body` and non-view computed vars above `init`.\n- For MV-first guidance and rationale, see `references\u002Fmv-patterns.md`.\n",{"name":5,"description":7},"main","9943359ac3d8fc05cc503d1b1ce23281450400fe","skills\u002Fswiftui-view-refactor","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts","https:\u002F\u002Fgithub.com\u002FBramVR","https:\u002F\u002Fbramvanrompuy.be","Senior AI & Python engineer turning fragile AI prototypes into reliable production systems. Freelance · Belgium · EU\u002Fremote.","2026-11-10 22:43:17",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add BramVR\u002Fmac-agent-scripts --skill swiftui-view-refactor",{"tool":38,"command":39},"bunx","bunx skills add BramVR\u002Fmac-agent-scripts --skill swiftui-view-refactor",{"tool":41,"command":42},"pnpm","pnpm dlx skills add BramVR\u002Fmac-agent-scripts --skill swiftui-view-refactor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fswiftui-view-refactor\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fmv-patterns.md","REFERENCE","参考文档",7961,"https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fswiftui-view-refactor\u002Freferences\u002Fmv-patterns.md",[53,60,67,74,81,89],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M720KXN6XE37GD67K403G7M3","youtube-to-vault","YouTube video into a vault Source note: transcript, claim extraction, verified quotes, Markdown.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-to-vault\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M720KVSRQ8KRV7AZXCEWEDJQ","xurl","xurl X API CLI: install, auth, app choice, shortcuts, raw endpoints.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M720KRRGENBWNTDV7PYSZNNB","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fwhy\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M720KPRZ4YY1F3R4HB21W4K0","whatsapp","WhatsApp router: history\u002Fsearch\u002Fread\u002Fsend decisions; wacrawl read, wacli live.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fwhatsapp\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M720KN646WP0JRXTR6HDX9T0","what-did-i-get-done","Summarize authored commits over a user-specified time period into a concise update. Use for \"what did I get done\", \"summarize my week\", or a standup update.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fwhat-did-i-get-done\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fwhat-did-i-get-done\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M720KK4495758N0EFWDF1W7A","wacli","WhatsApp linked-device CLI: auth, sync, search, send, live state.","https:\u002F\u002Fgithub.com\u002FBramVR\u002Fmac-agent-scripts\u002Fblob\u002Fmain\u002Fskills\u002Fwacli\u002FSKILL.md",[],[]]