Idempotency And Dedup

Idempotency and Deduplication are strategies for ensuring operations can be safely retried without causing unintended side effects. Idempotent operations produce the same result regardless of how many

16 stars

Best use case

Idempotency And Dedup is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Idempotency and Deduplication are strategies for ensuring operations can be safely retried without causing unintended side effects. Idempotent operations produce the same result regardless of how many

Teams using Idempotency And Dedup should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/idempotency-and-dedup/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/backend/idempotency-and-dedup/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/idempotency-and-dedup/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Idempotency And Dedup Compares

Feature / AgentIdempotency And DedupStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Idempotency and Deduplication are strategies for ensuring operations can be safely retried without causing unintended side effects. Idempotent operations produce the same result regardless of how many

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Idempotency And Dedup

## Skill Profile
*(Select at least one profile to enable specific modules)*
- [ ] **DevOps**
- [x] **Backend**
- [ ] **Frontend**
- [ ] **AI-RAG**
- [ ] **Security Critical**

## Overview
Idempotency and Deduplication are strategies for ensuring operations can be safely retried without causing unintended side effects. Idempotent operations produce the same result regardless of how many times they're called, while deduplication prevents duplicate processing of the same data.

**Core Principle**: "Make operations safe to retry by designing them to be idempotent and detecting duplicates."

## Why This Matters
- **Reliability**: Enables safe retries without side effects
- **Consistency**: Prevents duplicate operations and data inconsistency
- **User Experience**: Users don't see duplicate charges, emails, or actions
- **Cost Control**: Deduplication prevents unnecessary processing costs
- **Debugging**: Idempotency simplifies testing and debugging

---

## Core Concepts & Rules

### 1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs

### 2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment


## Inputs / Outputs / Contracts
* **Inputs**:
  - API endpoint definitions and operation types
  - Message queue configuration
  - Data models and schemas
* **Entry Conditions**:
  - Idempotency keys are defined for non-idempotent operations
  - Deduplication stores are configured
  - Message queue has deduplication enabled
* **Outputs**:
  - Idempotent API implementations
  - Deduplication middleware and filters
  - Idempotency key generation utilities
* **Artifacts Required (Deliverables)**:
  - Idempotency key documentation
  - Deduplication configuration
  - Test cases for idempotent operations
* **Acceptance Evidence**:
  - Load test showing no side effects from retries
  - Deduplication test results (duplicate detection rate)
  - Idempotency key format validation
* **Success Criteria**:
  - Operations can be retried 10+ times without side effects
  - Duplicate detection rate > 99%
  - Idempotency keys follow consistent format

## Skill Composition
* **Depends on**: API Design, Message Queues
* **Compatible with**: Retry Strategies, Circuit Breaker
* **Conflicts with**: Systems that require exact-once semantics
* **Related Skills**: 
  - [40-system-resilience/retry-timeout-strategies](40-system-resilience/retry-timeout-strategies/SKILL.md) - Retry strategies
  - [09-microservices/event-driven](09-microservices/event-driven/SKILL.md) - Message queue deduplication
  - [03-backend-api/api-design](03-backend-api/api-design/SKILL.md) - Idempotent API design

---

## Quick Start / Implementation Example

1. Review requirements and constraints
2. Set up development environment
3. Implement core functionality following patterns
4. Write tests for critical paths
5. Run tests and fix issues
6. Document any deviations or decisions

```python
# Example implementation following best practices
def example_function():
    # Your implementation here
    pass
```


## Assumptions / Constraints / Non-goals

* **Assumptions**:
  - Development environment is properly configured
  - Required dependencies are available
  - Team has basic understanding of domain
* **Constraints**:
  - Must follow existing codebase conventions
  - Time and resource limitations
  - Compatibility requirements
* **Non-goals**:
  - This skill does not cover edge cases outside scope
  - Not a replacement for formal training


## Compatibility & Prerequisites

* **Supported Versions**:
  - Python 3.8+
  - Node.js 16+
  - Modern browsers (Chrome, Firefox, Safari, Edge)
* **Required AI Tools**:
  - Code editor (VS Code recommended)
  - Testing framework appropriate for language
  - Version control (Git)
* **Dependencies**:
  - Language-specific package manager
  - Build tools
  - Testing libraries
* **Environment Setup**:
  - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)


## Test Scenario Matrix (QA Strategy)

