undo-redo-patterns

Community

Make every database mutation undoable.

Authorjonaseck2
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill solves the confusion and UI bugs that happen when new write operations are not correctly integrated into the app’s undo/redo command pipeline, so actions either can’t be undone or don’t properly trigger renderer refresh.

Core Features & Use Cases

  • Undo command pattern wiring: Use undo wrappers that snapshot pre-mutation state, run the mutating API, and push an UndoAction with reliable undo() and redo() closures.
  • Atomic multi-step undo: Group compound workflows with beginGroup/endGroup so multiple DB writes undo as a single user step.
  • Correct renderer refresh: Ensure IPC registry channels that mutate state are marked mutating: true so fireDataChanged() fans out updates and views stay in sync after undo/redo.
  • Safe snapshot strategy: Snapshot input data with JSON.parse(JSON.stringify(...)) for plain data, and store row objects directly for DB rows to avoid stale reads and corrupted state.
  • Anti-pattern prevention: Avoid bypassing wrappers in IPC handlers and avoid closing over DB lookups inside undo().

Quick Start

Ask the assistant to review a new write API (and its IPC channel) and tell you exactly where to add the undo wrapper, which snapshot to capture, whether to use a group, and whether the channel needs mutating: true for UI refresh.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: undo-redo-patterns
Download link: https://github.com/jonaseck2/slaktforskning/archive/main.zip#undo-redo-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.