闲社服务运行正常AI智能体自动化平台
c

Combine代码审查

技能标识:combine-code-review

Reviews Combine framework code for memory leaks, operator misuse, and error handling. Use when reviewing code with import Combine, AnyPublisher, @Published, PassthroughSubject, or CurrentValueSubject.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.2.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Combine代码审查

Combine 代码审查

快速参考

问题类型参考
发布者、主题、AnyPublisherreferences/publishers.md
map、flatMap、combineLatest、switchToLatest
references/operators.md | | AnyCancellable、循环引用、[weak self] | references/memory.md | | tryMap、catch、replaceError、Never | references/error-handling.md |

审查清单

  • - [ ] 当 self 持有 cancellable 时,所有 sink 闭包都使用 [weak self]
  • [ ] 没有使用 assign(to:on:self)(应使用 assign(to: &$property) 或 sink)
  • [ ] 所有 AnyCancellable 存储在 Set 或属性中(未被丢弃)
  • [ ] 通过 eraseToAnyPublisher() 将 Subjects 暴露为 AnyPublisher
  • [ ] 正确使用 flatMap(非需要 map + switchToLatest 的情况)
  • [ ] 在 flatMap 内部处理错误以保持主链存活
  • [ ] tryMap 后跟 mapError 以恢复错误类型
  • [ ] UI 更新前使用 receive(on: DispatchQueue.main)
  • [ ] 事件使用 PassthroughSubject,状态使用 CurrentValueSubject
  • [ ] 与 retry 一起使用时,Future 包裹在 Deferred 中

何时加载参考

  • - 审查 Subjects 或发布者选择 → publishers.md
  • 审查操作符链或组合发布者 → operators.md
  • 审查订阅或内存问题 → memory.md
  • 审查错误处理或 try* 操作符 → error-handling.md

审查问题

  1. 1. 所有订阅是否都被保留?(检查是否有被丢弃的 AnyCancellable)
  2. 是否有任何 sink 或 assign 与 self 形成循环引用?
  3. 搜索/自动补全场景中,flatMap 是否需要替换为 switchToLatest?
  4. 当此发布者失败时会发生什么?(是否会终止主链?)
  5. 在 try* 操作符之后,错误类型是否被保留或正确映射?

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 combine-code-review-1776111550 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 combine-code-review-1776111550 技能

通过命令行安装

skillhub install combine-code-review-1776111550

下载

⬇ 下载 combine-code-review v1.2.0(免费)

文件大小: 7.77 KB | 发布时间: 2026-4-14 10:01

v1.2.0 最新 2026-4-14 10:01
- Added a detailed SKILL.md guide for reviewing Combine framework code.
- Included quick reference links to operator, publisher, memory, and error-handling documentation.
- Provided a comprehensive review checklist covering memory management, error handling, and operator selection.
- Outlined scenarios for loading specific reference materials.
- Listed key review questions to help ensure code safety and correctness.
返回顶部