home / skills / willsigmon / sigstack / tca-migration

This skill guides you through migrating from The Composable Architecture to @Observable, accelerating code modernization and reducing Swift UI boilerplate.

npx playbooks add skill willsigmon/sigstack --skill tca-migration

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

Files (1)
SKILL.md
1.2 KB
---
name: TCA Migration
description: Remove TCA (Composable Architecture) - find usage, migrate to @Observable, delete reducers
allowed-tools: Read, Edit, Grep, Glob, Bash
---

# TCA Migration

Remove The Composable Architecture from Leavn codebase.

## Find TCA Usage
```bash
grep -r "Reducer" --include="*.swift" | grep -v "Pods\|DerivedData"
grep -r "Store\|ViewStore" --include="*.swift"
grep -r "@Dependency" --include="*.swift"
grep -r "ComposableArchitecture" --include="*.swift"
```

## Migration Pattern
TCA Feature → @Observable ViewModel

**Before (TCA)**:
```swift
@Reducer struct MyFeature {
  @ObservableState struct State { var count = 0 }
  enum Action { case increment }
  var body: some ReducerOf<Self> { ... }
}
```

**After (@Observable)**:
```swift
@Observable @MainActor
class MyViewModel {
  var count = 0
  func increment() { count += 1 }
}
```

## Removal Order
1. Leaf features (no child reducers)
2. Parent features (after children migrated)
3. App-level store (last)
4. Remove TCA from Package.swift

## Audit Command
```bash
find . -name "*Feature.swift" -o -name "*Reducer.swift" | wc -l
```

Use when: TCA removal, migration tracking, @Observable conversion

Overview

This skill provides a focused workflow to remove The Composable Architecture (TCA) from a Swift codebase by finding usages, migrating features to @Observable view models, and deleting reducers and package references. It codifies a migration pattern, a safe removal order, and a set of audit commands to track progress. The goal is a repeatable, low-risk transition from TCA to Swift's @Observable models.

How this skill works

The skill scans the codebase for TCA artifacts (Reducers, Stores, ViewStores, @Dependency, ComposableArchitecture) using targeted grep commands and file searches. It prescribes a migration pattern: convert TCA feature reducers to @Observable @MainActor view model classes with state properties and action methods. It then guides a staged removal sequence from leaf features up to the app-level store, followed by removing the TCA package entry and running an audit command to verify counts.

When to use it

  • When removing TCA from a Swift project and replacing it with @Observable view models.
  • When auditing how many TCA feature files remain during a migration.
  • Before deleting package references to ensure no lingering usages.
  • When planning a staged, low-risk migration from reducers to view models.
  • When converting tests and integration points away from Store/ViewStore APIs.

Best practices

  • Migrate leaf features first so parent reducers can be simplified safely.
  • Convert state and side-effectful actions into view model properties and methods annotated with @MainActor.
  • Keep changes small and review compile errors frequently to catch missed usages.
  • Remove package dependencies only after a full project search returns zero TCA references.
  • Use the audit command to track remaining *Feature.swift and *Reducer.swift files between commits.

Example use cases

  • Replace a small feature reducer with an @Observable MyViewModel class and remove its store wiring.
  • Run the grep commands to list all Store/ViewStore usages before refactoring.
  • Migrate child feature files, then update parent reducers to remove child reducer composition.
  • Delete TCA from Package.swift and run project build when the audit count reaches zero.
  • Track migration progress across a team by committing after each feature migration and running the audit command.

FAQ

What exact commands help find TCA usages?

Use grep to search for Reducer, Store, ViewStore, @Dependency, and ComposableArchitecture while excluding Pods/DerivedData. Example: grep -r "Reducer" --include="*.swift" | grep -v "Pods\|DerivedData"

What does a typical migration look like?

Transform @Reducer structs with @ObservableState into @Observable @MainActor classes that expose state as properties and actions as methods. Update call sites to use the view model instead of Store/ViewStore.

How do I verify I can remove TCA from Package.swift?

Run a full project search for TCA tokens and use the audit command: find . -name "*Feature.swift" -o -name "*Reducer.swift" | wc -l. Ensure it returns zero and the project builds cleanly before removing the package.