Autosave and recovery
Protects editing work through ordered saves, isolated drafts and recovery that respects newer server versions instead of silently overwriting them.
autosave-recovery
See how it helpsWhen is it useful?
Use it when people edit documents over unreliable connections or reopen the app after an interrupted save.
What does it help you do?
- Separates editing, saving, saved and failed states.
- Rejects stale responses and scopes drafts by user and document.
- Compares local drafts with server versions before recovery.
Try asking this
Recover offline edits without overwriting a newer server document. Edit the same paragraph offline and on another device. Offer a comparison before restoring the draft, and never label an unconfirmed upload as saved.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Autosave & Recovery
Use this skill when building saving, autosaving, offline draft caching, network interruption handling, and version conflict recovery for editors.
Explicit Save State Machine & Sequencing
- Never Equate Request Dispatch with "Saved":
- Model persistence with explicit states:
saved(clean),modified(dirty, awaiting debounce),saving(request in flight),error(save failed, retry pending), andconflict(server has a newer version). - Display these states honestly in the UI so users always know whether their latest edits are on the server.
- Model persistence with explicit states:
- Monotonic Sequence Numbers & Out-of-Order Guards:
- Tag every outgoing save with the local revision counter (
clientSeq) and last known server version (baseVersion). - If the user edits while save $S_1$ is in flight, keep the state
modifiedafter $S_1$ resolves (only transitioning tosavedwhenacknowledgedClientSeq === currentClientSeq), and trigger a follow-up save. - Ignore or abort stale responses ($S_1$ arriving after $S_2$) so an older response never overwrites newer local state.
- Tag every outgoing save with the local revision counter (
- Never Rely Solely on Unload Events:
- Page close (
beforeunload/pagehide) requests can be dropped by the browser. Combine debounced server autosave with immediate local draft persistence and warn on navigation when unsaved changes exist.
- Page close (
Local Draft Isolation & Safe Recovery
- Scope Local Drafts by User, Workspace, and Document:
- Key local drafts in IndexedDB/storage by
(workspaceId, userId, documentId)withbaseVersion,updatedAt, and schema version. - Purge or isolate sensitive local drafts on logout, workspace revocation, or TTL expiration.
- Handle storage quota errors (
QuotaExceededError) gracefully without crashing the editor or falsely promising offline recovery.
- Key local drafts in IndexedDB/storage by
- Conflict-Safe Reload & Recovery:
- On load, compare the server's
versionagainst any local un-synced draft'sbaseVersion:- If
localDraft.baseVersion === server.versionandlocalDrafthas un-synced edits, offer to restore the draft. - If
server.version > localDraft.baseVersion(or a save returns409 Conflict), never silently overwrite the newer server document. Pause autosave and let the user inspect, merge, or copy their local draft changes safely.
- If
- On load, compare the server's
Checklist
- Does the UI distinguish
modified,saving,saved,error, andconflictaccurately? - Do monotonic sequence/version checks prevent stale in-flight save responses from overwriting newer edits?
- Are local drafts scoped to
(workspaceId, userId, documentId)and cleared on logout? - Does recovery check
baseVersionagainst the server so newer server versions are never silently overwritten?
Included files 1
SKILL.md
About this skill package
autosave-recovery
autosave-recovery: Build visual and rich-text editors with coherent document models, selection, undo, autosave and reliable serialization.
Show less
autosave-recovery
autosave-recovery: Build visual and rich-text editors with coherent document models, selection, undo, autosave and reliable serialization.
Includes the complete skill and its supporting files (1 files). The exact authored scope is preserved below.
Original skill description (source language)
Use when implementing versioned autosave state machines, out-of-order response guards, tenant-scoped local drafts, and conflict-safe crash/offline recovery.
Install the skill, review its source and trust settings, then enable it for the relevant project or agent.
Requirements
- Orqestria installed on your computer.
