본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)15k · #10979

principle-make-operations-idempotent

하는 일

충돌 후에도 안전하게 재시도할 수 있는 작업을 만드는 규칙을 에이전트에 제공합니다. 명령, 작업, 처리 루프를 작성하는 엔지니어를 위한 스킬입니다.

사용하는 경우

  • ✓실패 후 다시 실행될 수 있는 명령이나 작업을 설계할 때.
  • ✓재시작, 재시도, 충돌로 부분적인 상태가 남을 수 있는 경우.
  • ✓중단된 곳에서 안전하게 이어서 처리하는 루프가 필요할 때.

스킬 링크

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-make-operations-idempotent/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-make-operations-idempotent/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“데이터 가져오기 작업이 충돌 후 다시 실행되어도 레코드가 중복되지 않도록 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 각 단계를 현재 상태에서 도출하고, 빠진 차이만 적용합니다. 락이나 임시 파일 같은 남은 표시가 오래된 것인지 알아볼 수 있게 하고, 작업을 두 번 실행하거나 각 지점에서 충돌하면 어떻게 되는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Make Operations Idempotent

Design operations so they converge to the correct state regardless of how many times they run or where the previous run stopped. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"

Why: Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.

The idea: derive each step from the state that exists, not from what the previous run meant to do. Read the current state, compare it to the goal, and apply only the difference. A step written this way is safe to repeat, because a repeat finds nothing left to do.

Anything a run leaves behind, such as a lock, a temporary file, a half-written record, or a claimed job, must be recognizable as stale by the next run. Judge staleness by evidence that stays true wherever the previous run could have stopped, not only in the common case. A marker that the next run cannot judge turns every crash into manual cleanup. For example, write to a temporary path and rename it into place, or compare artifacts by content instead of by creation order.

The test:

  1. What happens if this runs twice in a row?
  2. What happens if the previous run crashed at every possible point?
  3. Does re-execution converge to the same end state?

If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.

자주 묻는 질문

핵심 시험은 무엇인가요?

작업을 연달아 두 번 실행하면 어떻게 되는지, 그리고 마지막 실행이 가능한 모든 지점에서 충돌했다면 어떻게 되는지 묻는 것입니다.

남은 락은 어떻게 처리하나요?

이전 실행이 어디에서 멈췄을 수 있든 계속 참인 증거로, 오래된 락이라고 판단해야 합니다.

임시 파일에 쓰는 방식이 도움이 되나요?

네. 임시 경로에 쓴 뒤 제자리로 이름을 바꾸는 방식은 반만 써진 결과를 피하는 방법 중 하나입니다.

상세 정보

작성자의 원본 설명

Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs.

repo: cursor/plugins

인기도

GitHub 스타
15k
순위
#10979
라이선스
—
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