- Home
- Skills
- Code Quality & Review
- DedupeGuard: Code Duplication Scanner
Works with the AI tools you already use
DedupeGuard: Code Duplication Scanner
Deterministic AST-based duplication scanner to detect redundant code, imports, and dead functions in large files.
$19
DedupeGuard: Code Duplication Scanner
Example session with this skill installed
Audit auth_service.py for duplication. It has grown significantly after the last three refactorings and feels redundant.
- Read your context and instructions
- Compiled the dedupeguard
- Generated the document
I have completed the redundancy audit for auth_service.py. The scan identified significant duplication in the import section and three functions with identical logic but different names.
Redundancy Audit Report
| Finding Type | Location | Detail | Recommended Action |
|---|---|---|---|
| CRITICAL | Ratio: 32.4% | 580 of 1790 lines are duplicated | Immediate refactor required before adding features |
IMPORT_DUPLICATE | Lines 12, 45, 89 | from jose import jwt imported 3 times | Keep line 12; remove others |
FUNC_DUPLICATE | Lines 210, 540 | validate_token and check_auth_header are identical | Merge into validate_token |
BLOCK_DUPLICATE | 310-335, 920-945 | 25-line identical block for RSA key loading | Extract to _load_rsa_key() |
DEAD_CODE | Line 1205 | Function legacy_verify is never called locally | Verify external usage, then delete |
Next steps
- Consolidate the
jose.jwtimports to the top of the file to resolve the high-frequency duplication. - Extract the RSA key loading logic into a private helper method to reduce the duplication ratio by approximately 8%.
- Run the audit again after merging the identical validation functions to confirm the status drops to WARNING.
dedupeguard-code-duplication-scanner.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
AI agents often hallucinate by duplicating imports or re-implementing existing logic when refactoring large files. This skill acts as a static analysis layer that detects redundant functions, blocks, and imports before technical debt makes the codebase unmaintainable.
What it does
- Function hashing identifies identical logic even if function names differ.
- Import auditing flags repeated import statements, a common artifact of multi-turn AI coding sessions.
- Block detection scans for identical code segments of five or more lines across the file.
- Class analysis identifies classes with high method overlap (over 70%) for potential inheritance refactoring.
- Redundancy metrics calculates a duplication ratio to provide a clear technical debt score.
- Dead code marking highlights local functions and variables that are defined but never referenced.
How it works
- Source Parsing: The skill parses the target file into an Abstract Syntax Tree (AST).
- Signature Hashing: It normalizes code blocks by removing whitespace and comments to generate unique hashes.
- Collision Detection: It identifies nodes with identical hashes and maps them to their specific line numbers.
- Metric Calculation: It generates a JSON report with a risk assessment (CLEAN to CRITICAL) based on the duplication ratio.
Frameworks & tools
This skill utilizes language-specific parsers including Python ast, JavaScript @babel/parser, and go/parser. It is designed for integration into CI/CD pipelines or as a pre-processing step in AI agent workflows.
Why this beats prompting it yourself
Standard LLMs struggle to track line numbers accurately or perform exhaustive sliding-window comparisons on large files. This tool uses deterministic AST hashing to guarantee 100% accuracy in finding identical blocks that a human or generic prompt would overlook.
Use cases
- Auditing legacy files over 1000 lines before attempting a major refactor.
- Automated PR reviews to catch "copy-paste" coding patterns.
- Preventing AI agents from polluting files with redundant imports during iterative edits.
- Identifying candidates for extraction into shared helper libraries.
Known limitations
This skill is not suitable for files under 200 lines or auto-generated code like ORM migrations and Protobuf files. It scans for local file redundancy and requires an import graph for project-wide dead code analysis.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean today
- Passed all security checks, Safe to install
Needs access to