返回顶部
c

combine-code-reviewCombine代码审查

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
安全检测
已通过
130
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

combine-code-review

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.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部