.claude/skills/undo-module/SKILL.md
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
npx skillsauth add punkfuncgames/tetris-clone undo-moduleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Package: com.punkfuncgames.undo | Define: PUNKFUNC_UNDO
Location: Packages/com.punkfuncgames.undo/Runtime/PunkFuncGames.Undo/
Namespace: PunkFuncGames.Undo
State (Reactive):
ReadOnlyReactiveProperty<int> UndoCount, RedoCountReadOnlyReactiveProperty<bool> CanUndo, CanRedoReadOnlyReactiveProperty<IUndoableCommand> LastCommandOperations:
UniTask ExecuteAsync(IUndoableCommand command, ct) — execute + push to undo stackUniTask UndoAsync(ct), UniTask RedoAsync(ct)Clear(), ClearRedoStack()IUndoableCommand:
string NameUniTask ExecuteAsync(ct), UniTask UndoAsync(ct)IMergeableCommand : IUndoableCommand:
bool TryMerge(IUndoableCommand other) — merge consecutive commands of same typeDependencies: 4 MessagePipe publishers
MaxHistorySize = 100IMergeableCommand and attempts merge with last commandCompositeCommand — executes multiple commands in order, undoes in reverse
CompositeCommand composite = new CompositeCommand("BatchMove",
new MoveTransformCommand(obj, newPos),
new SetVolumeCommand(volumeService, AudioChannel.SFX, 0.5f));
MoveTransformCommand — stores before/after position + optional rotation
new MoveTransformCommand(transform, newPosition);
new MoveTransformCommand(transform, newPosition, newRotation);
SetSettingCommand<T> — undoable ISaveService key-value change (mergeable)
new SetSettingCommand<int>(saveService, "Difficulty", newValue);
SetVolumeCommand — undoable volume change (mergeable)
new SetVolumeCommand(volumeService, AudioChannel.Music, 0.8f);
| Event | Key Fields |
|-------|------------|
| CommandExecutedEvent | Name, Description |
| UndoPerformedEvent | Name |
| RedoPerformedEvent | Name |
| UndoStackClearedEvent | (empty) |
UndoInstaller.Install(builder, options, Lifetime.Singleton); // in ProjectLifetimeScope
UndoInstaller.Install(builder, options, Lifetime.Scoped); // in child scopes
// Registers: UndoRedoService with provided lifetime, 4 event brokers
Third parameter Lifetime lifetime = Lifetime.Scoped controls the service lifetime. Use Lifetime.Singleton in ProjectLifetimeScope and Lifetime.Scoped in MainMenuLifetimeScope/GameplayLifetimeScope.
// Create custom undoable command
public sealed class PlaceBuildingCommand : IUndoableCommand
{
public string Name => "Place Building";
private readonly IBuildingService _service;
private readonly BuildingData _data;
private string _placedId;
public PlaceBuildingCommand(IBuildingService service, BuildingData data)
{ _service = service; _data = data; }
public UniTask ExecuteAsync(CancellationToken ct)
{ _placedId = _service.Place(_data); return UniTask.CompletedTask; }
public UniTask UndoAsync(CancellationToken ct)
{ _service.Remove(_placedId); return UniTask.CompletedTask; }
}
// Execute
await _undoRedoService.ExecuteAsync(new PlaceBuildingCommand(buildingService, data), ct);
// Bind UI
_undoRedoService.CanUndo.Subscribe(can => _undoButton.interactable = can).AddTo(_disposables);
development
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.
content-media
UIModule reference — panel management, dialog service, notifications, loading screen, and localized UI components. Use when working with UI panels, popups, dialogs, or localized text/images.