[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B3BETYFNDED9QBEEPBKS28":3,"skill-same:01M7B3BETYFNDED9QBEEPBKS28":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":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M7B3BETYFNDED9QBEEPBKS28","vvkit-swift-swift-testing-async",null,"Use when testing Swift async\u002Fawait code — a task group, async let, a timeout race, a retry, or cancellation — or when a Swift test waits with Task.sleep, polling, or Task.yield for work in flight.","vadimvitvickiy\u002Fvv-agent-kit","vadimvitvickiy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5019512?v=4","01M7B3ABRYF7KHBCDW6GB2XH0C","Vadim Vitvitskii","01M7B3ABSZYG9MXP1CC7BQYM25",0,"MIT","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fcodex\u002Fplugins\u002Fvvkit-swift\u002Fskills\u002Fvvkit-swift-swift-testing-async\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: vvkit-swift-swift-testing-async\ndescription: \"Use when testing Swift async\u002Fawait code \\u2014 a task group, async let, a timeout race, a retry, or cancellation \\u2014 or when a Swift test waits with Task.sleep, polling, or Task.yield for work in flight.\"\n---\n\n# Testing async\u002Fawait code\n\n**REQUIRED BACKGROUND:** `$vvkit-swift-swift-testing` for the framework, `$vvkit-writing-tests` for\nwhether a test is owed. State shared across locks, queues or callbacks rather than `await` is\n`swift-testing`'s `references\u002Fconcurrency.md`.\n\n## Codex runtime\n\nLoad referenced skills by reading their SKILL.md. Surveyor, reviewer and runner\nskills are role instructions, not registered agent types or enforced tool allowlists.\nUse a generic subagent only when delegation is available and permitted; otherwise\nperform the role inline. Follow the active session's model, context and permission\nrules. User authorization takes precedence over imported workflow approval gates.\nClaude hooks and plugin commands are not active in this package. Existing\n`.claude\u002Fcontext\u002F` paths refer to project documents, not Codex configuration.\n\n**Never synchronise on a guessed interval.**\n\n- `Task.sleep`, a polling loop or a run of `Task.yield()` \"to let the other task get there\" guesses\n  the scheduler. It flakes under parallel runs, cannot choose which racing operation wins, and is\n  slow — 100 ms across a thousand tests is 100 s per run.\n- Models reach for these by default. Code under test that calls `Task.sleep` or reads a clock is the\n  missing seam: inject it — `$vvkit-injecting-dependencies`.\n\n## The technique: spies that report and wait\n\nEvery dependency whose timing decides the outcome — value source, sleep, clock — becomes a protocol\nwith a test spy that:\n\n1. **Reports each call** on a stream the test reads with `nextCall()`, with the arguments.\n2. **Suspends until released** — `respond(with: Result)` for a value source, `resume()` for a sleep.\n3. **Exits on cancellation.** One that ignores it hangs the run.\n\nA received call proves the operation got there; the test then picks which dependency proceeds, so each\nordering is its own deterministic test with no real time elapsing. A spy asserts the requested\nduration (`sleepCall == .seconds(3)`) without waiting.\n\nReference spies on `AsyncStream`: `references\u002Fspies.md`. Copy the shape, adapt the signature.\n\n## Shape of a test\n\nOne ordering per test:\n\n```swift\n@Suite(.timeLimit(.minutes(1)))\nstruct TimedLoaderTests {\n    @Test(\"a value returned before the deadline wins\")\n    func valueBeforeTimeout() async throws {\n        let provider = ValueProviderSpy()\n        let sleep = SleepSpy()\n        let sut = TimedLoader(provider: provider, sleep: sleep)\n\n        async let loaded = sut.load(within: .seconds(3))\n\n        \u002F\u002F Both child tasks are running once both events arrive.\n        let valueCall = try #require(await provider.nextCall())\n        let sleepCall = try #require(await sleep.nextCall())\n        #expect(valueCall == .value)\n        #expect(sleepCall == .seconds(3))\n\n        provider.respond(with: .success(\"loaded\"))\n\n        let value = try await loaded\n        #expect(value == \"loaded\")\n    }\n}\n```\n\n| Scenario | After both call events arrive |\n|-|-|\n| Value wins | `provider.respond(with: .success(…))` |\n| Timeout wins | `sleep.resume()`, then expect the timeout error |\n| Dependency fails | `provider.respond(with: .failure(…))`, expect that exact error back |\n| Caller cancels | cancel the task — see below |\n| Only the result matters | `respond` **before** starting, skip `nextCall()`, plain `await` |\n\n- Assert an `async let` error in `do`\u002F`catch`; `#expect(throws:) { try await loaded }` does not\n  compile — a closure cannot capture an `async let`.\n- The loser's cancellation needs no assertion: a task group awaits every child, so a loader that forgot\n  to cancel leaves it on its spy, and the time limit fails the test.\n\n## Caller cancellation\n\n`async let` cancels and awaits on scope exit. `Task { }` does neither: it does not inherit the test's\ncancellation, and a `#require` throwing before `cancel()` leaves it waiting forever. Close both:\n\n```swift\nlet loading = Task { try await sut.load(within: .seconds(3)) }\ndo {\n    try await withTaskCancellationHandler {\n        _ = try #require(await provider.nextCall())\n        _ = try #require(await sleep.nextCall())\n\n        loading.cancel()\n\n        await #expect(throws: CancellationError.self) {\n            try await loading.value\n        }\n    } onCancel: {\n        loading.cancel()          \u002F\u002F the time limit cancelled the test\n    }\n} catch {\n    loading.cancel()              \u002F\u002F a #require threw before cancel()\n    _ = await loading.result\n    throw error\n}\n```\n\n## Time limits\n\n- `.timeLimit(.minutes(1))` on the suite, so a call that never arrives fails instead of wedging the\n  bundle. Minutes-only.\n- **A time limit records a failure and requests cancellation; it stops nothing.** Swift Testing still\n  waits for the function to return — hence spies that end on cancellation and the `onCancel`\n  forwarding. A cooperative-pool deadlock defeats even this — Watchdogs in\n  `$vvkit-swift-swift-testing`.\n\n## Spy rules that bite\n\n- **Fresh spies per operation.** Cancellation ends the `AsyncStream` iteration; a reused sleep spy can\n  then return *without* `resume()`, passing an ordering never driven. A retry after cancellation needs\n  a spy that opens a new stream per call.\n- **One waiter per stream.** `AsyncStream` traps when a second task awaits `next()`. The reference\n  spies turn that into a named `preconditionFailure`; give each concurrent sleep its own spy.\n- **A `.failure` response is consumed by one request.** The stream stays open, so the next call can\n  succeed — what a retry test wants.\n\n## Where this fits the ladder\n\nA spy is the virtual-time rung of `swift-testing`'s ladder for async\u002Fawait. `confirmation` is for *how\nmany times*, not *in what order*. Polling stays last, for genuinely wall-clock work.\n\nTechnique source: raska.io, \"Stop Sleeping: Deterministic Tests for Concurrent Swift Code\" (2026).\n","# Testing async\u002Fawait code\n\n**REQUIRED BACKGROUND:** `$vvkit-swift-swift-testing` for the framework, `$vvkit-writing-tests` for\nwhether a test is owed. State shared across locks, queues or callbacks rather than `await` is\n`swift-testing`'s `references\u002Fconcurrency.md`.\n\n## Codex runtime\n\nLoad referenced skills by reading their SKILL.md. Surveyor, reviewer and runner\nskills are role instructions, not registered agent types or enforced tool allowlists.\nUse a generic subagent only when delegation is available and permitted; otherwise\nperform the role inline. Follow the active session's model, context and permission\nrules. User authorization takes precedence over imported workflow approval gates.\nClaude hooks and plugin commands are not active in this package. Existing\n`.claude\u002Fcontext\u002F` paths refer to project documents, not Codex configuration.\n\n**Never synchronise on a guessed interval.**\n\n- `Task.sleep`, a polling loop or a run of `Task.yield()` \"to let the other task get there\" guesses\n  the scheduler. It flakes under parallel runs, cannot choose which racing operation wins, and is\n  slow — 100 ms across a thousand tests is 100 s per run.\n- Models reach for these by default. Code under test that calls `Task.sleep` or reads a clock is the\n  missing seam: inject it — `$vvkit-injecting-dependencies`.\n\n## The technique: spies that report and wait\n\nEvery dependency whose timing decides the outcome — value source, sleep, clock — becomes a protocol\nwith a test spy that:\n\n1. **Reports each call** on a stream the test reads with `nextCall()`, with the arguments.\n2. **Suspends until released** — `respond(with: Result)` for a value source, `resume()` for a sleep.\n3. **Exits on cancellation.** One that ignores it hangs the run.\n\nA received call proves the operation got there; the test then picks which dependency proceeds, so each\nordering is its own deterministic test with no real time elapsing. A spy asserts the requested\nduration (`sleepCall == .seconds(3)`) without waiting.\n\nReference spies on `AsyncStream`: `references\u002Fspies.md`. Copy the shape, adapt the signature.\n\n## Shape of a test\n\nOne ordering per test:\n\n```swift\n@Suite(.timeLimit(.minutes(1)))\nstruct TimedLoaderTests {\n    @Test(\"a value returned before the deadline wins\")\n    func valueBeforeTimeout() async throws {\n        let provider = ValueProviderSpy()\n        let sleep = SleepSpy()\n        let sut = TimedLoader(provider: provider, sleep: sleep)\n\n        async let loaded = sut.load(within: .seconds(3))\n\n        \u002F\u002F Both child tasks are running once both events arrive.\n        let valueCall = try #require(await provider.nextCall())\n        let sleepCall = try #require(await sleep.nextCall())\n        #expect(valueCall == .value)\n        #expect(sleepCall == .seconds(3))\n\n        provider.respond(with: .success(\"loaded\"))\n\n        let value = try await loaded\n        #expect(value == \"loaded\")\n    }\n}\n```\n\n| Scenario | After both call events arrive |\n|-|-|\n| Value wins | `provider.respond(with: .success(…))` |\n| Timeout wins | `sleep.resume()`, then expect the timeout error |\n| Dependency fails | `provider.respond(with: .failure(…))`, expect that exact error back |\n| Caller cancels | cancel the task — see below |\n| Only the result matters | `respond` **before** starting, skip `nextCall()`, plain `await` |\n\n- Assert an `async let` error in `do`\u002F`catch`; `#expect(throws:) { try await loaded }` does not\n  compile — a closure cannot capture an `async let`.\n- The loser's cancellation needs no assertion: a task group awaits every child, so a loader that forgot\n  to cancel leaves it on its spy, and the time limit fails the test.\n\n## Caller cancellation\n\n`async let` cancels and awaits on scope exit. `Task { }` does neither: it does not inherit the test's\ncancellation, and a `#require` throwing before `cancel()` leaves it waiting forever. Close both:\n\n```swift\nlet loading = Task { try await sut.load(within: .seconds(3)) }\ndo {\n    try await withTaskCancellationHandler {\n        _ = try #require(await provider.nextCall())\n        _ = try #require(await sleep.nextCall())\n\n        loading.cancel()\n\n        await #expect(throws: CancellationError.self) {\n            try await loading.value\n        }\n    } onCancel: {\n        loading.cancel()          \u002F\u002F the time limit cancelled the test\n    }\n} catch {\n    loading.cancel()              \u002F\u002F a #require threw before cancel()\n    _ = await loading.result\n    throw error\n}\n```\n\n## Time limits\n\n- `.timeLimit(.minutes(1))` on the suite, so a call that never arrives fails instead of wedging the\n  bundle. Minutes-only.\n- **A time limit records a failure and requests cancellation; it stops nothing.** Swift Testing still\n  waits for the function to return — hence spies that end on cancellation and the `onCancel`\n  forwarding. A cooperative-pool deadlock defeats even this — Watchdogs in\n  `$vvkit-swift-swift-testing`.\n\n## Spy rules that bite\n\n- **Fresh spies per operation.** Cancellation ends the `AsyncStream` iteration; a reused sleep spy can\n  then return *without* `resume()`, passing an ordering never driven. A retry after cancellation needs\n  a spy that opens a new stream per call.\n- **One waiter per stream.** `AsyncStream` traps when a second task awaits `next()`. The reference\n  spies turn that into a named `preconditionFailure`; give each concurrent sleep its own spy.\n- **A `.failure` response is consumed by one request.** The stream stays open, so the next call can\n  succeed — what a retry test wants.\n\n## Where this fits the ladder\n\nA spy is the virtual-time rung of `swift-testing`'s ladder for async\u002Fawait. `confirmation` is for *how\nmany times*, not *in what order*. Polling stays last, for genuinely wall-clock work.\n\nTechnique source: raska.io, \"Stop Sleeping: Deterministic Tests for Concurrent Swift Code\" (2026).\n",{"name":5,"description":7},"main","cc22a222a76add5759a2df5fadf231a758691db5","codex\u002Fplugins\u002Fvvkit-swift\u002Fskills\u002Fvvkit-swift-swift-testing-async","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy","Senior iOS engineer. Architecture, SDKs and apps for iOS, tvOS and watchOS.","2026-11-13 19:10:29",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add vadimvitvickiy\u002Fvv-agent-kit --skill vvkit-swift-swift-testing-async",{"tool":37,"command":38},"bunx","bunx skills add vadimvitvickiy\u002Fvv-agent-kit --skill vvkit-swift-swift-testing-async",{"tool":40,"command":41},"pnpm","pnpm dlx skills add vadimvitvickiy\u002Fvv-agent-kit --skill vvkit-swift-swift-testing-async","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fcodex\u002Fplugins\u002Fvvkit-swift\u002Fskills\u002Fvvkit-swift-swift-testing-async\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fspies.md","REFERENCE","参考文档",4640,"https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fcodex\u002Fplugins\u002Fvvkit-swift\u002Fskills\u002Fvvkit-swift-swift-testing-async\u002Freferences\u002Fspies.md",[52,59,66,73,80,87],{"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},"01M7B3JN7VG0YJ4JB8RP6HYZSJ","no-heading","Use when proving that the validator rejects a body with no H1 and a force-loading @-link.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fno-heading\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},"01M7B3JJMEW4E710ZG6HYJ7BWV","wrong-name-does-not-match-dir","Dispatches a subagent per task and reviews between each one.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fbroken-skill\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},"01M7B3JGE9MFT1HRP41YRVKN97","writing-tests","Use when adding or changing behavior, fixing a bug, or judging whether an existing or generated test earns its place.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-tests\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},"01M7B3JD5X32VEBDBN7HB8E17Z","writing-skills","Use when authoring or editing a skill, agent, command or hook for this kit, or when deciding whether a piece of guidance belongs in a skill at all.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-skills\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},"01M7B3J992MZH2QVZRED0DRPD9","writing-project-instructions","Use when creating or editing a CLAUDE.md or AGENTS.md, when it has grown long, or when a rule in it also exists in an installed skill.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-project-instructions\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7B3J55C5WPWN20QXP9ET848","writing-logs","Use when adding or reviewing log statements, or when deciding what level a message belongs at.","https:\u002F\u002Fgithub.com\u002Fvadimvitvickiy\u002Fvv-agent-kit\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-logs\u002FSKILL.md",[],[]]