# Idempotency An operation is idempotent if running it multiple times produces the same result as running it once. The second execution is a no-op. ## Examples - **Idempotent**: setting a value to 5, HTTP PUT, deleting a record by ID - **Not idempotent**: incrementing a counter, HTTP POST, appending to a list ## Why it matters Idempotent operations are safe to retry. In distributed systems, network failures mean operations may run more than once. Idempotency makes this harmless. It is a prerequisite for reliable systems. ## In AI skills An idempotent AI skill produces the same structural result given the same context, regardless of how many times it runs. A skill that "lint this note" is idempotent; running it twice does not double-lint. A skill that "append today's date to the note" is not; running it twice adds two dates. Designing skills for idempotency makes them safer to compose and retry. When a multi-skill pipeline fails halfway, idempotent skills can be re-run without cleanup. Closely related to [[Pure Function]]: pure functions are always idempotent because they have no side effects. ## References - ## Related - [[Pure Function]] - [[SOLID Principles]] - [[AI Skill Resilience]] - [[Fail Fast]] - [[Software Design Patterns for AI Skills and Agents]]