command-pattern-implementor
Installation
SKILL.md
Command Pattern Implementor
When to Use
You have a behavioral problem where one or more of these is true:
- UI elements (menu items, toolbar buttons, keyboard shortcuts) need to trigger operations without knowing the receiver or the operation's implementation
- The application requires multi-level undo and redo beyond a single "last action"
- Operations need to be queued, scheduled, logged to disk, or replayed after a crash
- Multiple UI surfaces (menu, button, keyboard shortcut) must trigger the same operation without code duplication
- Operations should be combinable into macro sequences that execute as a unit
Before starting, confirm:
- Can you identify at least one invoker (the object that triggers the request — e.g., a menu item, button, toolbar) and one receiver (the object that knows how to perform the operation — e.g., a document, model, service)?
- Do operations need to be reversible? If so, can each operation store enough state to reverse itself, or does it need an external snapshot (Memento)?
If unsure whether Command is the right pattern, invoke behavioral-pattern-selector first and confirm Command is recommended.