Agent skill
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.
Install this agent skill to your Project
npx add-skill https://github.com/existential-birds/beagle/tree/main/plugins/beagle-ios/skills/combine-code-review
SKILL.md
Combine Code Review
Quick Reference
| Issue Type | Reference |
|---|---|
| Publishers, Subjects, AnyPublisher | references/publishers.md |
| map, flatMap, combineLatest, switchToLatest | references/operators.md |
| AnyCancellable, retain cycles, [weak self] | references/memory.md |
| tryMap, catch, replaceError, Never | references/error-handling.md |
Review Checklist
- All
sinkclosures use[weak self]when self owns cancellable - No
assign(to:on:self)usage (useassign(to: &$property)or sink) - All AnyCancellables stored in Set or property (not discarded)
- Subjects exposed as
AnyPublisherviaeraseToAnyPublisher() -
flatMapused correctly (not whenmap + switchToLatestneeded) - Error handling inside
flatMapto keep main chain alive -
tryMapfollowed bymapErrorto restore error types -
receive(on: DispatchQueue.main)before UI updates - PassthroughSubject for events, CurrentValueSubject for state
- Future wrapped in Deferred when used with retry
When to Load References
- Reviewing Subjects or publisher selection → publishers.md
- Reviewing operator chains or combining publishers → operators.md
- Reviewing subscriptions or memory issues → memory.md
- Reviewing error handling or try* operators → error-handling.md
Review Questions
- Are all subscriptions being retained? (Check for discarded AnyCancellables)
- Could any sink or assign create a retain cycle with self?
- Does flatMap need to be switchToLatest for search/autocomplete?
- What happens when this publisher fails? (Will it kill the main chain?)
- Are error types preserved or properly mapped after try* operators?
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
review-python
Comprehensive Python/FastAPI backend code review with optional parallel agents
review-verification-protocol
Mandatory verification steps for all code reviews to reduce false positives. Load this skill before reporting ANY code review findings.
sqlalchemy-code-review
Reviews SQLAlchemy code for session management, relationships, N+1 queries, and migration patterns. Use when reviewing SQLAlchemy 2.0 code, checking session lifecycle, relationship() usage, or Alembic migrations.
fastapi-code-review
Reviews FastAPI code for routing patterns, dependency injection, validation, and async handlers. Use when reviewing FastAPI apps, checking APIRouter setup, Depends() usage, or response models.
pytest-code-review
Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.
postgres-code-review
Reviews PostgreSQL code for indexing strategies, JSONB operations, connection pooling, and transaction safety. Use when reviewing SQL queries, database schemas, JSONB usage, or connection management.
Didn't find tool you were looking for?