home / skills / shotaiuchi / dotclaude / context-ios

context-ios skill

/dotclaude/skills/context-ios

This skill helps you implement iOS features and follow MVVM patterns using SwiftUI, async/await, and Combine with clean architecture guidelines.

npx playbooks add skill shotaiuchi/dotclaude --skill context-ios

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.2 KB
---
name: context-ios
description: >-
  iOS development context. Apply when working with .swift files,
  Xcode project, SwiftUI views, async/await, Combine, MVVM patterns.
user-invocable: false
---

# iOS Context Rule

Auto-applied context when working on iOS development tasks.

## When to Apply

Apply this context when:
- Implementing iOS features (ViewModel, Repository)
- Creating SwiftUI views
- Using async/await or Combine
- Applying MVVM patterns

## Reference Documents

Read and apply patterns from:

| Document | Purpose |
|----------|---------|
| [Clean Architecture](../../references/common/clean-architecture.md) | Layer separation principles |
| [Testing Strategy](../../references/common/testing-strategy.md) | Test patterns and coverage |
| [iOS Conventions](../../references/platforms/ios/conventions.md) | Naming, structure, idioms |
| [Architecture Patterns](../../references/platforms/ios/architecture-patterns.md) | MVVM/State management |

## External References

| Resource | URL |
|----------|-----|
| Swift Concurrency | https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/ |
| SwiftUI | https://developer.apple.com/documentation/swiftui/ |
| Combine | https://developer.apple.com/documentation/combine/ |

Overview

This skill provides iOS development context for working with .swift files, Xcode projects, SwiftUI views, async/await, Combine, and MVVM patterns. Use it to align code, architecture, and tests with common iOS conventions and clean-architecture principles. It helps maintain consistent layering, naming, and state management across app code.

How this skill works

When applied, the skill guides implementation choices for ViewModels, Repositories, SwiftUI views, and async flows. It enforces patterns like separating domain, data, and presentation layers, preferring Swift Concurrency for async code and Combine where reactive streams are appropriate. It also nudges toward testable structures and consistent naming conventions used in iOS projects.

When to use it

  • Implementing ViewModel or Repository layers in an iOS app
  • Creating or refactoring SwiftUI views and state flows
  • Converting callback code to async/await or mixing with Combine
  • Designing features following MVVM and clean-architecture separation
  • Writing unit and integration tests for Swift components

Best practices

  • Keep UI logic in SwiftUI views minimal; push business logic to ViewModels
  • Use async/await for straightforward asynchronous flows; use Combine for stream transformations and publishers
  • Define clear layer boundaries: Domain -> Data -> Presentation
  • Make ViewModels testable by injecting repositories and abstracting side effects
  • Follow platform naming and file-organization conventions for readability

Example use cases

  • Build a SwiftUI screen that loads data via a ViewModel using async/await
  • Refactor a delegate/callback networking layer into a repository that returns async results
  • Implement a search feature using Combine publishers to debounce input and update state
  • Structure feature modules to separate domain models, data sources, and UI components
  • Write unit tests for a ViewModel that depends on a mocked repository

FAQ

Should I always prefer async/await over Combine?

Prefer async/await for simple async flows and sequential code; use Combine for continuous streams, transformations, or when integrating with existing publisher-based APIs.

Where should state live in MVVM + SwiftUI?

Keep ephemeral UI state in the SwiftUI view, persistent or shared state in the ViewModel, and authoritative domain state in domain layer objects or repositories.