npx skills add ...
npx skills add openshift/lightspeed-service --skill find-duplication
npx skills add openshift/lightspeed-service --skill find-duplication
Find code duplication in the codebase. Supports two modes - scoped to current branch changes or a full codebase sweep. Use when the user asks to find duplicated code, copy-paste, repeated patterns, or wants to deduplicate before a PR.
Detect duplicated or near-duplicate code and suggest consolidation candidates.
ols/). Skip test duplication unless explicitly asked.Ask the user:
ols/ directory.For branch mode:
For full mode, the target is ols/.
Review output. Filter out false positives:
Pylint only catches textual similarity. Also look for:
For each duplicate found, classify:
| Category | Action |
|---|---|
| Extract — identical logic in 3+ places | Recommend a shared helper |
| Parameterize — same structure, different values | Recommend a common function with parameters |
| Acceptable — similar but serving different domains | Note it, no action needed |
| Test-only — repeated test setup/fixtures | Recommend shared fixture (only if user asked) |
For each finding:
Summary: total findings, how many actionable, estimated lines saved.
rg "<distinctive pattern>" ols/ --type py -l