[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E6D872VZJXZDBHXSWZGEPV":3,"skill-same:01M7E6D872VZJXZDBHXSWZGEPV":85},{"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},"01M7E6D872VZJXZDBHXSWZGEPV","scala-effect-cancellation-finalization",null,"Use when a Scala change alters how cancellation, failure and success are distinguished or how cleanup completes - Cats Effect race\u002Fmemoize\u002FFiber.cancel outcomes and bracket\u002Ffinalizer error provenance, ZIO cancel-token bridges and their evaluation executor, Play ApplicationLifecycle partial startup, stop() completion and CoordinatedShutdown draining. Covers outcome and finalization semantics of effect and lifecycle code, not stream scopes, HTTP protocol semantics or binary compatibility.","w0rxbend\u002Fdot-agents","w0rxbend","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8176996?v=4","01M7E4XY3Y871Z2NFBXF3H3T8F","Oleksandr B.","01M7E4XY51E6NSG05FXR36H9RV",0,"MIT","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: scala-effect-cancellation-finalization\ndescription: Use when a Scala change alters how cancellation, failure and success are distinguished or how cleanup completes - Cats Effect race\u002Fmemoize\u002FFiber.cancel outcomes and bracket\u002Ffinalizer error provenance, ZIO cancel-token bridges and their evaluation executor, Play ApplicationLifecycle partial startup, stop() completion and CoordinatedShutdown draining. Covers outcome and finalization semantics of effect and lifecycle code, not stream scopes, HTTP protocol semantics or binary compatibility.\nlicense: MIT\n---\n\n# Cancellation, failure and finalization semantics\n\nFour historically grounded cases (Cats Effect 1\u002F2\u002F3, ZIO 2 RC-era, Play 2.x\u002F3.x lifecycle) share one question: **when\ncomputation ends by success, failure or cancellation, who observes which outcome, which cleanup still runs, who owns it,\non which thread it runs, and when is \"done\" truly done?** Version-pinned material (review quotes, commit links, test\noracles, sbt selectors) lives in one reference per case.\n\n## When to Use\n\n- Refactor shares one implementation across combinators with differing cancellation policies (`race` vs\n  `raceOutcome`), changes memoization state, or wraps `Fiber.cancel` \u002F startup gating.\n- Change touches error combination during cleanup: bracket release failure, finalizer sequences, cancellation\n  utilities, parallel or race error reporting, `addSuppressed`, runtime reporters.\n- Bridge converts foreign\u002Funsafe cancel token into effect, strict vs by-name constructor moves around `blocking`, or\n  shutdown hangs on small compute pool.\n- Lifecycle changes: `ApplicationLifecycle.stop()`, hook ordering, partial-startup cleanup, dev-mode startup hooks\n  ported between Scala and Java, CoordinatedShutdown phases, unbind vs terminate\u002Fdrain.\n- Analogous code in other Scala libraries (Monix, fs2 internals, Ox, Pekko, custom lifecycles) with same invariants:\n  use transferable checks below, mark library-specific claims unverified.\n\n## When Not to Use\n\n- Stream\u002Fresource scope propagation, per-element leases, sink emission cardinality: use\n  `scala-stream-resource-scoping`.\n- HTTP protocol framing, request-local error disclosure, middleware boundaries, channel hand-off: use\n  `scala-http-server-semantics`.\n- Binary\u002Fsource compatibility or typeclass-law surfaces: use `scala-library-compatibility-laws`; general API contracts:\n  `scala-library-contracts`.\n- Runtime diagnostics and hot-path cost (including ZIO diagnostic-reader progress): use\n  `scala-runtime-diagnostics-hot-paths`.\n- General resource-management tutorials, logging policy, migrating to another effect system or build tool. Do not port\n  CE3 `Outcome`\u002F`Poll` into CE2, or Play's Future lifecycle into an effect runtime.\n- Unsure which Scala skill applies: start at `scala-oss-library-review`.\n\n## Prerequisites\n\n1. Pin target: checkout SHA, library line (CE1\u002FCE2\u002FCE3, ZIO 1\u002F2 and RC vs release, Play 2.6–3.x), Scala compiler, JDK,\n   platform (JVM\u002FJS\u002FNative), backend (Akka\u002FPekko HTTP, Netty), mode (dev\u002Fprod\u002Fembedded).\n2. Read concrete implementation **and** abstract contract separately (e.g. IO override vs `Bracket` \u002F `GenSpawn`\n   default; `succeedBlocking` body vs its name; Java port vs replaced Scala).\n3. Read existing tests observing the behavior, even unrelated-looking assertions (logger counter, suppressed-array\n   check, wrapped-cause check).\n4. Load case reference(s) from routing table before applying any historical expectation.\n\n## Shared model: invariants that recur across cases\n\nEach invariant names its grounding case(s). \"Grounded\" means observed in pinned source\u002Freview; all else is labelled\ninference.\n\n**I1. Three outcomes, not two.** Success, failure and cancellation are distinct; per-operator policies differ. Reviewed\nCE3 contract: `raceOutcome` cancels loser even when winner canceled; `race` waits for other result; `racePair` hands\nover a live fiber (outcome case). Canceled memoize evaluation must not be cached as value or error, and must not invent\na `Throwable` for arbitrary `E` (outcome case). Merge two code paths only after their outcome tables agree for both\noperand orders.\n\n**I2. Primary result and secondary cleanup failures travel on separate channels.** Pinned CE1\u002FCE2 IO, on use failure\nplus release failure, returns original use throwable (same identity, suppressed array untouched); release failure goes\nto runtime reporter (cleanup-provenance case). Play's lifecycle recovers failed hook, still runs remaining hooks (Play\ncase). Secondary failure must not replace primary result, must not vanish, must not mutate a possibly shared exception.\n\n**I3. Completion means cleanup finished, for every observer.** Interrupting bridged ZIO effect must invoke underlying\ntoken and await finalization, not only end outer observer (ZIO case). Every `stop()` caller must get a Future completing\nafter last hook; losing caller must not get immediate success (Play case). Canceled memoize evaluation must release\nwaiters. Parent canceled while joining race loser must cancel that loser on both symmetric branches (outcome case).\nOnce-only *execution* (CAS, release-once guard, invocation counter) is not completed *cleanup*. CE2 also awaits\nalready-running release via Promise (cleanup-provenance case).\n\n**I4. Every live child or acquired resource has a reachable owner at every failure point.** Play keeps lifecycle\ncleanup reachable when `ApplicationLoader.load` throws before an Application exists (Play case, PR 8406). Race loser\nfiber has an owner after combinator returns (outcome case). Partial acquisition after last observed event: open\nquestion, not proven leak or proven safety (Play case).\n\n**I5. The moment of evaluation, and its executor, is part of the contract.** ZIO's blocking canceler, evaluated by\nstrict constructor before `blocking` shift, starved cleanup on small compute pool. Fix suspends only cancel invocation\n(`blocking(ZIO.succeed(a))`), not whole workload (ZIO case). Play's Java port turned lazy vals into eager construction,\nrunning user code \u002F watcher before `beforeStarted` (Play case). Memoize construction must stay lazy (outcome case).\n**Counter-rule:** laziness is not automatically safer. Immutable snapshot taken inside its owning callback can move\nonto foreign fiber if deferred (ZIO PR 8819 review). Establish owner first, strictness second.\n\n**I6. Cancellation and shutdown must themselves make bounded progress.** `Fiber.cancel` waiting on startup gate is a\ncancelable cancel; CE3 review rejected it. Masking that wait can make cancel hang instead (outcome case, unmerged PR\n3123). Synchronous cancel token awaiting cleanup must not occupy the executor cleanup needs (ZIO case). Shutdown task\nmust not await the CoordinatedShutdown run awaiting it. Outer waits stay finite, not `Duration.Inf`, with fallback from\nowning API (`cs.timeout(PhaseServiceUnbind)`) (Play case). Uncancelable child can make any cancellation wait forever;\noracles must assume cancelable loser (outcome case).\n\n**I7. Ordering is a completion edge, not textual order.** Hooks run LIFO, sequentially, each after previous hook's\nFuture (Play case). Same-phase CoordinatedShutdown tasks may run concurrently, so dependency needs Future composition or\nlater phase (Play case). Error-reporting fixes must not reorder registration\u002Fremoval or skip later finalizers\n(cleanup-provenance case).\n\n**I8. Concrete implementation vs polymorphic contract.** CE IO regression is not a `Bracket` law for every effect (PR\n394). CE2 `Fiber.join: F[A]` is not CE3 `Outcome` (outcome case). March-2022 ZIO bridge APIs are not current ZIO (ZIO\ncase). Play's January 2020 server still places logger and user hook in one phase, so reviewer requests are not proven\nrepository invariants (Play case). In every finding, distinguish observed code, reviewer proposal, merged decision and\nyour inference.\n\n## Routing table\n\n| Change touches | Load |\n| --- | --- |\n| CE `IOBracket` \u002F `ReleaseRecover`, `composeErrors`, `CancelUtils`, parallel\u002Frace error reporting, `addSuppressed`, stderr \u002F runtime reporter, throwing `Bracket` release | [references\u002Fcats-effect-cleanup-error-provenance.md](references\u002Fcats-effect-cleanup-error-provenance.md) |\n| CE3 `GenSpawn` `race` \u002F `raceOutcome` \u002F `racePair`, `GenConcurrent.memoize`, `Fiber.cancel` wrappers, startup gates \u002F forceStart, `Outcome`\u002F`Poll`, CE2 vs CE3 port | [references\u002Fcats-effect-outcome-sensitive-concurrency.md](references\u002Fcats-effect-outcome-sensitive-concurrency.md) |\n| ZIO `Runtime.run`, `unsafeRunAsyncCancelable`, `asyncInterrupt`, `succeedBlocking` \u002F `blocking` \u002F `succeedNow` vs `succeed`, ZIOApp interruption, logger-on-failure, compute-pool shutdown hang, eager vs lazy callback snapshot | [references\u002Fzio-canceler-evaluation-owner.md](references\u002Fzio-canceler-evaluation-owner.md) |\n| Play `ApplicationLifecycle` \u002F `DefaultApplicationLifecycle`, `ApplicationLoader.load` failure, `DevServerRunner` \u002F `RunHook.beforeStarted` \u002F `assetsClassLoader` \u002F `DevServerReloader`, `AkkaHttpServer` stop, `CoordinatedShutdown` phases, binding unbind vs terminate | [references\u002Fplay-partial-startup-shutdown-completion.md](references\u002Fplay-partial-startup-shutdown-completion.md) |\n| Analogous code elsewhere (other effect runtimes, custom lifecycles, Pekko shutdown) | This file's workflow, then closest reference's oracles, marked transferred |\n\nPinned evidence (byte copies of originals): `references\u002Fevidence\u002F`, one JSON per case, linked from each reference.\n\n## Workflow\n\n1. **Pin and classify.** Record versions\u002Fplatform\u002Fmode (Prerequisites). Classify change: outcome policy (I1),\n   cleanup-error channel (I2), completion meaning (I3), ownership on failure (I4), evaluation timing\u002Fexecutor (I5),\n   cancellation's own progress (I6), ordering (I7). Load routed reference(s).\n2. **Write the outcome × observer table.** Rows: success, failure, self-cancellation, parent\u002Fexternal cancellation,\n   failure during cleanup, simultaneous failures; both operand orders for binary combinators. Columns: value returned to\n   caller, reporter\u002Flog output, finalizers run and order, live children left, completion time per observer (each\n   `stop()` caller, each memoize waiter, interrupter). Fill before and after change.\n3. **Trace the evaluation path.** Per cleanup\u002Fcancel action: where constructed, where invoked, which\n   fiber\u002Fthread\u002Fexecutor owns invocation, what it waits on. Expand wrappers until strictness shows (by-name into strict\n   constructor; lazy val into eager Java field). Mark actions evaluated during construction.\n4. **Trace ownership at each failure point.** Per acquisition\u002Ffork, name owner that cancels\u002Fcloses it if next step\n   fails, including before the \"success object\" (Application, joined result) exists.\n5. **Trace all siblings of a changed helper.** Before changing or deleting a shared helper, search definitions and\n   usages (JVM and JS sources, race and parallel paths, neighbouring bridge wrappers, both symmetric branches).\n6. **Check progress and bounds.** Find waits inside cancel\u002Fshutdown paths: gates, `OneShot.get`, self-awaiting shutdown\n   tasks, unbounded outer waits, phase budgets eaten by sequential per-binding waits.\n7. **Choose the minimal correction.** Fix the semantics' owner (e.g. `Runtime.run`, not only ZIOApp; separate\n   canceled-winner policy, not only extra `onCancel`). Keep existing independent observations (logger test, wrapped\n   cause test, suppressed-array check); do not weaken them.\n8. **Design a discriminating regression** with explicit barriers\u002Fstartup signals or repository's virtual scheduler, not\n   sleeps; finite external deadlines; thread-safe traces. Name mutation each test must kill.\n\n## Review and Refactoring Checks\n\nTransferable (any Scala effect or lifecycle code):\n\n- [ ] Cancellation stays distinguishable from error at every return type exposing it (I1).\n- [ ] Helpers shared only where per-operator outcome policies agree, both operand orders (I1).\n- [ ] Secondary cleanup errors neither replace primary result nor disappear; no `addSuppressed` on possibly shared\n      throwable; preexisting suppressed entries unchanged (I2).\n- [ ] Every observer's completion follows last cleanup effect; no early `successful` for losing callers (I3).\n- [ ] Once-only guards not mistaken for completed cleanup; already-running release awaited where target does so (I3).\n- [ ] Parent cancellation during join\u002Fwait cancels owned child on every branch (I3, I4).\n- [ ] Cleanup reachable when construction fails midway (I4).\n- [ ] No cleanup\u002Fcancel action evaluated at construction time; blocking cancel waits do not run on the executor\n      cleanup needs (I5).\n- [ ] Laziness not demanded blindly: owner-confined eager snapshots are legitimate (I5 counter-rule).\n- [ ] Cancel itself not cancelable\u002Fgated indefinitely; shutdown has no self-wait; outer waits finite (I6).\n- [ ] Cleanup-task dependencies are real completion edges, not registration order or same-phase placement (I7).\n- [ ] Later finalizers still run after earlier one fails; LIFO preserved where promised (I2, I7).\n\nLibrary\u002Fversion-specific (verify against pinned target before applying):\n\n- CE1\u002FCE2 IO: release failure goes to reporter (`System.err` in those snapshots); CE2 release Promise wait. CE3\n  reporter behavior not established.\n- CE3 (2021 pre-release memoize; unmerged PR 3232 race \u002F PR 3123 forceStart): `raceOutcome` vs `race` canceled-winner\n  policy; memoize cancel resets state, releases latch; retry test expects two starts, one completion.\n- ZIO `series\u002F2.x` March 2022: `succeedBlocking = blocking(ZIO.succeed(a))`; token invocation waits on `OneShot.get`.\n- Play: `DefaultApplicationLifecycle` CAS, deque, shared Promise (2018); `cs.timeout(PhaseServiceUnbind)` fallback and\n  binding terminate (2020, Akka HTTP); `beforeStarted` before `assetsClassLoader`\u002Freloader in Java run-support (2024).\n\n## Consolidated false positives\n\n- Immutable domain-error aggregation with documented policy, or new adapter-owned exception collecting suppressed\n  errors: not reusable-Throwable mutation (cleanup-provenance).\n- Custom `Bracket` returning aggregate is not wrong because CE1 IO reports to stderr; throwing release function needs\n  own concrete analysis (cleanup-provenance, PR 394).\n- `racePair` caller may deliberately keep loser; later memoize may legitimately use internal fiber; 2021 caller-fiber\n  design is not a universal ban (outcome).\n- Uncancelable child can make cancellation wait forever; not a race-combinator bug (outcome).\n- CE2 subscriber-counted memoizer with `Fiber.join: F[A]` is not missing CE3 `Outcome` (outcome).\n- Not eager-evaluation defects: cancel token only scheduling nonblocking cancellation, already-computed immutable\n  value, eager snapshot inside its legitimate owner. `ensuring` after guarded effect begins is fine. Larger compute\n  pool hiding a hang is not proof of equivalence (ZIO).\n- Internal AtomicBoolean\u002FPromise mutation in Play's lifecycle is observed design. Independent same-phase tasks may run\n  concurrently. Genuinely completed hook may return already-successful Future. Moving already-computed port number\n  into a local changes no timing (Play).\n- Untraced helper is investigation gap, not confirmed deadlock or leak (all cases).\n\n## Version fences\n\n| Case | Pinned evidence | Do not assume for |\n| --- | --- | --- |\n| Cleanup provenance | CE1 `c6d7dd5e` (Scala 2.11.12\u002F2.12.7\u002F2.13.0-M5, default 2.12.6; Cats 1.5.0; JVM+JS); CE2 `1b51cb14` | CE3 reporter behavior; other effects' `Bracket` |\n| Outcome concurrency | CE3 pre-release `000758b0` (memoize, merged); `f6917ccc` (race, unmerged); PR 3123 (unmerged); CE2 `1b51cb14` (2.6; Scala 2.12.15\u002F2.13.8\u002F3.0.2; Scala.js 1.7.1) | Every CE3 release; CE2 APIs |\n| ZIO canceler | `60d47847` `series\u002F2.x` March 2022, RC-era (sbt 1.6.2; Scala 2.11.12\u002F2.12.15\u002F2.13.8\u002F3.1.1; JDK 17 + 8\u002F11) | Released ZIO 2 `Unsafe` APIs; Native (test = compile) |\n| Play lifecycle | 2018 `6059f791`; 2020 `5b4eaf91` (Akka HTTP); 2024 `15cf5d6b` (Java run-support); build eras 2020\u002F2022\u002F2024 (Akka → Pekko, IntegrationTest → Test) | Same-year PRs' dependency versions; today's Akka\u002FPekko |\n\n## Validation\n\n- **No upstream build or test ran while researching or authoring any case.** Every command in references is a future\n  instruction for separately authorized, isolated checkout; loading sbt executes build code.\n- **Discover targets first:** read `build.sbt`, `project\u002Fbuild.properties`, `project\u002Fplugins.sbt` (and\n  `project\u002FBuildHelper.scala` \u002F `BuildSettings.scala` where present), CI selectors, test package names; then\n  `sbt projects` (Play also: `sbt 'show Play \u002F Test \u002F definedTests'`). Test projects often separate from production\n  modules (`lawsJVM`, `testsJVM`, `coreTestsJVM`, `Play-Run-Support`, `Sbt-Plugin`).\n- **Require nonzero execution** of selected suite and specific cases; green command with zero tests proves nothing.\n  Structural skill\u002Fschema checks prove no runtime property.\n- **Run each platform independently** (JVM, JS); Native in ZIO snapshot only compiles.\n- **Global sinks and timing:** capture-based tests (e.g. `System.err`) need serialized execution and restoration on\n  failure; constrained-executor tests need external deadline; scripted Play tests need matching locally published\n  artifacts without silently publishing into user's cache.\n- Concrete selectors and oracles: each reference's Validation section.\n\n## Examples\n\n### Good\n\nPR unifies CE3 race internals. Reviewer writes outcome table for `race` and `raceOutcome` in both operand orders, finds\ncanceled-winner rows differ, keeps those paths separate, adds parent-cancel-during-join tests for both branches (I1,\nI3; outcome reference). Checking a ZIO bridge in same codebase, same reviewer confirms cancel token is invoked inside\n`blocking(ZIO.succeed(...))` and interrupt completion waits for finalizer flag (I3, I5; ZIO reference).\n\n### Broken and Correction\n\nLifecycle refactor (a) returns `Future.successful(Done)` to every `stop()` caller after the first and (b) in cleanup\ncalls `primary.addSuppressed(hookError)` before rethrowing. Tests check only invocation count and returned error. Both\nare I3\u002FI2 violations hidden by weak oracles. Composite illustrative example, not a single historical PR.\nCorrection: share pending completion Promise across callers. Recover hook failure without mutating primary throwable\n(keep it observable through whatever secondary channel target already uses); keep running remaining hooks LIFO. Add\nbarrier test holding last hook while two callers observe pending Futures, and repeated-evaluation test asserting\nunchanged suppressed arrays (Play and cleanup-provenance references).\n\n### Negative\n\nZIO callback eagerly reads mutable child state inside its owning fiber, returns immutable snapshot. Reviewer cites I5\nto demand laziness. Reject: counter-rule applies. Eager read is owner-confined; deferring it would execute on foreign\ncaller (ZIO reference, PR 8819). Likewise, do not flag a CE2 memoizer for lacking `Outcome` (I8).\n\n## Output Contract\n\n1. Target: SHA, library line, Scala\u002FJDK, platform, backend\u002Fmode.\n2. Outcome × observer table (before\u002Fafter) and evaluation\u002Fownership trace for touched actions.\n3. Findings, each with `file:line`, severity, violated invariant (I1–I8), evidence (pinned citation or evidence ID from\n   `references\u002Fevidence\u002F`), minimal correction, discriminating test naming the mutation it kills.\n4. Separate: observed source, reviewer proposal, merged decision, your inference; confirmed defects vs missing\n   assertions vs suspected schedules vs investigation gaps.\n5. Commands actually executed with results, vs proposed tests, vs blocked by prerequisites. Explicit no-finding when\n   trace is preserved.\n\n## Limitations\n\n- Each case rests on few pinned snapshots and review threads. Together they support a decision procedure, not proof\n  over all schedules or universal leak freedom.\n- Several grounding proposals unmerged (CE PR 3232 race helper, PR 3123 forceStart); ZIO PR 8819's design superseded.\n  Their review arguments are used, not their code.\n- Newer lines (CE3 releases, released ZIO 2 `Unsafe` APIs, Pekko-era Play) must be re-read before applying any\n  historical expectation.\n- Reviewer logins identify participants only; formal maintainer roles not verified.\n- Evaluated by model-based review of source and history; no upstream build, signal delivery or constrained-executor\n  experiment ran, and no effectiveness measurement against a baseline agent exists.\n\n## Sources\n\n- [Cats Effect cleanup-error provenance](references\u002Fcats-effect-cleanup-error-provenance.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-cats-effect-cleanup-error-provenance.json); PR 458, PR 394.\n- [Cats Effect outcome-sensitive concurrency](references\u002Fcats-effect-outcome-sensitive-concurrency.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-cats-effect-outcome-sensitive-concurrency.json); PR 1552, PR 3232, PR 3123.\n- [ZIO canceler evaluation owner](references\u002Fzio-canceler-evaluation-owner.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-zio-canceler-evaluation-owner.json); PR 6401, PR 8819.\n- [Play partial startup and shutdown completion](references\u002Fplay-partial-startup-shutdown-completion.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-play-partial-startup-shutdown-completion.json); PR 8406, PR 9970, PR 12210.\n","# Cancellation, failure and finalization semantics\n\nFour historically grounded cases (Cats Effect 1\u002F2\u002F3, ZIO 2 RC-era, Play 2.x\u002F3.x lifecycle) share one question: **when\ncomputation ends by success, failure or cancellation, who observes which outcome, which cleanup still runs, who owns it,\non which thread it runs, and when is \"done\" truly done?** Version-pinned material (review quotes, commit links, test\noracles, sbt selectors) lives in one reference per case.\n\n## When to Use\n\n- Refactor shares one implementation across combinators with differing cancellation policies (`race` vs\n  `raceOutcome`), changes memoization state, or wraps `Fiber.cancel` \u002F startup gating.\n- Change touches error combination during cleanup: bracket release failure, finalizer sequences, cancellation\n  utilities, parallel or race error reporting, `addSuppressed`, runtime reporters.\n- Bridge converts foreign\u002Funsafe cancel token into effect, strict vs by-name constructor moves around `blocking`, or\n  shutdown hangs on small compute pool.\n- Lifecycle changes: `ApplicationLifecycle.stop()`, hook ordering, partial-startup cleanup, dev-mode startup hooks\n  ported between Scala and Java, CoordinatedShutdown phases, unbind vs terminate\u002Fdrain.\n- Analogous code in other Scala libraries (Monix, fs2 internals, Ox, Pekko, custom lifecycles) with same invariants:\n  use transferable checks below, mark library-specific claims unverified.\n\n## When Not to Use\n\n- Stream\u002Fresource scope propagation, per-element leases, sink emission cardinality: use\n  `scala-stream-resource-scoping`.\n- HTTP protocol framing, request-local error disclosure, middleware boundaries, channel hand-off: use\n  `scala-http-server-semantics`.\n- Binary\u002Fsource compatibility or typeclass-law surfaces: use `scala-library-compatibility-laws`; general API contracts:\n  `scala-library-contracts`.\n- Runtime diagnostics and hot-path cost (including ZIO diagnostic-reader progress): use\n  `scala-runtime-diagnostics-hot-paths`.\n- General resource-management tutorials, logging policy, migrating to another effect system or build tool. Do not port\n  CE3 `Outcome`\u002F`Poll` into CE2, or Play's Future lifecycle into an effect runtime.\n- Unsure which Scala skill applies: start at `scala-oss-library-review`.\n\n## Prerequisites\n\n1. Pin target: checkout SHA, library line (CE1\u002FCE2\u002FCE3, ZIO 1\u002F2 and RC vs release, Play 2.6–3.x), Scala compiler, JDK,\n   platform (JVM\u002FJS\u002FNative), backend (Akka\u002FPekko HTTP, Netty), mode (dev\u002Fprod\u002Fembedded).\n2. Read concrete implementation **and** abstract contract separately (e.g. IO override vs `Bracket` \u002F `GenSpawn`\n   default; `succeedBlocking` body vs its name; Java port vs replaced Scala).\n3. Read existing tests observing the behavior, even unrelated-looking assertions (logger counter, suppressed-array\n   check, wrapped-cause check).\n4. Load case reference(s) from routing table before applying any historical expectation.\n\n## Shared model: invariants that recur across cases\n\nEach invariant names its grounding case(s). \"Grounded\" means observed in pinned source\u002Freview; all else is labelled\ninference.\n\n**I1. Three outcomes, not two.** Success, failure and cancellation are distinct; per-operator policies differ. Reviewed\nCE3 contract: `raceOutcome` cancels loser even when winner canceled; `race` waits for other result; `racePair` hands\nover a live fiber (outcome case). Canceled memoize evaluation must not be cached as value or error, and must not invent\na `Throwable` for arbitrary `E` (outcome case). Merge two code paths only after their outcome tables agree for both\noperand orders.\n\n**I2. Primary result and secondary cleanup failures travel on separate channels.** Pinned CE1\u002FCE2 IO, on use failure\nplus release failure, returns original use throwable (same identity, suppressed array untouched); release failure goes\nto runtime reporter (cleanup-provenance case). Play's lifecycle recovers failed hook, still runs remaining hooks (Play\ncase). Secondary failure must not replace primary result, must not vanish, must not mutate a possibly shared exception.\n\n**I3. Completion means cleanup finished, for every observer.** Interrupting bridged ZIO effect must invoke underlying\ntoken and await finalization, not only end outer observer (ZIO case). Every `stop()` caller must get a Future completing\nafter last hook; losing caller must not get immediate success (Play case). Canceled memoize evaluation must release\nwaiters. Parent canceled while joining race loser must cancel that loser on both symmetric branches (outcome case).\nOnce-only *execution* (CAS, release-once guard, invocation counter) is not completed *cleanup*. CE2 also awaits\nalready-running release via Promise (cleanup-provenance case).\n\n**I4. Every live child or acquired resource has a reachable owner at every failure point.** Play keeps lifecycle\ncleanup reachable when `ApplicationLoader.load` throws before an Application exists (Play case, PR 8406). Race loser\nfiber has an owner after combinator returns (outcome case). Partial acquisition after last observed event: open\nquestion, not proven leak or proven safety (Play case).\n\n**I5. The moment of evaluation, and its executor, is part of the contract.** ZIO's blocking canceler, evaluated by\nstrict constructor before `blocking` shift, starved cleanup on small compute pool. Fix suspends only cancel invocation\n(`blocking(ZIO.succeed(a))`), not whole workload (ZIO case). Play's Java port turned lazy vals into eager construction,\nrunning user code \u002F watcher before `beforeStarted` (Play case). Memoize construction must stay lazy (outcome case).\n**Counter-rule:** laziness is not automatically safer. Immutable snapshot taken inside its owning callback can move\nonto foreign fiber if deferred (ZIO PR 8819 review). Establish owner first, strictness second.\n\n**I6. Cancellation and shutdown must themselves make bounded progress.** `Fiber.cancel` waiting on startup gate is a\ncancelable cancel; CE3 review rejected it. Masking that wait can make cancel hang instead (outcome case, unmerged PR\n3123). Synchronous cancel token awaiting cleanup must not occupy the executor cleanup needs (ZIO case). Shutdown task\nmust not await the CoordinatedShutdown run awaiting it. Outer waits stay finite, not `Duration.Inf`, with fallback from\nowning API (`cs.timeout(PhaseServiceUnbind)`) (Play case). Uncancelable child can make any cancellation wait forever;\noracles must assume cancelable loser (outcome case).\n\n**I7. Ordering is a completion edge, not textual order.** Hooks run LIFO, sequentially, each after previous hook's\nFuture (Play case). Same-phase CoordinatedShutdown tasks may run concurrently, so dependency needs Future composition or\nlater phase (Play case). Error-reporting fixes must not reorder registration\u002Fremoval or skip later finalizers\n(cleanup-provenance case).\n\n**I8. Concrete implementation vs polymorphic contract.** CE IO regression is not a `Bracket` law for every effect (PR\n394). CE2 `Fiber.join: F[A]` is not CE3 `Outcome` (outcome case). March-2022 ZIO bridge APIs are not current ZIO (ZIO\ncase). Play's January 2020 server still places logger and user hook in one phase, so reviewer requests are not proven\nrepository invariants (Play case). In every finding, distinguish observed code, reviewer proposal, merged decision and\nyour inference.\n\n## Routing table\n\n| Change touches | Load |\n| --- | --- |\n| CE `IOBracket` \u002F `ReleaseRecover`, `composeErrors`, `CancelUtils`, parallel\u002Frace error reporting, `addSuppressed`, stderr \u002F runtime reporter, throwing `Bracket` release | [references\u002Fcats-effect-cleanup-error-provenance.md](references\u002Fcats-effect-cleanup-error-provenance.md) |\n| CE3 `GenSpawn` `race` \u002F `raceOutcome` \u002F `racePair`, `GenConcurrent.memoize`, `Fiber.cancel` wrappers, startup gates \u002F forceStart, `Outcome`\u002F`Poll`, CE2 vs CE3 port | [references\u002Fcats-effect-outcome-sensitive-concurrency.md](references\u002Fcats-effect-outcome-sensitive-concurrency.md) |\n| ZIO `Runtime.run`, `unsafeRunAsyncCancelable`, `asyncInterrupt`, `succeedBlocking` \u002F `blocking` \u002F `succeedNow` vs `succeed`, ZIOApp interruption, logger-on-failure, compute-pool shutdown hang, eager vs lazy callback snapshot | [references\u002Fzio-canceler-evaluation-owner.md](references\u002Fzio-canceler-evaluation-owner.md) |\n| Play `ApplicationLifecycle` \u002F `DefaultApplicationLifecycle`, `ApplicationLoader.load` failure, `DevServerRunner` \u002F `RunHook.beforeStarted` \u002F `assetsClassLoader` \u002F `DevServerReloader`, `AkkaHttpServer` stop, `CoordinatedShutdown` phases, binding unbind vs terminate | [references\u002Fplay-partial-startup-shutdown-completion.md](references\u002Fplay-partial-startup-shutdown-completion.md) |\n| Analogous code elsewhere (other effect runtimes, custom lifecycles, Pekko shutdown) | This file's workflow, then closest reference's oracles, marked transferred |\n\nPinned evidence (byte copies of originals): `references\u002Fevidence\u002F`, one JSON per case, linked from each reference.\n\n## Workflow\n\n1. **Pin and classify.** Record versions\u002Fplatform\u002Fmode (Prerequisites). Classify change: outcome policy (I1),\n   cleanup-error channel (I2), completion meaning (I3), ownership on failure (I4), evaluation timing\u002Fexecutor (I5),\n   cancellation's own progress (I6), ordering (I7). Load routed reference(s).\n2. **Write the outcome × observer table.** Rows: success, failure, self-cancellation, parent\u002Fexternal cancellation,\n   failure during cleanup, simultaneous failures; both operand orders for binary combinators. Columns: value returned to\n   caller, reporter\u002Flog output, finalizers run and order, live children left, completion time per observer (each\n   `stop()` caller, each memoize waiter, interrupter). Fill before and after change.\n3. **Trace the evaluation path.** Per cleanup\u002Fcancel action: where constructed, where invoked, which\n   fiber\u002Fthread\u002Fexecutor owns invocation, what it waits on. Expand wrappers until strictness shows (by-name into strict\n   constructor; lazy val into eager Java field). Mark actions evaluated during construction.\n4. **Trace ownership at each failure point.** Per acquisition\u002Ffork, name owner that cancels\u002Fcloses it if next step\n   fails, including before the \"success object\" (Application, joined result) exists.\n5. **Trace all siblings of a changed helper.** Before changing or deleting a shared helper, search definitions and\n   usages (JVM and JS sources, race and parallel paths, neighbouring bridge wrappers, both symmetric branches).\n6. **Check progress and bounds.** Find waits inside cancel\u002Fshutdown paths: gates, `OneShot.get`, self-awaiting shutdown\n   tasks, unbounded outer waits, phase budgets eaten by sequential per-binding waits.\n7. **Choose the minimal correction.** Fix the semantics' owner (e.g. `Runtime.run`, not only ZIOApp; separate\n   canceled-winner policy, not only extra `onCancel`). Keep existing independent observations (logger test, wrapped\n   cause test, suppressed-array check); do not weaken them.\n8. **Design a discriminating regression** with explicit barriers\u002Fstartup signals or repository's virtual scheduler, not\n   sleeps; finite external deadlines; thread-safe traces. Name mutation each test must kill.\n\n## Review and Refactoring Checks\n\nTransferable (any Scala effect or lifecycle code):\n\n- [ ] Cancellation stays distinguishable from error at every return type exposing it (I1).\n- [ ] Helpers shared only where per-operator outcome policies agree, both operand orders (I1).\n- [ ] Secondary cleanup errors neither replace primary result nor disappear; no `addSuppressed` on possibly shared\n      throwable; preexisting suppressed entries unchanged (I2).\n- [ ] Every observer's completion follows last cleanup effect; no early `successful` for losing callers (I3).\n- [ ] Once-only guards not mistaken for completed cleanup; already-running release awaited where target does so (I3).\n- [ ] Parent cancellation during join\u002Fwait cancels owned child on every branch (I3, I4).\n- [ ] Cleanup reachable when construction fails midway (I4).\n- [ ] No cleanup\u002Fcancel action evaluated at construction time; blocking cancel waits do not run on the executor\n      cleanup needs (I5).\n- [ ] Laziness not demanded blindly: owner-confined eager snapshots are legitimate (I5 counter-rule).\n- [ ] Cancel itself not cancelable\u002Fgated indefinitely; shutdown has no self-wait; outer waits finite (I6).\n- [ ] Cleanup-task dependencies are real completion edges, not registration order or same-phase placement (I7).\n- [ ] Later finalizers still run after earlier one fails; LIFO preserved where promised (I2, I7).\n\nLibrary\u002Fversion-specific (verify against pinned target before applying):\n\n- CE1\u002FCE2 IO: release failure goes to reporter (`System.err` in those snapshots); CE2 release Promise wait. CE3\n  reporter behavior not established.\n- CE3 (2021 pre-release memoize; unmerged PR 3232 race \u002F PR 3123 forceStart): `raceOutcome` vs `race` canceled-winner\n  policy; memoize cancel resets state, releases latch; retry test expects two starts, one completion.\n- ZIO `series\u002F2.x` March 2022: `succeedBlocking = blocking(ZIO.succeed(a))`; token invocation waits on `OneShot.get`.\n- Play: `DefaultApplicationLifecycle` CAS, deque, shared Promise (2018); `cs.timeout(PhaseServiceUnbind)` fallback and\n  binding terminate (2020, Akka HTTP); `beforeStarted` before `assetsClassLoader`\u002Freloader in Java run-support (2024).\n\n## Consolidated false positives\n\n- Immutable domain-error aggregation with documented policy, or new adapter-owned exception collecting suppressed\n  errors: not reusable-Throwable mutation (cleanup-provenance).\n- Custom `Bracket` returning aggregate is not wrong because CE1 IO reports to stderr; throwing release function needs\n  own concrete analysis (cleanup-provenance, PR 394).\n- `racePair` caller may deliberately keep loser; later memoize may legitimately use internal fiber; 2021 caller-fiber\n  design is not a universal ban (outcome).\n- Uncancelable child can make cancellation wait forever; not a race-combinator bug (outcome).\n- CE2 subscriber-counted memoizer with `Fiber.join: F[A]` is not missing CE3 `Outcome` (outcome).\n- Not eager-evaluation defects: cancel token only scheduling nonblocking cancellation, already-computed immutable\n  value, eager snapshot inside its legitimate owner. `ensuring` after guarded effect begins is fine. Larger compute\n  pool hiding a hang is not proof of equivalence (ZIO).\n- Internal AtomicBoolean\u002FPromise mutation in Play's lifecycle is observed design. Independent same-phase tasks may run\n  concurrently. Genuinely completed hook may return already-successful Future. Moving already-computed port number\n  into a local changes no timing (Play).\n- Untraced helper is investigation gap, not confirmed deadlock or leak (all cases).\n\n## Version fences\n\n| Case | Pinned evidence | Do not assume for |\n| --- | --- | --- |\n| Cleanup provenance | CE1 `c6d7dd5e` (Scala 2.11.12\u002F2.12.7\u002F2.13.0-M5, default 2.12.6; Cats 1.5.0; JVM+JS); CE2 `1b51cb14` | CE3 reporter behavior; other effects' `Bracket` |\n| Outcome concurrency | CE3 pre-release `000758b0` (memoize, merged); `f6917ccc` (race, unmerged); PR 3123 (unmerged); CE2 `1b51cb14` (2.6; Scala 2.12.15\u002F2.13.8\u002F3.0.2; Scala.js 1.7.1) | Every CE3 release; CE2 APIs |\n| ZIO canceler | `60d47847` `series\u002F2.x` March 2022, RC-era (sbt 1.6.2; Scala 2.11.12\u002F2.12.15\u002F2.13.8\u002F3.1.1; JDK 17 + 8\u002F11) | Released ZIO 2 `Unsafe` APIs; Native (test = compile) |\n| Play lifecycle | 2018 `6059f791`; 2020 `5b4eaf91` (Akka HTTP); 2024 `15cf5d6b` (Java run-support); build eras 2020\u002F2022\u002F2024 (Akka → Pekko, IntegrationTest → Test) | Same-year PRs' dependency versions; today's Akka\u002FPekko |\n\n## Validation\n\n- **No upstream build or test ran while researching or authoring any case.** Every command in references is a future\n  instruction for separately authorized, isolated checkout; loading sbt executes build code.\n- **Discover targets first:** read `build.sbt`, `project\u002Fbuild.properties`, `project\u002Fplugins.sbt` (and\n  `project\u002FBuildHelper.scala` \u002F `BuildSettings.scala` where present), CI selectors, test package names; then\n  `sbt projects` (Play also: `sbt 'show Play \u002F Test \u002F definedTests'`). Test projects often separate from production\n  modules (`lawsJVM`, `testsJVM`, `coreTestsJVM`, `Play-Run-Support`, `Sbt-Plugin`).\n- **Require nonzero execution** of selected suite and specific cases; green command with zero tests proves nothing.\n  Structural skill\u002Fschema checks prove no runtime property.\n- **Run each platform independently** (JVM, JS); Native in ZIO snapshot only compiles.\n- **Global sinks and timing:** capture-based tests (e.g. `System.err`) need serialized execution and restoration on\n  failure; constrained-executor tests need external deadline; scripted Play tests need matching locally published\n  artifacts without silently publishing into user's cache.\n- Concrete selectors and oracles: each reference's Validation section.\n\n## Examples\n\n### Good\n\nPR unifies CE3 race internals. Reviewer writes outcome table for `race` and `raceOutcome` in both operand orders, finds\ncanceled-winner rows differ, keeps those paths separate, adds parent-cancel-during-join tests for both branches (I1,\nI3; outcome reference). Checking a ZIO bridge in same codebase, same reviewer confirms cancel token is invoked inside\n`blocking(ZIO.succeed(...))` and interrupt completion waits for finalizer flag (I3, I5; ZIO reference).\n\n### Broken and Correction\n\nLifecycle refactor (a) returns `Future.successful(Done)` to every `stop()` caller after the first and (b) in cleanup\ncalls `primary.addSuppressed(hookError)` before rethrowing. Tests check only invocation count and returned error. Both\nare I3\u002FI2 violations hidden by weak oracles. Composite illustrative example, not a single historical PR.\nCorrection: share pending completion Promise across callers. Recover hook failure without mutating primary throwable\n(keep it observable through whatever secondary channel target already uses); keep running remaining hooks LIFO. Add\nbarrier test holding last hook while two callers observe pending Futures, and repeated-evaluation test asserting\nunchanged suppressed arrays (Play and cleanup-provenance references).\n\n### Negative\n\nZIO callback eagerly reads mutable child state inside its owning fiber, returns immutable snapshot. Reviewer cites I5\nto demand laziness. Reject: counter-rule applies. Eager read is owner-confined; deferring it would execute on foreign\ncaller (ZIO reference, PR 8819). Likewise, do not flag a CE2 memoizer for lacking `Outcome` (I8).\n\n## Output Contract\n\n1. Target: SHA, library line, Scala\u002FJDK, platform, backend\u002Fmode.\n2. Outcome × observer table (before\u002Fafter) and evaluation\u002Fownership trace for touched actions.\n3. Findings, each with `file:line`, severity, violated invariant (I1–I8), evidence (pinned citation or evidence ID from\n   `references\u002Fevidence\u002F`), minimal correction, discriminating test naming the mutation it kills.\n4. Separate: observed source, reviewer proposal, merged decision, your inference; confirmed defects vs missing\n   assertions vs suspected schedules vs investigation gaps.\n5. Commands actually executed with results, vs proposed tests, vs blocked by prerequisites. Explicit no-finding when\n   trace is preserved.\n\n## Limitations\n\n- Each case rests on few pinned snapshots and review threads. Together they support a decision procedure, not proof\n  over all schedules or universal leak freedom.\n- Several grounding proposals unmerged (CE PR 3232 race helper, PR 3123 forceStart); ZIO PR 8819's design superseded.\n  Their review arguments are used, not their code.\n- Newer lines (CE3 releases, released ZIO 2 `Unsafe` APIs, Pekko-era Play) must be re-read before applying any\n  historical expectation.\n- Reviewer logins identify participants only; formal maintainer roles not verified.\n- Evaluated by model-based review of source and history; no upstream build, signal delivery or constrained-executor\n  experiment ran, and no effectiveness measurement against a baseline agent exists.\n\n## Sources\n\n- [Cats Effect cleanup-error provenance](references\u002Fcats-effect-cleanup-error-provenance.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-cats-effect-cleanup-error-provenance.json); PR 458, PR 394.\n- [Cats Effect outcome-sensitive concurrency](references\u002Fcats-effect-outcome-sensitive-concurrency.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-cats-effect-outcome-sensitive-concurrency.json); PR 1552, PR 3232, PR 3123.\n- [ZIO canceler evaluation owner](references\u002Fzio-canceler-evaluation-owner.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-zio-canceler-evaluation-owner.json); PR 6401, PR 8819.\n- [Play partial startup and shutdown completion](references\u002Fplay-partial-startup-shutdown-completion.md): evidence\n  [JSON](references\u002Fevidence\u002Fscala-play-partial-startup-shutdown-completion.json); PR 8406, PR 9970, PR 12210.\n",{"name":5,"license":15,"description":7},"main","101d0f67250256ca5d80dc3f95767cad7b541457","skills\u002Fscala\u002Fscala-effect-cancellation-finalization","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents","https:\u002F\u002Fgithub.com\u002Fw0rxbend","https:\u002F\u002Freadme.worxbend.com\u002F","Fluent in Backend-ese (microservices, distributed systems, you know the drill)\r\nFunctional Programming Fanatic...","2026-11-14 14:44:12",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add w0rxbend\u002Fdot-agents --skill scala-effect-cancellation-finalization",{"tool":39,"command":40},"bunx","bunx skills add w0rxbend\u002Fdot-agents --skill scala-effect-cancellation-finalization",{"tool":42,"command":43},"pnpm","pnpm dlx skills add w0rxbend\u002Fdot-agents --skill scala-effect-cancellation-finalization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002FSKILL.md",true,[47,51,57,61,65,69,73,77,81],{"path":48,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":16},"LICENSE","许可证",1280,{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fcats-effect-cleanup-error-provenance.md","REFERENCE","参考文档",9466,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fcats-effect-cleanup-error-provenance.md",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fcats-effect-outcome-sensitive-concurrency.md",10758,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fcats-effect-outcome-sensitive-concurrency.md",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fevidence\u002Fscala-cats-effect-cleanup-error-provenance.json",14115,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fevidence\u002Fscala-cats-effect-cleanup-error-provenance.json",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fevidence\u002Fscala-cats-effect-outcome-sensitive-concurrency.json",27127,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fevidence\u002Fscala-cats-effect-outcome-sensitive-concurrency.json",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fevidence\u002Fscala-play-partial-startup-shutdown-completion.json",22888,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fevidence\u002Fscala-play-partial-startup-shutdown-completion.json",{"path":74,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fevidence\u002Fscala-zio-canceler-evaluation-owner.json",10900,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fevidence\u002Fscala-zio-canceler-evaluation-owner.json",{"path":78,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fplay-partial-startup-shutdown-completion.md",16498,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fplay-partial-startup-shutdown-completion.md",{"path":82,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fzio-canceler-evaluation-owner.md",9913,"https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fscala\u002Fscala-effect-cancellation-finalization\u002Freferences\u002Fzio-canceler-evaluation-owner.md",[86,93,100,108,115,122],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":20},"01M7E6TS1SW1ZSXN748N0RBGHT","wiki-builder","Create and maintain a local Markdown research wiki (sources with provenance, compiled concept\u002Fsource pages, index, maintenance log) driven by a per-wiki config. Use when the user wants to start a wiki or knowledge base, ingest sources into one, or query and update it; use wiki-page-writer for a single code deep-dive page.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Fwiki-builder\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M7E6S8ARS0VQR85H4FEC390B","refactoring-guru","Diagnose a named code smell and apply the smallest behavior-preserving refactoring, with verification before and after and an explicit stop condition. Use for structural refactors (extract, move, consolidate, change ownership), not for feature or bug work; for readability cleanup of recent changes use code-simplification.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Frefactoring-guru\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":104,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":20},"01M7E6RRXCYGSHA0ZBFX3YZP7Y","legacy-seams","When changing untested legacy code, pin the observed results with characterization tests and open the smallest seam that substitutes only the blocking dependency, separate from any later logic change. Use when a clock, random source, I\u002FO, global, or hidden constructor blocks a test or a safe edit. Use test-driven-development for a new behavior or a bug, refactoring-guru for one named structural refactor after the seam exists, and code-refactoring-tech-debt to choose which legacy to replace.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Flegacy-seams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Flegacy-seams\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":20},"01M7E6QZ11XWSNHCBGYK8HH97C","idea-refine","Refine a raw idea into a one-page brief (problem statement, recommended direction, assumptions to validate, MVP scope, not-doing list) through divergent then convergent thinking. Use when an idea is still vague or you want options and a stress test before committing; use interview-me when the goal itself is unclear and spec-driven-development once the direction is chosen.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Fidea-refine\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":20},"01M7E6N2N7BYW7BA5XGM0QD3B4","code-review-and-quality","Review rubric and approval standard for any change before merge, including code written by you, another agent, or a human: five axes (correctness, readability, architecture, security, performance), change sizing, structural remedies, severity labels, and feedback technique. Use to judge whether a change is fit to merge; use code-review to run a PR or diff review end to end.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Fcode-review-and-quality\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":126,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":20},"01M7E6MNCZPTRD77Z419X755HQ","code-perfection","Smell and style gate for code you write or change. Bans known code smells (long method, large class, primitive obsession, long parameter list, data clumps, duplicate code, dead code, feature envy, shotgun surgery, flag arguments, message chains) and enforces behavior-preserving structure. On Scala files, enforces worxbend style. Use while implementing, reviewing a diff for smells, or when a smell or style violation is suspected. Routine construction stays with code-complete. SOLID and DRY stay with clean-code-guard. One named structural refactor stays with refactoring-guru.","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Fcode-perfection\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fw0rxbend\u002Fdot-agents\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow\u002Fcode-perfection\u002FSKILL.md",[],[]]