[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B2K8YWYWH6ASMXAXY00XGX":3,"skill-same:01M7B2K8YWYWH6ASMXAXY00XGX":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7B2K8YWYWH6ASMXAXY00XGX","pstack-principle-make-operations-idempotent",null,"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.","sandeepsalwan1\u002Fmac-setup","sandeepsalwan1","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118837112?v=4","01M7B2ETGSAY4K5RNVZPF6MEEG","Sandeep Salwan","01M7B2ETHDG8W38G9GV8PR146B",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-make-operations-idempotent\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-make-operations-idempotent\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pstack-principle-make-operations-idempotent\ndescription: \"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.\"\n---\n\n# Make Operations Idempotent\n\nApply 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.\n\nDesign 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?\"\n\n**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.\n\n**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.\n\nAnything 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.\n\n**The test:**\n1. What happens if this runs twice in a row?\n2. What happens if the previous run crashed at every possible point?\n3. Does re-execution converge to the same end state?\n\nIf any answer is \"it depends on what state was left behind,\" the operation needs a reconciliation step.\n","# Make Operations Idempotent\n\nApply 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.\n\nDesign 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?\"\n\n**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.\n\n**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.\n\nAnything 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.\n\n**The test:**\n1. What happens if this runs twice in a row?\n2. What happens if the previous run crashed at every possible point?\n3. Does re-execution converge to the same end state?\n\nIf any answer is \"it depends on what state was left behind,\" the operation needs a reconciliation step.\n",{"name":5,"description":7},"main","1d52087de3c5ac2a463b108745b704f3f7eca32e","skills\u002Fpstack-principle-make-operations-idempotent","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1","sandeeps.tech","GenAI @ Amazon | Builder","2026-11-13 09:45:54",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-make-operations-idempotent",{"tool":39,"command":40},"bunx","bunx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-make-operations-idempotent",{"tool":42,"command":43},"pnpm","pnpm dlx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-make-operations-idempotent","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-make-operations-idempotent\u002FSKILL.md",true,[47],{"path":48,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":16},"LICENSE","许可证",1067,[52,60,68,76,84,92],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":56,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":20},"01M7B2NQWYHKR94T1P7BTC8V14","teach","Teach the user a new skill or concept, within this workspace.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fteach\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fteach\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":64,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":20},"01M7B2NJ7N4B1W33GY3KCE6HVY","stop-overthinking","Manually-invoked skill that stops overthinking and forces a short, practical decision. Use only when the user explicitly invokes stop-overthinking.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fstop-overthinking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fstop-overthinking\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":72,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":20},"01M7B2NAJEG8FCG4NTTSQZ95QP","remind","Rewrite the last response simpler and shorter in plain English, prefixed with a 3-5 sentence TLDR of the conversation so far. Manual-only, invoked as \u002Fremind.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fremind\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fremind\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":20},"01M7B2N8BSH4VY69BM98QKW2XV","read-all-adrs","Read every ADR markdown file in the project's docs\u002Fadr\u002F folder so you have full context on past decisions. Use only when the user explicitly calls it.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fread-all-adrs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fread-all-adrs\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":88,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M7B2N09R80Y1ECQVFH6YQWQ8","pstack-why","Find evidence for design choices and historical constraints through relevant authorized read-only sources; distinguish facts, inferences, and gaps.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-why\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-why\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M7B2MY9HZ0F1RZ93VTFVVQRR","pstack-unslop","Cut AI tells from any writing.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-unslop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-unslop\u002FSKILL.md",[],[]]