К основному содержанию
скилл CX Codex

ios-testing — скилл для Claude Code: что делает и как установить

Скилл ios-testing для Claude Code собирает практики тестирования модульных приложений на iOS 26 и Swift 6.2. Описывает юнит-, UI- и снэпшот-тесты с учётом изоляции акторов и протокольных моков.

MIT 288 установок ★ 227 обновлён 2026-08-15

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add pproenca/dot-skills --skill ios-testing -a claude-code
Открыть на GitHub

Что делает ios-testing

Скилл содержит 44 инженерных правила в 8 категориях, ранжированных по уровню влияния. Руководство задаёт стандарты для модульного MVVM-C под iOS 26 и Swift 6.2. Модули функционала здесь подключают только Domain и DesignSystem. Вся сетевая работа, SwiftData и фоновый ввод-вывод изолированы в слое Data, а ViewModels обращаются к репозиториям напрямую через протоколы.

Внутри собраны паттерны для нового фреймворка Swift Testing с макросами #expect и #require. Правила охватывают проверку моделей @Observable, изоляцию на MainActor, работу со swift-snapshot-testing и паттерн Page Object в UI-тестах. Асинхронные цепочки проверяются без блокировок. Гайд жёстко привязан к контракту clinic MVVM-C, поэтому при иной модульности правила внедрения зависимостей придётся переносить вручную.

Какие задачи решает

  • перевести тестовый набор с XCTest на Swift Testing
  • настроить протокольные моки и шпионы без дублирования логики
  • проверить асинхронный код с изоляцией на MainActor
  • выстроить Page Object и идентификаторы доступности для UI-тестов
  • протестировать модели с макросом @Observable в SwiftUI

Примеры запросов агенту

  • Проверь тесты репозитория в модуле фичи на соответствие правилам ios-testing
  • Перепиши юнит-тесты ViewModel с XCTest на Swift Testing с использованием #expect
  • Напиши мок на основе протокола Domain для асинхронной проверки MainActor

Как установить ios-testing

1Через Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill ios-testing -a claude-code

2Вручную: положить файлы

~/.claude/skills/ios-testing/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/ios-testing/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы об ios-testing

Как установить ios-testing в Claude Code?

Выполните в терминале команду npx skills add pproenca/dot-skills --skill ios-testing -a claude-code. Навык запишется в файл ~/.claude/skills/ios-testing/SKILL.md.

Что делает скилл ios-testing?

Он передаёт агенту свод из 44 правил тестирования под Swift 6.2 и iOS 26. Правила регламентируют юнит-тесты, UI, визуальные регрессии, изоляцию акторов и внедрение зависимостей.

Какую архитектуру приложения предполагает этот гайд?

Скилл рассчитан на модульный MVVM-C, где фичи зависят только от Domain и DesignSystem. Вся работа со SwiftData и сетью находится в Data, а конкретные зависимости собираются в App-таргете.

Исходный текст

SKILL.md · MIT
---
name: ios-testing
description: Testing practices for iOS 26 / Swift 6.2 clinic modular MVVM-C applications. Covers unit/UI/snapshot testing, protocol-based mocks, async actor isolation, and dependency-injected test architecture aligned with Domain protocols, App-target composition, and Data-owned I/O boundaries. Use when writing, reviewing, or refactoring tests for ios-* and swift-* clinic modules.
---

# iOS Testing Best Practices

Comprehensive testing guide for iOS and Swift applications, written at principal engineer level. Contains 44 rules across 8 categories, prioritized by impact to guide test architecture decisions, test authoring patterns, and CI infrastructure.


## Clinic Architecture Contract (iOS 26 / Swift 6.2)

All guidance in this skill assumes the clinic modular MVVM-C architecture:

- Feature modules import `Domain` + `DesignSystem` only (never `Data`, never sibling features)
- App target is the convergence point and owns `DependencyContainer`, concrete coordinators, and Route Shell wiring
- `Domain` stays pure Swift and defines models plus repository, `*Coordinating`, `ErrorRouting`, and `AppError` contracts
- `Data` owns SwiftData/network/sync/retry/background I/O and implements Domain protocols
- Read/write flow defaults to stale-while-revalidate reads and optimistic queued writes
- ViewModels call repository protocols directly (no default use-case/interactor layer)

## When to Apply

Reference these guidelines when:
- Writing new unit tests or UI tests for iOS apps
- Designing testable architecture with dependency injection
- Testing async/await, actors, and Combine publishers
- Setting up snapshot testing or visual regression suites
- Configuring CI pipelines, test plans, and parallel execution

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Test Architecture & Testability | CRITICAL | `arch-` |
| 2 | Unit Testing Fundamentals | CRITICAL | `unit-` |
| 3 | Test Doubles & Isolation | HIGH | `mock-` |
| 4 | Async & Concurrency Testing | HIGH | `async-` |
| 5 | SwiftUI Testing | MEDIUM-HIGH | `swiftui-` |
| 6 | UI & Acceptance Testing | MEDIUM | `ui-` |
| 7 | Snapshot & Visual Testing | MEDIUM | `snap-` |
| 8 | Test Reliability & CI | LOW-MEDIUM | `ci-` |

