From cortexloop
Deep correctness and architecture analysis: traces control flow, state, invariants, and module boundaries. Use for bug fixes, refactors, async paths, and domain logic reviews.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cortexloop:correctness-reviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Depth skill for **pass 1 (`review`)**. Pair with `cortexloop-expert-core` and `edge-case-and-state-analysis`.
Depth skill for pass 1 (review). Pair with cortexloop-expert-core and edge-case-and-state-analysis.
Go deep on correctness and architecture. This is not a shallow lint pass — trace logic, invariants, and structural fit. Other domains (security exploits, test gaps, perf bottlenecks, dead code) get defer notes, not scored findings in this pass.
Input sanitization / injection → defer
security. Missing test for an edge → defertests.
Swallowed errors, empty catch, bad fallbacks → defer
errorHandling.
Authz on API → defer
security. N+1 in API handler → deferperformance.
Focus on clarity that affects correctness risk, not style preferences:
users that's actually active users only)Pure formatting, rename-only nits, behavior-preserving simplification → defer
simplicityor Info.
- What should this change accomplish?
- What invariants must always hold?
- What did upstream handoffs defer here? (pass 1: usually none)
deferToLaterPasses → testsFor each hot path in scope:
Input → validation (logic) → transform → persist/read → output
Mark: branches taken, state before/after, what can go wrong
Use edge-case-and-state-analysis for state machines and ordering.
| Severity | Correctness examples |
|---|---|
| Critical | Data loss/corruption, broken core workflow, race with production impact |
| High | Wrong result on common path, invariant violated under realistic input |
| Medium | Edge case wrong with limited blast radius |
| Low | Defensive improvement, unclear but currently safe |
| Info | Maintainability note without proven bug |
Every scored item needs Trigger → Path → Expected vs actual → Impact.
| Signal | Defer pass |
|---|---|
| SQLi, XSS, secrets, authz bypass | security |
| No test for behavior | tests |
| catch {} / silent failure | errorHandling |
| N+1, unbounded loop, sync I/O on hot path | performance |
| Extract method / reduce nesting (same behavior) | simplicity |
| Unused symbol / dead file | cleanup |
State what must always be true:
"Invariant: account.balance >= sum(pending debits)"
"Violation path: concurrent debit without lock at L42"
Same rule in two files — will one be updated without the other?
await fetchUser()
// gap: user may be deleted here
await charge(user.id)
Distinguish misuse of framework from application logic error — cite API doc or guarantee when dismissing.
| Trap | Reality |
|---|---|
| "LGTM, tests pass" | Tests don't prove architecture or un tested edges |
| Score security/perf here because it's "important" | Important ≠ your pass — defer |
| Speculative bugs without trigger path | openQuestions only |
| 50 Medium findings from style | Focus on proven correctness risk |
| Rubber-stamp upstream defer list | Re-verify deferred items still belong elsewhere |
A strong pass-1 finding reads like:
### High — Stale balance after async transfer
- **Location:** src/ledger.ts:88
- **Category:** correctness
- **Problem:** transfer() reads balance, awaits external call, writes balance without re-read — concurrent transfer can overwrite
- **Evidence:** Trigger: two parallel transfer(A→B) and transfer(A→C); Path: read balance 100 → both pass check → both write → lost update
- **Confidence:** high
- **Recommendation:** optimistic lock on row version or serializable transaction
- **Auto-fixable:** no
Go deep enough that a developer can reproduce the failure class without guessing.
npx claudepluginhub whitequeen306/code-cortex-loop --plugin cortexloopAutomatically triggered correctness review lens that evaluates logical validity, boundary conditions, invariant preservation, concurrency correctness, and state management.
Analyzes codebase architecture via multi-agent specialists on structure, coupling, integration, error handling, security; verifies findings, reports strengths and flaws with evidence.
Adversarial code auditor that hunts bugs, logic errors, and security flaws across any codebase. Use for deep correctness passes, not style reviews.