重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
composable-architecture by johnrogers/claude-swift-engineering
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill composable-architectureTCA 通过可组合的 reducer、集中式状态管理和副作用处理,为构建复杂、可测试的功能提供架构。核心原则:具有清晰依赖关系和可测试副作用的可预测状态演化。
如果内容有哪怕很小的可能需要,请务必加载参考文件。 拥有上下文总比遗漏模式或犯错误要好。
| 参考 | 加载时机 |
|---|---|
| Reducer Structure | 创建新的 reducer、设置 @Reducer、State、Action 或 @ViewAction 时 |
| Views - Binding | 使用 、双向绑定、 或 / 时 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@Bindablestore.send().onAppear.task| Views - Composition | 与 store 一起使用 ForEach、限定到子功能或处理可选子功能时 |
| Navigation - Basics | 设置 NavigationStack、路径 reducer、推送/弹出或程序化关闭时 |
| Navigation - Advanced | 深度链接、递归导航或将 NavigationStack 与 sheet 结合使用时 |
| Shared State | 使用 @Shared、.appStorage、.withLock 或在功能间共享状态时 |
| Dependencies | 创建 @DependencyClient、使用 @Dependency 或设置测试依赖时 |
| Effects | 使用 .run、.send、.merge、计时器、副作用取消或异步工作时 |
| Presentation | 使用 @Presents、AlertState、sheet、popover 或 Destination 模式时 |
| Testing - Fundamentals | 设置测试套件、makeStore 辅助函数或理解 Equatable 要求时 |
| Testing - Patterns | 测试 action、状态变更、依赖、错误或 presentation 时 |
| Testing - Advanced | 使用 TestClock、键路径匹配、exhaustivity = .off 或基于时间的测试时 |
| Testing - Utilities | 测试数据工厂、LockIsolated、ConfirmationDialogState 测试或 @Shared 测试时 |
| Performance | 优化状态更新、高频 action、内存或 store 限定时 |
过度模块化功能 — 将功能拆分成过多的小 reducer 会使状态管理更困难并增加组合开销。除非有真正的复用需求,否则应将相关的状态和 action 保持在一起。
副作用生命周期管理不当 — 状态变更时忘记取消副作用会导致数据过时、重复请求或竞态条件。对顺序副作用使用 .concatenate,并在适当时使用 .cancel。
导航状态放错位置 — 将导航状态放在子 reducer 而非父级中会导致不必要的视图重新加载和状态不一致。导航状态应属于拥有导航结构的功能。
测试时未使用 TestStore 详尽性检查 — 对“简单”副作用或“明显”状态变更跳过 TestStore 断言意味着你会错过错误。务必使用详尽性检查;它能及早发现回归问题。
错误地混合使用 async/await 与 Effects — 在没有适当取消或错误处理的情况下将 async/await 转换为 .run 副作用会失去隔离保证。请谨慎地将异步操作包装在带有 yield 语句的 .run 中。
每周安装量
63
代码仓库
GitHub 星标数
180
首次出现
2026年1月24日
安全审计
安装于
opencode52
codex52
gemini-cli49
claude-code49
cursor48
github-copilot48
TCA provides architecture for building complex, testable features through composable reducers, centralized state management, and side effect handling. The core principle: predictable state evolution with clear dependencies and testable effects.
ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.
| Reference | Load When |
|---|---|
| Reducer Structure | Creating new reducers, setting up @Reducer, State, Action, or @ViewAction |
| Views - Binding | Using @Bindable, two-way bindings, store.send(), or .onAppear/.task |
| Views - Composition | Using ForEach with stores, scoping to child features, or optional children |
| Navigation - Basics | Setting up NavigationStack, path reducers, pushing/popping, or programmatic dismiss |
| Navigation - Advanced | Deep linking, recursive navigation, or combining NavigationStack with sheets |
| Shared State | Using @Shared, .appStorage, .withLock, or sharing state between features |
| Dependencies | Creating @DependencyClient, using @Dependency, or setting up test dependencies |
| Effects | Using .run, .send, .merge, timers, effect cancellation, or async work |
| Presentation | Using @Presents, AlertState, sheets, popovers, or the Destination pattern |
| Testing - Fundamentals | Setting up test suites, makeStore helpers, or understanding Equatable requirements |
| Testing - Patterns | Testing actions, state changes, dependencies, errors, or presentations |
| Testing - Advanced | Using TestClock, keypath matching, exhaustivity = .off, or time-based tests |
| Testing - Utilities | Test data factories, LockIsolated, ConfirmationDialogState testing, or @Shared testing |
| Performance | Optimizing state updates, high-frequency actions, memory, or store scoping |
Over-modularizing features — Breaking features into too many small reducers makes state management harder and adds composition overhead. Keep related state and actions together unless there's genuine reuse.
Mismanaging effect lifetimes — Forgetting to cancel effects when state changes leads to stale data, duplicate requests, or race conditions. Use .concatenate for sequential effects and .cancel when appropriate.
Navigation state in wrong places — Putting navigation state in child reducers instead of parent causes unnecessary view reloads and state inconsistencies. Navigation state belongs in the feature that owns the navigation structure.
Testing without TestStore exhaustivity — Skipping TestStore assertions for "simple" effects or "obvious" state changes means you miss bugs. Use exhaustivity checking religiously; it catches regressions early.
Mixing async/await with Effects incorrectly — Converting async/await to .run effects without proper cancellation or error handling loses isolation guarantees. Wrap async operations carefully in .run with yield statements.
Weekly Installs
63
Repository
GitHub Stars
180
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode52
codex52
gemini-cli49
claude-code49
cursor48
github-copilot48
Kotlin Ktor 服务器模式指南:构建健壮 HTTP API 的架构与最佳实践
1,400 周安装