Skip to content

Command

Stable ID: pattern.command
Kind: design-pattern
Status: stable
Source: skill/references/design-patterns/command.md

Purpose

Represent an action as data so execution, queuing, auditing, retries, or undo can be handled explicitly.

Use when

  • Actions cross an asynchronous, transactional, or audited boundary.
  • Execution policy should be separate from request creation.

Avoid when

  • A direct function call is synchronous and sufficient.
  • Command objects would only add boilerplate around local calls.

Applicability

  • Languages: any, python, q-kdbplus, cpp, rust, dart-flutter, typescript
  • Related entries: pattern.state-machine