## Quick Reference

### 1. Test Architecture & Testability (CRITICAL)

- [`arch-protocol-dependencies`](references/arch-protocol-dependencies.md) - Depend on protocols, not concrete types
- [`arch-constructor-injection`](references/arch-constructor-injection.md) - Use constructor injection over service locators
- [`arch-test-target-separation`](references/arch-test-target-separation.md) - Separate unit and UI test targets
- [`arch-testable-import`](references/arch-testable-import.md) - Use @testable import sparingly
- [`arch-single-responsibility-tests`](references/arch-single-responsibility-tests.md) - One assertion concept per test
- [`arch-arrange-act-assert`](references/arch-arrange-act-assert.md) - Structure tests as Arrange-Act-Assert

### 2. Unit Testing Fundamentals (CRITICAL)

- [`unit-swift-testing-framework`](references/unit-swift-testing-framework.md) - Use Swift Testing over XCTest for new tests
- [`unit-parameterized-tests`](references/unit-parameterized-tests.md) - Use parameterized tests for input variations
- [`unit-descriptive-test-names`](references/unit-descriptive-test-names.md) - Name tests after the behavior they verify
- [`unit-expect-over-assert`](references/unit-expect-over-assert.md) - Use #expect and #require over XCTAssert
- [`unit-require-preconditions`](references/unit-require-preconditions.md) - Use #require for test preconditions
- [`unit-test-suites`](references/unit-test-suites.md) - Organize related tests into suites
- [`unit-test-tags`](references/unit-test-tags.md) - Use tags to categorize cross-cutting tests

### 3. Test Doubles & Isolation (HIGH)

- [`mock-protocol-based-mocks`](references/mock-protocol-based-mocks.md) - Create mocks from protocols, not subclasses
- [`mock-spy-for-verification`](references/mock-spy-for-verification.md) - Use spies to verify interactions
- [`mock-stub-return-values`](references/mock-stub-return-values.md) - Use stubs for deterministic return values
- [`mock-avoid-over-mocking`](references/mock-avoid-over-mocking.md) - Avoid mocking value types and simple logic
- [`mock-fake-for-integration`](references/mock-fake-for-integration.md) - Use in-memory fakes for integration tests
- [`mock-dependency-container`](references/mock-dependency-container.md) - Use a dependency container for test configuration

### 4. Async & Concurrency Testing (HIGH)

- [`async-await-directly`](references/async-await-directly.md) - Await async functions directly in tests
- [`async-confirmation`](references/async-confirmation.md) - Use confirmation() for callback-based APIs
- [`async-mainactor-isolation`](references/async-mainactor-isolation.md) - Test MainActor-isolated code on MainActor
- [`async-actor-testing`](references/async-actor-testing.md) - Test actor state through async interface
- [`async-task-cancellation`](references/async-task-cancellation.md) - Test task cancellation paths explicitly

### 5. SwiftUI Testing (MEDIUM-HIGH)

- [`swiftui-test-observable-models`](references/swiftui-test-observable-models.md) - Test @Observable models as plain objects
- [`swiftui-environment-injection`](references/swiftui-environment-injection.md) - Inject environment dependencies for tests
- [`swiftui-preview-as-test`](references/swiftui-preview-as-test.md) - Use previews as visual smoke tests
- [`swiftui-view-model-extraction`](references/swiftui-view-model-extraction.md) - Extract logic from views into testable models
- [`swiftui-binding-testing`](references/swiftui-binding-testing.md) - Test binding behavior with @Bindable

### 6. UI & Acceptance Testing (MEDIUM)

- [`ui-accessibility-identifiers`](references/ui-accessibility-identifiers.md) - Use accessibility identifiers for element queries
- [`ui-page-object-pattern`](references/ui-page-object-pattern.md) - Encapsulate screens in page objects
- [`ui-launch-arguments`](references/ui-launch-arguments.md) - Configure test state via launch arguments
- [`ui-wait-for-elements`](references/ui-wait-for-elements.md) - Wait for elements instead of using sleep()
- [`ui-test-user-journeys`](references/ui-test-user-journeys.md) - Test complete user journeys, not individual screens
- [`ui-reset-state-between-tests`](references/ui-reset-state-between-tests.md) - Reset app state between UI tests

### 7. Snapshot & Visual Testing (MEDIUM)

