Agent skill · Testing & QA

test-contract

Generate protocol/interface test suites that any implementation must pass. Define the contract once, test every implementation. Use when designing protocols or swapping implementations.

rshankrasgithub.com/rshankrasGitHub ↗
claude-codecan modify filesMIT
Install
npx skills add rshankras/claude-code-apple-skills --skill test-contract --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrepBashAskUserQuestion
Path: skills/testing/test-contract/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 589
Language: Swift

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Test Contract Define behavioral contracts as test suites. Any class conforming to a protocol must pass the contract tests. Ensures consistent behavior across implementations — human-written, AI-generated, or mock. ## When This Skill Activates Use this skill when the user: - Designs a protocol and wants to ensure conformance quality - Has multiple implementations of the same interface (e.g., real + mock + in-memory) - Says "test the protocol" or "contract test" - Wants to swap implementations safely (e.g., CoreData → SwiftData) - Wants to ensure AI-generated implementations meet the spec ## Why Contract Tests ``` Protocol: DataStore ├── SQLiteDataStore → must pass contract tests ├── InMemoryDataStore → must pass contract tests ├── MockDataStore → must pass contract tests └── CloudDataStore → must pass contract tests ``` Write the contract once. Every implementation proves it works by passing the same tests. ## Process ### Phase 1: Identify the Protocol ``` Grep: "protocol.*\\{" to find protocols Read: protocol definition ``` Understand: - [ ] All required methods and properties - [ ] Expected behavior for each method - [ ] Error conditions and edge cases - [ ] Thread safety requir

What's inside
Steps it walks through
  1. When This Skill Activates
  2. Why Contract Tests
  3. Process
  4. Phase 1: Identify the Protocol
  5. Phase 2: Define Contract Behaviors
  6. Phase 3: Generate Contract Test Suite
  7. Common Contract Categories
  8. Repository / Data Store
  9. Network Client
  10. Cache
  11. Authentication
  12. Output Format
  13. References
More from claude-code-apple-skills
All skills →
About this skill
What does the test-contract skill do?

Generate protocol/interface test suites that any implementation must pass. Define the contract once, test every implementation. Use when designing protocols or swapping implementations.

How do I install it?

Run `npx skills add rshankras/claude-code-apple-skills --skill test-contract --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going