← Zurück zu Entwickler interner Systeme
Entdecke, wie der Skill hilft
Rückgängig- und Wiederholungsverlauf
Gruppiert Bearbeitung in sinnvolle reversible Aktionen und stellt Auswahl ohne störende Oberflächenereignisse wieder her.
undo-redo-history
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze dies bei zu umfangreichem, zu kleinem oder fremdem Rückgängig.
Wobei hilft er dir?
- Verbindet fortlaufende Eingaben und trennt unterschiedliche Befehle.
- Schließt Cursorbewegungen, Hover und Nichtinhaltsereignisse aus.
- Stellt Auswahl wieder her und verwirft Wiederholen nach neuen Änderungen passend.
Das könntest du fragen
Behandle ein getipptes Wort als einen Rückgängigkeitsschritt und eingefügte Absätze als getrennte Aktion. Tippe ein Wort, füge einen Absatz ein und mache zweimal rückgängig. Beide Aktionen bleiben sinnvolle Einheiten samt Auswahl; neue Bearbeitung löscht den Wiederholungszweig.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Undo/Redo & History
Use this skill when designing or debugging undo/redo stacks, transaction coalescing, history boundaries, and state restoration in visual and block editors.
Human-Meaningful Undo Units (Norman & Haverbeke)
- Coalesce Continuous Micro-Edits, Separate Distinct Actions:
- A user pressing
Cmd/Ctrl+Zexpects to undo a meaningful editing step, not a single character or intermediate drag pixel:- Continuous typing: Coalesce consecutive character insertions within a time window (e.g.,
300–500 ms) at adjacent positions into one undo group; break the group on pause, cursor jump, or block boundary change. - Drag-and-drop / Resize / Slider drag: Record the pre-drag state once on
dragStart, preview intermediate frames without pushing to history, and commit a single undoable transaction ondrop. - Composite commands: Multi-step operations (e.g., "convert block type and migrate children", "paste multi-block fragment", "duplicate section") must execute inside a single transaction or history group so one
Undoreverses the entire operation atomically.
- Continuous typing: Coalesce consecutive character insertions within a time window (e.g.,
- A user pressing
- Exclude Non-Content Events from the Undo Stack:
- Never record background or metadata-only events in the user's undo history (
addToHistory: false):- Autosave status updates, server revision acknowledgments, or dirty-flag changes.
- Viewport pan/zoom, panel collapse/expand, or selection-only changes.
- Lazy-loaded asset metadata resolution or remote presence/awareness updates.
- Never record background or metadata-only events in the user's undo history (
Selection Restoration & History Integrity
- Restore Selection Alongside Content:
- Every history entry must store both the inverse document steps and the pre-/post-transaction selection anchor so
UndoandRedoplace the user's focus and cursor back at the edited location.
- Every history entry must store both the inverse document steps and the pre-/post-transaction selection anchor so
- Clear Redo Branch Only on Genuine Content Edits:
- Navigating, selecting, copying, or autosaving after an
Undomust never wipe theRedostack; only a new history-tracked content transaction clears forward redo entries.
- Navigating, selecting, copying, or autosaving after an
- Bounded History Memory:
- Cap history depth (e.g., 100–500 groups) and store compact structural deltas/steps rather than cloning full multi-megabyte document snapshots on every keystroke.
Checklist
- Are continuous keystrokes coalesced by time/position while drag/resize gestures commit as a single undo step?
- Do composite multi-block operations undo and redo atomically in a single step?
- Are autosave responses, UI view toggles, and background sync metadata excluded from the undo stack?
- Do
UndoandRedorestore both the document structure and the corresponding cursor/block selection?
Enthaltene Dateien 1
SKILL.md
