Optimize automation with idempotency and work avoidance. Safe retries plus skipping unnecessary operations maximize efficiency in CI/CD and platform engineering.
Implement idempotent operations and work avoidance to optimize automation. Use when writing retryable scripts or CI/CD pipelines to safely skip redundant work and maximize efficiency.
/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.
scripts/example-1.mermaidEfficiency patterns optimize what your automation does and whether it needs to do it.
| Pattern | When to Use | Strategy |
|---|---|---|
| Idempotency | Operations may be retried | Same input = same result |
| Work Avoidance | Results can be cached | Skip if already done |
See the full implementation guide in the source documentation.
Efficiency patterns optimize what your automation does and whether it needs to do it.
| Pattern | When to Use | Strategy |
|---|---|---|
| Idempotency | Operations may be retried | Same input = same result |
| Work Avoidance | Results can be cached | Skip if already done |
flowchart TD
A[Operation Request] --> B{Already done?}
B -->|Yes| C[Work Avoidance: Skip]
B -->|No| D{May be retried?}
D -->|Yes| E[Idempotency: Safe retry]
D -->|No| F[Execute normally]
%% Ghostty Hardcore Theme
style A fill:#65d9ef,color:#1b1d1e
style B fill:#fd971e,color:#1b1d1e
style C fill:#a7e22e,color:#1b1d1e
style D fill:#fd971e,color:#1b1d1e
style E fill:#a7e22e,color:#1b1d1e
style F fill:#9e6ffe,color:#1b1d1e
| Scenario | Pattern | Reasoning |
|---|---|---|
| Re-running same operation | Idempotency | Same result every time |
| Resource already exists | Idempotency | Create-or-update safely |
| Content unchanged | Work Avoidance | Skip unnecessary work |
| Build artifact cached | Work Avoidance | Reuse previous results |
| Aspect | Idempotency | Work Avoidance |
|---|---|---|
| Goal | Safe to retry | Avoid doing work |
| Mechanism | Deterministic result | Change detection |
| Trade-off | Complexity vs reliability | Cache invalidation vs speed |
Idempotency makes retries safe. Work avoidance makes retries unnecessary.
| Aspect | Idempotency | Work Avoidance |
|---|---|---|
| Goal | Safe to retry | Avoid doing work |
| Mechanism | Deterministic result | Change detection |
| Trade-off | Complexity vs reliability | Cache invalidation vs speed |
Idempotency makes retries safe. Work avoidance makes retries unnecessary.