Skip work when outcomes won't change. Detect unchanged content, existing resources, and cached outputs to prevent unnecessary PRs, builds, and processing cycles.
Skip unnecessary operations by detecting unchanged content, existing resources, or cached outputs before executing work. Use when triggering builds, creating PRs, or running scheduled jobs to prevent redundant processing cycles.
/plugin marketplace add adaptive-enforcement-lab/claude-skills/plugin install patterns@ael-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples.mdscripts/example-1.mermaidscripts/example-2.yamlWork avoidance detects when an operation isn't needed and skips it entirely. Unlike idempotency (which makes reruns safe), work avoidance prevents the run from happening at all.
flowchart LR
subgraph trigger[Trigger]
Event[Event Received]
end
subgraph detect[Detection]
Check{Work Needed?}
end
subgraph action[Action]
Skip[Skip]
Execute[Execute]
end
Event --> Check
Check -->|No| Skip
Check -->|Yes| Execute
%% Ghostty Hardcore Theme
style Event fill:#65d9ef,color:#1b1d1e
style Check fill:#fd971e,color:#1b1d1e
style Skip fill:#5e7175,color:#f8f8f3
style Execute fill:#a7e22e,color:#1b1d1e
Work avoidance is valuable when:
Work avoidance uses different techniques depending on what you're checking:
| Technique | Question | Best For |
|---|---|---|
| Content Hashing | "Is the content different?" | File comparisons, config sync |
| Volatile Field Exclusion | "Did anything meaningful change?" | Version bumps, timestamps |
| Existence Checks | "Does it already exist?" | Resource creation (PRs, branches) |
| Cache-Based Skip | "Is the output already built?" | Build artifacts, dependencies |
| Queue Cleanup | "Should queued work execute?" | Mutex-locked workflows |
See Techniques Overview for detailed comparisons and when to use each.
Both patterns make automation safe to rerun, but they optimize for different things:
| Concern | Idempotency | Work Avoidance |
|---|---|---|
| Focus | Safe re-execution | Skipping execution |
| Question | "Can I run this again safely?" | "Should I run this at all?" |
| Resource usage | Uses resources on rerun | Saves resources |
| Implementation | Logic inside operation | Logic before operation |
Best practice: Apply work avoidance first, then ensure remaining operations are idempotent.
Skip work when the outcome won't change.
Detect Before Execute
Check if work is needed before starting it. Avoid creating PRs for unchanged content, running builds for unchanged code, or processing already-processed items.
Work avoidance detects when an operation isn't needed and skips it entirely. Unlike idempotency (which makes reruns safe), work avoidance prevents the run from happening at all.
See examples.md for detailed code examples.
Both patterns make automation safe to rerun, but they optimize for different things:
| Concern | Idempotency | Work Avoidance |
|---|---|---|
| Focus | Safe re-execution | Skipping execution |
| Question | "Can I run this again safely?" | "Should I run this at all?" |
| Resource usage | Uses resources on rerun | Saves resources |
| Implementation | Logic inside operation | Logic before operation |
Best practice: Apply work avoidance first, then ensure remaining operations are idempotent.
Work avoidance uses different techniques depending on what you're checking:
| Technique | Question | Best For |
|---|---|---|
| Content Hashing | "Is the content different?" | File comparisons, config sync |
| Volatile Field Exclusion | "Did anything meaningful change?" | Version bumps, timestamps |
| Existence Checks | "Does it already exist?" | Resource creation (PRs, branches) |
| Cache-Based Skip | "Is the output already built?" | Build artifacts, dependencies |
| Queue Cleanup | "Should queued work execute?" | Mutex-locked workflows |
See Techniques Overview for detailed comparisons and when to use each.
Work avoidance is valuable when:
Common mistakes that undermine work avoidance:
See Anti-Patterns for details and fixes.
A file distribution workflow that skips version-only changes:
See examples.md for detailed code examples.
This applies Volatile Field Exclusion to avoid creating PRs for version-only changes.
Work avoidance detects when an operation isn't needed and skips it entirely. Unlike idempotency (which makes reruns safe), work avoidance prevents the run from happening at all.
See examples.md for detailed code examples.
Both patterns make automation safe to rerun, but they optimize for different things:
| Concern | Idempotency | Work Avoidance |
|---|---|---|
| Focus | Safe re-execution | Skipping execution |
| Question | "Can I run this again safely?" | "Should I run this at all?" |
| Resource usage | Uses resources on rerun | Saves resources |
| Implementation | Logic inside operation | Logic before operation |
Best practice: Apply work avoidance first, then ensure remaining operations are idempotent.
Work avoidance uses different techniques depending on what you're checking:
| Technique | Question | Best For |
|---|---|---|
| Content Hashing | "Is the content different?" | File comparisons, config sync |
| Volatile Field Exclusion | "Did anything meaningful change?" | Version bumps, timestamps |
| Existence Checks | "Does it already exist?" | Resource creation (PRs, branches) |
| Cache-Based Skip | "Is the output already built?" | Build artifacts, dependencies |
| Queue Cleanup | "Should queued work execute?" | Mutex-locked workflows |
See Techniques Overview for detailed comparisons and when to use each.
Work avoidance is valuable when:
Common mistakes that undermine work avoidance:
See Anti-Patterns for details and fixes.
A file distribution workflow that skips version-only changes:
See examples.md for detailed code examples.
This applies Volatile Field Exclusion to avoid creating PRs for version-only changes.
See examples.md for code examples.