| Type | Focus Area | Required Scenarios / Mocks |
| :--- | :--- | :--- |
| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |
| **E2E** | User Journey | Critical user flows to test |
| **Performance** | Latency / Load | Benchmark requirements |
| **Security** | Vuln / Auth | SAST/DAST or dependency audit |
| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |


## Technical Guardrails & Security Threat Model

### 1. Security & Privacy (Threat Model)
* **Top Threats**: Injection attacks, authentication bypass, data exposure
- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
- [ ] **Authorization**: Validate user permissions before state changes

### 2. Performance & Resources
- [ ] **Execution Efficiency**: Consider time complexity for algorithms
- [ ] **Memory Management**: Use streams/pagination for large data
- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks

### 3. Architecture & Scalability
- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
- [ ] **Modularity**: Decouple logic from UI/Frameworks

### 4. Observability & Reliability
- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
- [ ] **Error Handling**: Standardized error codes, no bare except
- [ ] **Observability Artifacts**:
    - **Log Fields**: timestamp, level, message, request_id
    - **Metrics**: request_count, error_count, response_time
    - **Dashboards/Alerts**: High Error Rate > 5%


## Agent Directives & Error Recovery
*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*

- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.


## Definition of Done (DoD) Checklist

- [ ] Tests passed + coverage met
- [ ] Lint/Typecheck passed
- [ ] Logging/Metrics/Trace implemented
- [ ] Security checks passed
- [ ] Documentation/Changelog updated
- [ ] Accessibility/Performance requirements met (if frontend)


## Anti-patterns / Pitfalls

* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries
* ⚠️ **Watch out for**: Common symptoms and quick fixes
* 💡 **Instead**: Use proper error handling, pagination, and logging


## Reference Links & Examples

* Internal documentation and examples
* Official documentation and best practices
* Community resources and discussions


## Versioning & Changelog

* **Version**: 1.0.0
* **Changelog**:
  - 2026-02-22: Initial version with complete template structure

Related Skills

idempotency

16
from diegosouzapw/awesome-omni-skill

Idempotency concepts, patterns for APIs REST, database operations, and implementation strategies. Use when implementing idempotent operations, handling retries, or when ensuring operations can be safely repeated in any language.

deduplicate

16
from diegosouzapw/awesome-omni-skill

Find and refactor duplicate code. Use this skill when the user wants to find near-duplicate code, check for copy-paste redundancy, or DRY up a codebase — optionally scoped to changed files.

deduplication

16
from diegosouzapw/awesome-omni-skill

Event deduplication with canonical selection, reputation scoring, and hash-based grouping for multi-source data aggregation. Handles both ID-based and content-based deduplication.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

koan-entity-first

16
from diegosouzapw/awesome-omni-skill

Entity<T> patterns, GUID v7 auto-generation, static methods vs manual repositories

known-motif-enrichment

16
from diegosouzapw/awesome-omni-skill

This skill should be used when users need to perform known motif enrichment analysis on ChIP-seq, ATAC-seq, or other genomic peak files using HOMER (Hypergeometric Optimization of Motif EnRichment). It identifies enrichment of known transcription factor binding motifs from established databases in genomic regions.

knowledge-synthesis

16
from diegosouzapw/awesome-omni-skill

知识合成 — 将多来源信息融合为结构化知识,生成摘要、报告和知识图谱

klutch

16
from diegosouzapw/awesome-omni-skill

Klutch Agentic Credit Card OpenClaw Skill. Manage virtual cards, transactions, and automated spending patterns.

klipper

16
from diegosouzapw/awesome-omni-skill

Monitor and control Klipper/Moonraker 3D printers with safety confirmations.

kirby-performance-and-media

16
from diegosouzapw/awesome-omni-skill

Improve Kirby performance and media delivery (cache tuning, CDN, responsive images, lazy loading). Use when optimizing page speed, caching, or image handling.

Khorium Developer Rulebook

16
from diegosouzapw/awesome-omni-skill

Senior Engineer protocols for test-first development, pragmatic verification, and robust coding standards

keynote-slides

16
from diegosouzapw/awesome-omni-skill

Build Keynote-style single-file HTML slide decks with brand-ready templates, minimal navigation, and Gemini nano banana media generation. Includes Narrative Engine integration for framework-driven deck creation with 17 proven storytelling structures and 5-agent review panel. Use when creating or editing slide decks, transforming content into presentations, or generating slide visuals.