- [`snap-swift-snapshot-testing`](references/snap-swift-snapshot-testing.md) - Use swift-snapshot-testing for visual regression
- [`snap-device-matrix`](references/snap-device-matrix.md) - Snapshot across device sizes and traits
- [`snap-named-references`](references/snap-named-references.md) - Use named snapshot references for clarity
- [`snap-inline-snapshots`](references/snap-inline-snapshots.md) - Use inline snapshots for non-image assertions

### 8. Test Reliability & CI (LOW-MEDIUM)

- [`ci-test-plans`](references/ci-test-plans.md) - Use Xcode Test Plans for environment configurations
- [`ci-parallel-execution`](references/ci-parallel-execution.md) - Enable parallel test execution
- [`ci-flaky-test-quarantine`](references/ci-flaky-test-quarantine.md) - Quarantine flaky tests instead of disabling them
- [`ci-deterministic-test-data`](references/ci-deterministic-test-data.md) - Use deterministic test data over random generation
- [`ci-coverage-thresholds`](references/ci-coverage-thresholds.md) - Set coverage thresholds for critical paths

## How to Use

Read individual reference files for detailed explanations and code examples:

- [Section definitions](references/_sections.md) - Category structure and impact levels
- [Rule template](assets/templates/_template.md) - Template for adding new rules

## Reference Files

| File | Description |
|------|-------------|
| [references/_sections.md](references/_sections.md) | Category definitions and ordering |
| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |
| [metadata.json](metadata.json) | Version and reference information |

© pproenca · MIT · pproenca/dot-skills

Похожие скиллы

Все скиллы по теме «Тесты и QA» →
swift-testing-pro Paul Hudson Скилл swift-testing-pro для Claude Code, Codex, Cursor и других агентов: пишет, проверяет и правит тесты на Swift Testing по актуальным API Swift 6.2. Покрывает async-тесты, миграцию с XCTest и новые фичи фреймворка. CX Codex +1 10 900установок swift-testing-expert AvdLee Скилл swift-testing-expert помогает писать и разбирать тесты на Swift Testing: макросы #expect и #require, теги, параметризация, миграция с XCTest. CX Codex +1 5 700установок axiom-testing CharlesWiltgen Скилл axiom-testing для написания и отладки тестов в Swift: подсказывает, когда брать Swift Testing, а когда XCTest, и разбирает причины падающих тестов. CX Codex +1 1 400установок swift-testing Prisma-Labs-Dev Скилл подкладывает агенту локальную документацию по Swift Testing: @Test, @Suite, #expect, #require, параметризованные тесты и переезд с XCTest. CX Codex +1 746установок ios-expert 0xfurai Субагент ios-expert для Claude Code помогает разрабатывать iOS-приложения на Swift и SwiftUI. Подключается к задачам по архитектуре приложения и оптимизации Swift. CX Codex ★ 1 029звёзд репо guide-swift-testing Prisma-Labs-Dev Скилл guide-swift-testing задаёт паттерны работы с фреймворком Swift Testing. Помогает писать и проверять тесты без ошибок в конкурентном коде. CX Codex +1 534установок

Из того же набора139

Весь набор →
rails-dev Скилл rails-dev для Claude Code задаёт правила разработки на Ruby on Rails: контроллеры, ActiveRecord и кеширование. Включается при рефакторинге моделей, миграциях и работе с Turbo Frames. CX Codex +1 299установок swift-optimise Скилл swift-optimise разбирает производительность Swift и SwiftUI: конкуренцию, отрисовку и анимации. Нужен при профилировании clinic-модулей. CX Codex +1 293установок ruby-optimise Скилл ruby-optimise для Claude Code подсказывает, как писать и проверять Ruby-код с учётом производительности. Разбирает работу с коллекциями, ActiveRecord и выделением памяти. CX Codex +1 292установок swift-refactor Скилл swift-refactor для Claude Code помогает перестроить существующий код SwiftUI под модульную MVVM-C-архитектуру. Он подключается к задачам по навигации, состоянию и разделению приложения на слои. CX Codex +1 289установок dev-rfc Скилл dev-rfc помогает писать технические предложения, проектные документы и архитектурные описания кодовой базы по готовым шаблонам. CX Codex +1 286установок swift-ui-architect Скилл swift-ui-architect контролирует модульную архитектуру MVVM-C на SwiftUI, Swift 6.2 и локальных SPM-пакетах. Защищает границы слоёв Domain, Data и Feature при генерации и рефакторинге кода. CX Codex +1 283установок ios-taste Скилл ios-taste проектирует интерфейсы SwiftUI для iOS 18+ с упором на задачи пользователя, исключая шаблонный код. CX Codex +1 280установок ios-storyboard Скилл ios-storyboard для Claude Code помогает поддерживать и рефакторить экраны Storyboard в проектах на Swift 6.2, править Auto Layout, разрешать конфликты слияния и готовить миграцию на SwiftUI. CX Codex +1 277установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой