/scaffolding:scaffolding-state-restorationfrom scaffolding
Captures, restores, migrates, and diagnoses navigation snapshots for Scaffolding-based apps. Supports Codable routes, replay vs replacement, partial-restoration reports, per-scene checkpoints, and hierarchy inspection.
Ships in scaffolding. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use @Scaffoldable(codable: true) on every participating coordinator. All route
parameters must be Codable; prefer stable IDs to model objects. Closure route
parameters cannot be persisted. awaiting: avoids closure payloads, but the
waiting task itself cannot survive process restart.
@MainActor @Observable @Scaffoldable(codable: true)
final class HomeCoordinator: @MainActor FlowCoordinatable {
var stack = FlowStack<HomeCoordinator>(root: .home)
func home() -> some View { HomeView() }
func detail(id: Int) -> some View { DetailView(id: id) }
}
let data = try app.captureNavigationState(version: 1) // throws route-encoding failures
let capture = try app.captureNavigationStateWithReport(version: 1)
persist(capture.data)
for issue in capture.report.issues {
print(issue.coordinator, issue.path, issue.reason, issue.message)
}
Calling either API on an unsupported root coordinator throws
NavigationStateError.unsupported. Unsupported children restore with their
initial internal state; report capture identifies the missing subtrees.
version: is the application's payload version, separate from the library schema.
The no-version capture overload uses application version zero.
let report = try app.restoreNavigationStateWithReport(from: data, mode: .replace)
print(report.restoredRoutes, report.skippedRoutes)
.replace clears existing pushes and modal requests before restoration.
Use it for repeated restoration or seeded stacks. A structural child with no
saved state is recreated through its route factory, even when its route is
unchanged. .replay retains that child's current navigation..replace.restoreNavigationState(from:) overload keeps .replay, applying
captured pushes/modals on top of the current state. Do not assume it replaces.Restore once when establishing a scene, not on every view appearance. Keep snapshots per window when windows have independent coordinators. Persist domain stores separately; restoring navigation must not roll back user data.
let report = try app.restoreNavigationStateWithReport(from: data) { bytes, oldVersion in
try migrateNavigationSnapshot(bytes, from: oldVersion)
}
The application implements migrateNavigationSnapshot. The hook runs before
full decoding or navigation mutation, returns bytes, and may throw to leave the
tree unchanged. Treat snapshots as opaque in ordinary code; isolate payload
migration here and test against saved fixtures. Legacy snapshots have application
version zero.
Captured: route payloads, pushed paths, modal requests and style, tab set and selection, split columns and visibility, preferred compact column, and materialized child navigation.
Not captured: domain stores, local form/view state, callbacks, running tasks, awaited continuations, badges, accessibility identifiers, detents, drag indicators, or interactive-dismiss configuration. Reapply app-owned metadata and configuration. Choose whether transient result flows belong in a checkpoint at all.
A hand-written coordinator initializer may construct:
stack = FlowStack(root: .home, pushing: [.detail(id: itemID)])
The initial path materializes at setup. There is no synthesized init(initialRoute:).
This is useful for previews, tests, and known start positions without persistence.
print(coordinator.hierarchyRoot.debugHierarchy())
debugHierarchy() and hierarchySnapshot() never run route factories. They
show resolved state only; an untouched container may appear empty. Rendering,
navigation, many queries, or activated() in tests resolve initial state.
Use typed hierarchyContains(_:_:as:) assertions from ScaffoldingTesting
in tests rather than matching debug strings. See the scaffolding-testing skill.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dotaeva/scaffolding --plugin scaffolding5 skills in this plugin
/scaffolding-coordinatorsDefine and review Scaffolding SwiftUI coordinators, module boundaries, @Scaffoldable routes, FlowStack, TabItems, Root, and SplitColumns. Use when choosing a coordinator type, diagnosing macro tracking, or composing navigation across features./scaffolding-environmentUse Scaffolding coordinator environment injection and destination metadata in SwiftUI views and previews. Covers ancestor access, opt-out, routeType versus presentationType, and isolated-view preview setup./scaffolding-routingWrite and review Scaffolding navigation: pushes, pops, modal queues, dismissal, typed child access, awaited results, animation scopes, and deep links. Use when choosing a navigation call or migrating deprecated overloads./scaffolding-testingTest Scaffolding navigation with Swift Testing and ScaffoldingTesting. Use for activation, typed hierarchy assertions, deadline-based waits, results and cancellation, tabs, split columns, deep links, or restoration.Other plugins' skills for the same job