agent-transcript
Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.
SwiftUI view refactor/review: layout, DI, Observation, view models.
$ npx -y skills add steipete/agent-scripts --skill swiftui-view-refactor --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/swiftui-view-refactorContext preview
The summary Claude sees to decide when to auto-load this skill.
SwiftUI view refactor/review: layout, DI, Observation, view models.
name: swiftui-view-refactor description: "SwiftUI view refactor/review: layout, DI, Observation, view models."
_Attribution: copied from @Dimillian’s `Dimillian/Skills` (2025-12-31)._
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 (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)
}
}
}Example (Observation-based):
@State private var viewModel: SomeViewModel
init(dependency: Dependency) {
_viewModel = State(initialValue: SomeViewModel(dependency: dependency))
}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. 4) Confirm Observation usage: `@State` for root `@Observable` view models, no redundant wrappers. 5) Keep behavior intact: do not change layout or business logic unless requested.
Shared agent instructions, skills, and small portable helpers for Peter's local workspaces.
Repo: steipete/agent-scripts
Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.
Control the user's existing signed-in Chrome: callable Codex Chrome plugin first, then…
ClawSweeper status: URLs, workflow health, active workers, ops snapshot.
ClickClack ops: chat app, Cloudflare Workers deploy, DNS/docs/app, container rollout.
Cloudflare Registrar: domain availability, prices, registration via mcporter.