skills/design-patterns/behaviorals/pattern-command/SKILL.md
Teaches and applies the Command behavioral design pattern — encapsulating requests as objects to support parameterization, queuing, logging, and undo/redo operations. Trigger: When implementing undoable operations, task queues, or action history.
npx skillsauth add johnnystefan/test-saas-business pattern-commandInstall 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.
Turns a request into a stand-alone object that contains all information about the request. This allows for parameterizing methods, queuing requests, and supporting undoable operations.
execute().interface Command {
execute(): void;
}
class Light {
// Receiver
turnOn() {
console.log('Light is ON');
}
}
class TurnOnCommand implements Command {
constructor(private light: Light) {}
execute() {
this.light.turnOn();
}
}
class RemoteControl {
// Invoker
private command!: Command;
setCommand(c: Command) {
this.command = c;
}
pressButton() {
this.command.execute();
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.