1.5 KiB
1.5 KiB
name, description
| name | description |
|---|---|
| duplicate-code-check | Find and report code duplication introduced by a merge request. Use when asked to check for duplicates, repeated logic, or copy-paste code in a branch or MR diff. |
Duplicate Code Check
Scans the diff of a branch or merge request for duplicated logic and produces a structured report with locations, severity and suggested actions. Does not remove any code without explicit user approval.
Input
User should provide:
- branch name where duplication check should be done
- target branch name to compare
Steps
-
Fetch the diff for the branch or MR
-
Scan the diff for duplicate blocks. Use criteria:
- identical or near-identical method bodies (more than 10 lines);
- copy-pasted conditional blocks or switch/case arms;
- repeated string literals or constants that could be extracted;
- utility functions that already exist elsewhere in the codebase.
-
Ask the user before suggesting any removal
-
Write the report.
Output format
Create the file duplication-check-<branch name>.md with the table with next columns:
- all duplications
- risk level of removing each code duplication
- user decision is necessary.
Rules
- Always check that safe delete is being suggested and there are no usages of removed code.
- Always ask before removing any code duplication.
Passing criteria
The skill is complete only if:
- all files in the diff were scanned;
- no code was modified without explicit user approval;
- the report is written to
duplication-check-<branch name>.mdfile.