swift-protocol-di-testing

swift protocol di testing

affaan-m 232k ↓ 5.1k MIT updated 25d ago
Claude Code
View source ↗

What it does

  • Writing Swift code that accesses file system, network, or external APIs
  • Need to test error handling paths without triggering real failures
  • Building modules that work across environments (app, test, SwiftUI preview)
  • Designing testable architecture with Swift concurrency (actors, Sendable)
  • Single Responsibility: Each protocol should handle one concern — don't create "god protocols" with many methods
  • Sendable conformance: Required when protocols are used across actor boundaries
  • Default parameters: Let production code use real implementations by default; only tests need to specify mocks

Requirements & configuration

  • Need to test error handling paths without triggering real failures
  • Default parameters: Let production code use real implementations by default; only tests need to specify mocks
  • Over-engineering: if a type has no external dependencies, it doesn't need a protocol
  • Building modules that need to work in app, test, and SwiftUI preview contexts
  • Apps using Swift concurrency (actors, structured concurrency) that need testable architecture

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

swift protocol di testing

Source

Repository: https://github.com/affaan-m/everything-claude-code

swift-protocol-di-testing FAQ

What does the swift-protocol-di-testing skill do?

Protocol-based dependency injection for testable Swift code — mock file system, network, and external APIs using focused protocols and Swift Testing. Writing Swift code that accesses file system, network, or external APIs Need to test error handling paths without triggering real failures

What does swift-protocol-di-testing require?

Need to test error handling paths without triggering real failures Default parameters: Let production code use real implementations by default; only tests need to specify mocks Over-engineering: if a type has no external dependencies, it doesn't need a protocol Building modules that need to work in app, test, and SwiftUI preview contexts Apps using Swift concurrency (actors, structured concurrency) that need testable architecture

How do I install swift-protocol-di-testing?

Run: npx -y skills add https://github.com/affaan-m/everything-claude-code --skill swift-protocol-di-testing --agent claude-code — the source lives at github.com/affaan-m/everything-claude-code.

Maintain swift-protocol-di-testing?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

swift-protocol-di-testing on getagentictools
[![swift-protocol-di-testing on getagentictools](https://getagentictools.com/badge/skills/affaan-m-everything-claude-code-swift-protocol-di-testing.svg)](https://getagentictools.com/skills/affaan-m-everything-claude-code-swift-protocol-di-testing?ref=badge)
npx agentictools info skills/affaan-m-everything-claude-code-swift-protocol-di-testing

The second line is the CLI lookup for this page — handy in READMEs and docs.