Generate comprehensive unit tests for iOS RxSwift project files (ViewModels, UseCases, Services). Creates complete test files with nested mocks, RxTest patterns, session error handling, and memory leak tests. Use when "generate unit tests", "write tests for", "create unit tests", "add tests for", or analyzing Swift files in PayooMerchant project.
View on GitHubdaispacy/py-claude-marketplace
py-plugin
py-plugin/skills/ios-generate-unit-tests/SKILL.md
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/daispacy/py-claude-marketplace/blob/main/py-plugin/skills/ios-generate-unit-tests/SKILL.md -a claude-code --skill ios-generate-unit-testsInstallation paths:
.claude/skills/ios-generate-unit-tests/# iOS RxSwift Unit Test Generator Automatically generate comprehensive unit tests for iOS RxSwift project following Clean Architecture patterns. ## When to Activate - "generate unit tests for [file]" - "write tests for [ViewModel/UseCase/Service]" - "create unit tests for this file" - "add tests for [class name]" - "test [file path]" ## Process ### 1. Identify Target File **Ask user for file to test** (if not provided): ``` Which file would you like to generate tests for? Provide the file path or class name (e.g., BalanceInformationViewModel.swift) ``` **Read target file** and determine type: - ViewModel: Has `ViewModelType`, `Input`, `Output`, `transform` method - UseCase: Implements `*UseCaseType` protocol - Service: Implements service protocol ### 2. Read Testing Guide **CRITICAL**: Read the comprehensive testing guide: ``` ~/Library/Application Support/Code/User/prompts/ios-mc-generate-unit-test.prompt.md ``` This guide contains ALL rules, patterns, and examples to follow. ### 3. Analyze Target File **Extract from target file:** - Class name and type (ViewModel/UseCase/Service) - All dependencies (injected in initializer) - Protocol types for each dependency - Public methods and their signatures - Input/Output structure (for ViewModels) - Observable/Single/Completable return types **Search for protocol definitions** if needed: ```bash Glob: **/*UseCaseType.swift Grep: "protocol [DependencyName]" ``` ### 4. Generate Test File **Create complete test file** at: ``` PayooMerchantTests/[appropriate-folder]/[ClassName]Tests.swift ``` **Folder structure:** - ViewModels → `PayooMerchantTests/ViewModel/` - UseCases → `PayooMerchantTests/UseCase/` - Services → `PayooMerchantTests/Mock/Service/` **Test file MUST include:** 1. **Required imports**: ```swift import XCTest import RxSwift import RxCocoa import RxTest import RxBlocking import Domain @testable import PayooMerchant ``` 2. **Test class with nested mocks**: - ALL moc