ECC: Skill for Claude Code

.kiro/skills/swift-protocol-di-testing/SKILL.md

swift-protocol-di-testing is a skill for Claude Code, Kiro from affaan-m/ECC. It costs 32 tokens per session (1,311 once invoked), scanned A, original, MIT.

A Swift testing pattern that puts file systems, networks, and external services behind small interfaces so tests can replace them with controlled versions. Swift is Apple's programming language for apps.

In plain words
What is it for?
Use it when testing Swift code that depends on files, networks, iCloud, or other external services, including apps that use concurrency.
Why use it?
It makes tests repeatable by avoiding real file or network access and allows error cases to be tested safely.

Skill for Claude CodeKiro

Written for Claude Code and Kiro: shipped in a Claude Code plugin, but also installed under .kiro/.

This is affaan-m/ECC's own configuration. It tells Claude Code and Kiro how to work on ECC itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ECC configures →

Part of the ecc plugin — 70 skills, 56 commands, 68 agents, 1 MCP server shipped together

About the project

ECC is a toolkit that organizes and improves how coding agents work through skills, memory, security checks, research practices, and related extensions. It is for developers using agents such as Claude Code, Codex, OpenCode, and Cursor.

affaan-m/ECC · 251,781 stars · on GitHub · ecc.tools

Reuse

Borrowing it

Nothing to install: this file belongs to affaan-m/ECC. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/affaan-m/ECC/main/.kiro/skills/swift-protocol-di-testing/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/affaan-m/ECC

Made for: Claude Code, Kiro.

Or install ecc, the plugin that ships this one along with the rest of its 70 skills, 56 commands, 68 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-protocol-di-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/affaan-m/ecc/swift-protocol-di-testing.svg)](https://agentmods.dev/skills/affaan-m/ecc/swift-protocol-di-testing)
Your own site
<a href="https://agentmods.dev/skills/affaan-m/ecc/swift-protocol-di-testing"><img src="https://agentmods.dev/badge/skills/affaan-m/ecc/swift-protocol-di-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,311 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. ✓ AI security review Fable 5.1 · 6 Sept 2026 📄 Read the review Third-party audits
  • Socket pass 12 Aug 2026
  • Snyk pass 12 Aug 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.01311
Opus 5 $0.00016 $0.00656
Sonnet 5 $0.00006 $0.00262
Haiku 4.5 $0.00003 $0.00131

Measured 4d ago against content hash 00e270fc2228, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

swift-protocol-di-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

5 near-identical copies found in the catalogue:

.kiro/skills/swift-protocol-di-testing/SKILL.md · 192 lines

How it starts

The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift Protocol-Based Dependency Injection for Testing

Patterns for making Swift code testable by abstracting external dependencies (file system, network, iCloud) behind small, focused protocols. Enables deterministic tests without I/O.

When to Activate

  • 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)

Core Pattern

1. Define Small, Focused Protocols

Each protocol handles exactly one external concern.

// File system access
public protocol FileSystemProviding: Sendable {
    func containerURL(for purpose: Purpose) -> URL?
}

// File read/write operations
public protocol FileAccessorProviding: Sendable {
    func read(from url: URL) throws -> Data
    func write(_ data: Data, to url: URL) throws
    func fileExists(at url: URL) -> Bool
}

// Bookmark storage (e.g., for sandboxed apps)
public protocol BookmarkStorageProviding: Sendable {
    func saveBookmark(_ data: Data, for key: String) throws
    func loadBookmark(for key: String) throws -> Data?
}

2. Create Default (Production) Implementations

public struct DefaultFileSystemProvider: FileSystemProviding {
    public init() {}

    public func containerURL(for purpose: Purpose) -> URL? {
        FileManager.default.url(forUbiquityContainerIdentifier: nil)
    }
}

public struct DefaultFileAccessor: FileAccessorProviding {
    public init() {}

    public func read(from url: URL) throws -> Data {
        try Data(contentsOf: url)
    }

    public func write(_ data: Data, to url: URL) throws {
        try data.write(to: url, options: .atomic)
    }

    public func fileExists(at url: URL) -> Bool {
        FileManager.default.fileExists(atPath: url.path)
    }
}

3. Create Mock Implementations for Testing

/// NOTE: Not thread-safe. Use only in single-threaded test contexts.
public final class MockFileAccessor: FileAccessorProviding, @unchecked Sendable {
    public var files: [URL: Data] = [:]
    public var readError: Error?
    public var writeError: Error?

    public init() {}

    public func read(from url: URL) throws -> Data {
        if let error = readError { throw error }
        guard let data = files[url] else {
            throw CocoaError(.fileReadNoSuchFile)
        }
        return data
    }

    public func write(_ data: Data, to url: URL) throws {
        if let error = writeError { throw error }
        files[url] = data
    }

    public func fileExists(at url: URL) -> Bool {
        files[url] != nil
    }
}

Read the full file on GitHub · 192 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 192 lines · 32 tokens per session scan A 00e270fc2228

Subscribe to this mod's changes

swift-protocol-di-testing is a skill published in the GitHub repository affaan-m/ECC (251,781 stars, last pushed today), licensed MIT. It adds 32 tokens to every session and 1,311 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

memstack-development-test-writer

Use this skill when the user says 'write tests', 'add tests', 'test coverage', 'unit tests', 'integration tests', 'component tests', 'mocking', 'edge cases', or needs to generate tests with proper mocking and edge case coverage. Do NOT use for refactoring plans or database migrations.

cwinvestments/memstack · 70 tokens

test-fixing

Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.

mhattingpete/claude-skills-marketplace · 44 tokens

auto-optimize

Autonomously optimize any Claude Code skill by running it repeatedly, scoring against binary evals, mutating the prompt, and keeping improvements. Use when: optimize/improve/benchmark/eval a skill, autoresearch, auto-optimize. Not for creating skills from scratch (use skill-creator-pro).

LeeJuOh/claude-code-zero · 65 tokens

unit-test

A Go testing workflow for writing unit tests: small tests that check individual functions or components. It supports table-driven cases, where many inputs and expected results are organised in one test, and subtests.

johnqtcg/awesome-skills · 100 tokens

fuzzing-test

A Go testing guide for generating fuzz tests, which repeatedly try varied inputs to find crashes and unexpected behavior. It first checks whether the code is suitable for fuzzing.

johnqtcg/awesome-skills · 74 tokens

run-preflight

A release pre-check workflow that builds the mini-app, runs automated checks, explains errors, and lists review items that require a person to test the app on a real device. A preflight check is a final inspection before submission.

TOKTOKHAN-DEV/agent-company · 3 tokens