Saltar al contenido
Skillpedia
APIs y servidores (backend)15 mil · #10979

principle-make-operations-idempotent

Qué hace

Ofrece al asistente una regla para construir operaciones que pueden reintentarse con seguridad tras un fallo. Está pensada para ingenieros que escriben comandos, trabajos o bucles de procesamiento.

Cuándo usarla

  • ✓Cuando diseñas un comando o un trabajo que podría volver a ejecutarse tras un fallo.
  • ✓Cuando los reinicios, reintentos o bloqueos podrían dejar estado parcial.
  • ✓Cuando necesitas un bucle de procesamiento que pueda reanudarse con seguridad.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-make-operations-idempotent/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Haz que nuestro trabajo de importación de datos sea seguro para volver a ejecutarse tras un fallo sin duplicar registros.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El asistente deriva cada paso a partir del estado actual y aplica solo la diferencia que falta. Hace reconocibles como obsoletos los marcadores que quedan, como bloqueos o archivos temporales, y comprueba qué pasa si el trabajo se ejecuta dos veces o se bloquea en cada punto.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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.

Preguntas frecuentes

¿Cuál es la prueba clave?

Preguntar qué pasa si la operación se ejecuta dos veces seguidas, y qué pasa si la última ejecución se bloqueó en cada punto posible.

¿Cómo se gestionan los bloqueos que quedan?

Deben juzgarse obsoletos por una evidencia que siga siendo cierta en cualquier punto en el que la ejecución anterior pudo detenerse.

¿Ayuda escribir en un archivo temporal?

Sí. Escribir en una ruta temporal y renombrarla en su sitio es una forma de evitar resultados a medio escribir.

Detalles

Descripción original del autor

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

Popularidad

Estrellas en GitHub
15 mil
Posición en el ranking
#10979
Licencia
—
Actualizada
31/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas