
swift-protocol-di-testing
Protocol-based dependency injection for testable Swift code
by affaan-mFree
Description
swift-protocol-di-testing is an agent skill from the ECC collection by affaan-m, listed on skills.sh. It sets out protocol-based dependency injection for testable Swift code. External dependencies such as the file system, the network and iCloud are hidden behind small, focused protocols, so tests can swap in mocks and run deterministically with no real input or output. The skill uses Swift Testing for the tests and shows how to exercise error-handling paths without making real failures happen. It applies when Swift code touches the file system, the network or external APIs, when error paths need testing, when a module has to work in the app, in tests and in SwiftUI previews, and when the architecture has to be testable under Swift concurrency with actors and Sendable. Its core pattern is to define a separate, narrow protocol for each external concern. A skill is a SKILL.md file of instructions that an AI agent loads when a task calls for it. It is free and open source, and the skills.sh listing shows all three security audits passing.…
Highlights
- Small, focused protocols per dependency
- Mocks for file system, network and iCloud
- Deterministic tests with no I/O
- Swift Testing examples
Ratings & Reviews
No ratings yet
Be the first to rate swift-protocol-di-testing.
People also visit

migrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn

benchmark-optimization-loop
Convert 'make it faster' requests into a bounded measured optimization loop

cpp-testing
Use only when writing/updating/fixing C++ tests, configuring GoogleTest/CTest
swift-protocol-di-testing FAQ
What does the swift-protocol-di-testing skill do?
It guides an agent in hiding external dependencies behind focused Swift protocols, so the code can be tested with mocks and no real I/O.
What dependencies does it cover?
The file system, the network, iCloud and other external APIs.
What testing framework does it use?
Swift Testing.
How do I install it?
Run: npx skills add https://github.com/affaan-m/ecc --skill swift-protocol-di-testing
Is it free?
Yes. It is free and open source.
Are there security findings?
The skills.sh listing shows Gen Agent Trust Hub, Socket and Snyk all passing.
What are the best swift-protocol-di-testing alternatives?
Popular alternatives to swift-protocol-di-testing include migrate-to-shoehorn, tdd and ai-regression-testing. See all swift-protocol-di-testing alternatives