[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DDY6V10FSJQN8RCYCYVKSV":3,"skill-same:01M7DDY6V10FSJQN8RCYCYVKSV":45},{"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":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":44},"01M7DDY6V10FSJQN8RCYCYVKSV","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.","just-joshn\u002Fpi-customizations","just-joshn","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F182543166?v=4","01M7DDPCF17YARDX98B7QBFKSR","josh","01M7DDPCG4EHNEA96G8VGNTAEA",5,"MIT","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fextensions\u002Fpi-pstack\u002Fskills\u002Fprinciple-make-operations-idempotent\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: 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.\"\ndisable-model-invocation: true\n---\n\n# Make Operations Idempotent\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\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,"disable-model-invocation":24},true,"main","c138fe622751875571e209ab6bcf05597c337ed8","extensions\u002Fpi-pstack\u002Fskills\u002Fprinciple-make-operations-idempotent",0,"https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations","https:\u002F\u002Fgithub.com\u002Fjust-joshn","2026-11-15 05:30:35",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":24},[34,37,40],{"tool":35,"command":36},"npx","npx skills add just-joshn\u002Fpi-customizations --skill principle-make-operations-idempotent",{"tool":38,"command":39},"bunx","bunx skills add just-joshn\u002Fpi-customizations --skill principle-make-operations-idempotent",{"tool":41,"command":42},"pnpm","pnpm dlx skills add just-joshn\u002Fpi-customizations --skill principle-make-operations-idempotent","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fextensions\u002Fpi-pstack\u002Fskills\u002Fprinciple-make-operations-idempotent\u002FSKILL.md",[],[46,52,59,66,73,80],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7DEF2Q8HVG4D7V49BQB36BE","plant","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fskills\u002Fvitest-best-practices\u002Ftests\u002Ffixtures\u002Fplant\u002FSKILL.md",[],[],{"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":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7DEER2XNBS2HQCZRAX6Y51J","vitest-best-practices","Use when writing or reviewing Vitest tests, fixing flaky or slow tests, debugging failures, structuring suites, writing assertions (toBe vs toEqual vs toStrictEqual, asymmetric matchers, expect.soft, expect.poll, vi.waitFor), testing async code, setup\u002Fteardown hooks, test context and fixtures (test.extend, aroundEach), mocking (vi.fn, vi.spyOn, vi.mock, vi.hoisted, vi.when, classes), fake timers and dates, globals and env stubs, network mocking with MSW, file system mocking, snapshots, type testing (expectTypeOf), DOM environments (jsdom, happy-dom), Browser Mode, component testing (React, Vue, Svelte), benchmarking, database\u002Fintegration tests, test tags and filtering, configuration and projects (monorepos), parallelism and performance, coverage, reporters, CI sharding, or migrating from Jest or Vitest 4. Targets Vitest 5.x.","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fskills\u002Fvitest-best-practices\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7DEENTX6GMHTP282KVY3QQQ","plant-run","A planted skill whose blocks compile; one test fails, one is compile-only, and one never runs.","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-robolectric-best-practices\u002Ftests\u002Ffixtures\u002Fplant-run\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7DEEKR289WV1WR3TA81F29M","nope","A planted skill whose every file holds a mistake the gate must report, one class of mistake per block.","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-robolectric-best-practices\u002Ftests\u002Ffixtures\u002Fplant-compile\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7DEE8A64GK2S0YPM9N6EH1K","compose-robolectric-best-practices","Use when writing or reviewing Jetpack Compose UI tests that run on the JVM with Robolectric, fixing flaky or slow Compose tests, debugging test failures, structuring suites, choosing finders and semantics matchers (onNodeWithText, onNodeWithTag, hasX, useUnmergedTree), assertions, actions and gestures (performClick, performTextInput, performTouchInput, performScrollTo), synchronization (waitForIdle, waitUntil, mainClock, the v2 StandardTestDispatcher test APIs), JUnit rules and fixtures, screen robots, fakes and test data, ViewModel and StateFlow screens, navigation (Navigation Compose, Navigation 3), lists and scrolling, text fields and forms, dialogs and popups, animations and the test clock, configuration changes (qualifiers, dark mode, locale, RTL, font scale, state restoration), View interop, activities, intents, permissions and back press, screenshot tests with Roborazzi, accessibility checks, Robolectric configuration (@Config, sdk, qualifiers, looper and graphics modes), CI, performance, coverage, or migrating from the v1 Compose test APIs. Targets Compose BOM 2026.09 (ui-test 1.12) and Robolectric 4.17.","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fskills\u002Fcompose-robolectric-best-practices\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7DEE4274PNDH8HAQG8CTNWZ","create-skill","Create Cursor Agent Skills. Use when authoring a new skill or asking about SKILL.md structure.","https:\u002F\u002Fgithub.com\u002Fjust-joshn\u002Fpi-customizations\u002Fblob\u002Fmain\u002Fparity\u002Fresearch\u002Fdep-closure-wave-001\u002Fnodes\u002Fcursor-create-skill\u002FSKILL.md",[],[]]