Not in the top 1,000 by GitHub stars
DanielCardonaRojas/swift-mocking
A compact swift mocking library powered by parameter packs.
History
Review weekly changes to SKILL.md before updating. Dates mark the weeks in which we observed each version; checks apply to the recorded commits.
View weekly changes
skills/swift-mocking/SKILL.md
Week of Oct 26, 2026 · Line counts unavailable
Before Not checked yet → After Network or broad shell
First observation → ed4e3c51abbb
No earlier version was observed for comparison.
Heat
2.6- Star growth, last 7 daysNot available
- Star growth, last 24 hoursNot available
- Rank movement, last 7 daysNot available
- Commits, last 30 daysNot available
- Accounts asking about it through MCP, last 7 daysNot available
- Hot votes this weekNot available
Heat never changes the order by stars, and sponsorship never touches it. How heat works
Stars over time
30-day change not yet available: not enough history.
Individual skills in this repository
- swift-mocking
skills/swift-mocking
How it works
swift-mocking
When your agent uses it
Use when writing Swift tests with the SwiftMocking library — creating @Mockable mocks, stubbing with when/verify, matching arguments, class-constrained protocols (@Mockable([.composition])), or hand-writing mocks (protocol inheritance chains, mocking classes).
What it loads into context
Frontmatter
59 tokensAlways available to the agent
SKILL.md
2,596 tokensWhen the skill is activated
Reference documents
12,751 tokensLoaded on request
Token counts are estimates. Scripts run separately; they are not counted as reference context.
The playbook
- When to use what
- API interface
- Deterministic generation: the `mockable` CLI
- The one rule for manual mocks
- Quick verification checklist
- Known sharp edges
- References
Files
SKILL.mdcore11,070 bytesSKILL.mdcore11,070 bytesSKILL.mdcore11,070 bytesSKILL.mdcore11,070 bytesSKILL.mdcore11,070 bytesmanual-mocking.mddoc18,874 bytesreferences/interface/SwiftMocking.swiftinterfaceasset47,364 bytesreferences/interface/SwiftMockingTestSupport.swiftinterfaceasset443 bytessendable.mddoc5,738 bytesspies-and-composition.mddoc15,319 bytesusage.mddoc12,452 bytes
Read SKILL.md
# SwiftMocking
Mocking for Swift protocols: `@Mockable` generates mock classes; `when(...)` stubs, `verify(...)` asserts calls. When the macro can't generate a mock — most notably **protocol inheritance** (`protocol B: A` — the macro drops inherited requirements and the mock fails to conform) — hand-write the mock following the exact generated-code shape.
The macro is not the only entry point. Two escape hatches cover everything it can't reach, and both are fully supported (see **spies-and-composition.md**):
- **`Spy` used directly** — a standalone recorder needing no `Mock` subclass and no macro. This is how you mock **classes**, which `@Mockable` cannot touch at all: subclass the class and back each override with a `Spy`.
- **Composition over inheritance** — hold a `let mock = Mock()` property instead of inheriting from `Mock`. `Mock`'s `@dynamicMemberLookup` subscript is `public`, so `mock.name` resolves spies from outside the class. Required when the type already has a superclass (`UIViewController`, a legacy base class) or isn't a class at all (**struct**, **actor**). Substitute `super.name` → `self.mock.name` and `adapt(...)` → `Mock.adapt(...)`; everything else in manual-mocking.md is unchanged.
**The macro generates the composed form itself** with `@Mockable([.composition])` — no hand-writing — when the blocker is a protocol whose conformers must inherit a class:
```swift
@Mockable([.composition])
protocol ViewControllerService: SampleBase { ... }View the complete source on GitHubSkills included
- swift-mocking
Repository facts
- License
- MIT
- Created
- Jul 7, 2025
- Last pushed
- Oct 10, 2026
- Forks
- 1
- Open issues
- 0
- Project activity
- Active
Before you install
Network or broad shellAutomated signals, not a guarantee
Checked Nov 6, 2026
Not fully analyzed: some files were too long, unreadable or missing. This never lowers the level.
Show 4 notes
skills/swift-mocking/SKILL.md:1Analysis incomplete: Referenced executable target unavailable; not analyzedskills/swift-mocking/SKILL.md:1Analysis incomplete: Referenced executable target unavailable; not analyzedskills/swift-mocking/SKILL.md:1Analysis incomplete: Referenced executable target unavailable; not analyzedskills/swift-mocking/SKILL.md:1Analysis incomplete: Referenced executable target unavailable; not analyzed
- No broad tool permissions
- No dangerous shell commands
- 17 network referencesin 2 files: swift-mocking/usage.md:8 swift-mocking/SKILL.md:116
- No hidden or obfuscated text
- No instruction overrides
- No executable scripts
- No access to secrets
- No requests to vote in Hot
Show all 17 signals by file
skills/swift-mocking/SKILL.md
- Network accessline 116
- Stub API is `thenReturn` / `thenThrow` / `do` — there is no `.then`. - **Never write `thenReturn(())`.** `Void` is in the default-value registry, so an unstubbed `-> Void` member just runs and records the call — stub it only to throw or t - Network accessline 117
- **Never write `thenReturn(())`.** `Void` is in the default-value registry, so an unstubbed `-> Void` member just runs and records the call — stub it only to throw or to attach a `do` side effect. The registry also covers `Bool`/`String`/` - Network accessline 118
- Spy names come from the requirement, ignoring argument labels: methods use their name, subscripts are namespaced as `subscript`+ParameterNames (`subscript(row:column:)` → `subscriptRowColumn`), settable members add `set`+Name. The prefix
skills/swift-mocking/usage.md
- Network accessline 8
let mock = MyServiceMock() // generated: @Mockable protocol MyService when(mock.fetch(id: .any)).thenReturn(value) // arrange — stub BEFORE use - Network accessline 9
when(mock.fetch(id: .any)).thenReturn(value) // arrange — stub BEFORE use - Network accessline 10
let out = try await sut.fetch(id: "1") // act — direct call routes through the spy - Network accessline 11
verify(mock.fetch(id: .equal("1"))).called(1) // assert - Network accessline 105
when(mock.execute(completion: .any)).do { completion in completion("ok") } // side effect / callbacks when(mock.calculatePrice(.any)).thenReturn { item in prices[item] ?? 0 } // dynamic return when(mock.fetch(.equal(url))).thenRetu - Network accessline 107
when(mock.fetch(.equal(url))).thenReturn { _ in callCount == 1 ? throw Timeout : data } // stateful - Network accessline 124
await verify(mock.upload(.any)).didThrow() // async spies: await the didThrow() form verifyInOrder([mock.auth(.any), mock.data(.any)]) // call order across spies `called(n)` is synchronous for all effect types; only `.didThrow()` on a - Network accessline 126
`called(n)` is synchronous for all effect types; only `.didThrow()` on async spies needs `await`. Verification failures are reported through [IssueReporting](https://github.com/pointfreeco/swift-issue-reporting) — they record issues inside - Network accessline 192
@Test func fetches() async throws { let mock = MyServiceMock() when(mock.fetch(id: .any)).thenReturn(User(id: "123")) - Network accessline 193
let mock = MyServiceMock() when(mock.fetch(id: .any)).thenReturn(User(id: "123")) let user = try await SUT(mock).fetch(id: "123") - Network accessline 194
when(mock.fetch(id: .any)).thenReturn(User(id: "123")) - Network accessline 195
let user = try await SUT(mock).fetch(id: "123") - Network accessline 196
#expect(user.id == "123") await verify(mock.fetch(id: .equal("123"))).called(1) } - Network accessline 197
await verify(mock.fetch(id: .equal("123"))).called(1)
How the signals fit together
Facts from a static read of the files at the pinned commit. They describe what the code does, not why.
Signal confidence: 17 facts
- Network access in prose of the SKILL.mdswift-mocking/SKILL.md:116Low confidence
- Network access in prose of the SKILL.mdswift-mocking/SKILL.md:117Low confidence
- Network access in prose of the SKILL.mdswift-mocking/SKILL.md:118Low confidence
- Network access in code of documentationswift-mocking/usage.md:8Low confidence
- Network access in code of documentationswift-mocking/usage.md:9Low confidence
- Network access in code of documentationswift-mocking/usage.md:10Low confidence
- Network access in code of documentationswift-mocking/usage.md:11Low confidence
- Network access in code of documentationswift-mocking/usage.md:105Low confidence
- Network access in code of documentationswift-mocking/usage.md:107Low confidence
- Network access in code of documentationswift-mocking/usage.md:124Low confidence
- Network access in code of documentationswift-mocking/usage.md:126Low confidence
- Network access in code of documentationswift-mocking/usage.md:192Low confidence
- Network access in code of documentationswift-mocking/usage.md:193Low confidence
- Network access in code of documentationswift-mocking/usage.md:194Low confidence
- Network access in code of documentationswift-mocking/usage.md:195Low confidence
- Network access in code of documentationswift-mocking/usage.md:196Low confidence
- Network access in code of documentationswift-mocking/usage.md:197Low confidence
Works with
| Agent | Status | Evidence | Install to |
|---|---|---|---|
| Claude Code | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .claude/skills/<skill-name>/ |
| Codex | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .agents/skills/<skill-name>/ |
| Cursor | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .cursor/skills/<skill-name>/ |
| Gemini CLI | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .gemini/skills/<skill-name>/ |
| GitHub Copilot | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .github/skills/<skill-name>/ |
| OpenCode | Compatible | Standard SKILL.md skills/swift-mocking/SKILL.md | .opencode/skills/<skill-name>/ |
- Native The repository ships a manifest, folder or frontmatter field for this agent.
- Compatible A standard SKILL.md that this agent can read.
- Unknown No evidence either way.
Derived automatically from paths, manifests and frontmatter. Not tested on each agent.