Agent skill
efficiency-patterns
Optimize automation with idempotency and work avoidance. Safe retries plus skipping unnecessary operations maximize efficiency in CI/CD and platform engineering.
Install this agent skill to your Project
npx add-skill https://github.com/adaptive-enforcement-lab/claude-skills/tree/main/plugins/patterns/skills/efficiency-patterns
SKILL.md
Efficiency Patterns
When to Use This Skill
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 |
Implementation
See the full implementation guide in the source documentation.
Techniques
Overview
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 |
Decision Flow
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
Quick Reference
| 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 |
Key Difference
| 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.
Comparison
| 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.
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
github-token-permissions-overview
Understanding GITHUB_TOKEN scope, default permissions, and implementing least-privilege principle for GitHub Actions workflows.
secure
Find and fix security issues before they become incidents. Vulnerability scanning, SBOM generation, supply chain security, and secure authentication workflows.
complete-workflow-examples
Copy-paste hardened CI/CD workflows with SHA-pinned actions, minimal GITHUB_TOKEN permissions, OIDC authentication, and comprehensive security scanning for GitHub Actions.
ephemeral-runner-patterns
Disposable runner patterns for GitHub Actions. Container-based, VM-based, and ARC deployment strategies with complete state isolation between jobs.
action-pinning-overview
Why pinning GitHub Actions to SHA-256 commits matters for supply chain security. Attack vectors from unpinned actions and comparison of tag vs SHA pinning.
github-actions-security-patterns-hub
Complete security patterns for GitHub Actions covering action pinning, GITHUB_TOKEN permissions, third-party action risks, secret management, and runner security.
Didn't find tool you were looking for?