One-liners. Updated as I go.
Safety (don't break the working app)
Behavior-preserving by default — a dedup must produce identical observable output; if it can't, it's not a dedup.
Verify equivalence before merging — quote both implementations, confirm byte/algorithm-identical; differ → don't merge.
Reject the audit when it's wrong — judgment over blind application (rejected DUP-10 tested-API, DUP-17 not-equivalent, DUP-03/14 variant-drift).
Preserve intentional divergence via options, not forked copies (e.g. handleEscapedQuotes keeps the validator's behavior).
Additive fixes over rewrites — emit-only-when-present changes can't regress existing output (e.g. for-each var-init).
Never change a tested public API just to dedup; keep the name/contract.
Single source of truth
Extract shared logic to one util; callers become thin delegating wrappers that keep their names/exports → zero caller churn.
Generic over specific when one algorithm serves multiple shapes (), still fully typed.
Reuse before writing — if logic exists, refactor to share it, don't add a copy.
Fix latent bugs surfaced while deduping (real targetHandle bug, missing var-init, broken type alias) — but call them out in the commit.
Proof (done = proven)
Gate every change: tsc --noEmit clean + vitest 576/576 + npm run build green.
tsc lies on moves (incremental cache) — npm run build (rollup) is the real gate for import/path changes; bust .tsbuildinfo when in doubt.
Commit per issue, small + frequent, message references the DUP-/GOD- id + states the proof.
Code quality
No any anywhere — generics or specific types.
Files ≤300 lines, single responsibility (CLAUDE.md); split god-files into types/utils/hooks/subcomponents.
Barrels for folder moves so external imports stay stable.
Token economy
Targeted vitest per fix; full build+suite batched every 2–3 fixes / before push.
Delegate wide cross-file reads/equivalence checks to a subagent; apply edits in the main session.
Coordination
Concurrent sessions sync via a shared status file + git — lock active files, list done/next, commit often so others see progress.
Top comments (0)