askill
dedupe-scan

dedupe-scanSafety 95Repository

Find and report duplicated code patterns. Read-only - does not fix.

0 stars
1.2k downloads
Updated 2/20/2026

Package Files

Loading files...
SKILL.md

/dedupe-scan [path]

Read-only scan for duplicated code patterns. Reports findings without making changes.

No arguments? Describe this skill and stop. Do not execute.

Process

  1. Search for common duplication patterns
  2. Analyze each finding for true duplication
  3. Report with consolidation recommendations

Also Detect: AI-Generated Antipatterns

In addition to duplicates, flag these signs of AI-generated code:

AntipatternHow to Detect
Over-abstractionFactory/Builder/Wrapper classes used only once
Defensive paranoiaNull checks on values that can never be null
Speculative featuresConfig options with only one value ever used
Wrapper classesClasses that just delegate to another class
Enterprise patternsAbstractFactory, *Builder, *Manager in simple code

Report these in a separate "AI Antipatterns Detected" section.


Patterns to Detect

Search for these function/pattern names appearing in multiple files:

PATTERN                         SEARCH
──────────────────────────────────────────────────────────────
Directory operations            function copy.*Directory
                                function.*Recursive
Hashing                         function hash
                                createHash
Git operations                  execSync.*git
                                getGitCommit
                                getGitRemote
File operations                 fs.readFileSync (repeated)
                                fs.writeFileSync (repeated)
                                fs.existsSync (repeated patterns)
Validation                      function validate
                                function is[A-Z].*\(
Path resolution                 path.join.*\.claude
                                homedir()
Error handling                  try.*catch (identical blocks)

Search Commands

Run these searches in parallel:

# Function definitions appearing in multiple files
grep -r "function copy" --include="*.ts" | grep -v test | grep -v node_modules

# Hash functions
grep -r "function hash" --include="*.ts" | grep -v test | grep -v node_modules

# Git exec calls
grep -r "execSync.*git" --include="*.ts" | grep -v test | grep -v node_modules

# Repeated utility patterns
grep -r "createHash" --include="*.ts" | grep -v test | grep -v node_modules

Analysis Criteria

A pattern is TRUE DUPLICATION if:

  • Same logic in 2+ files
  • Could be extracted to shared utility
  • No semantic reason to keep separate

A pattern is FALSE POSITIVE if:

  • Similar names but different logic
  • Intentionally separate (different algorithms)
  • Test files duplicating production code

REQUIRED Output Format

## Deduplication Report: [path]

DUPLICATIONS_FOUND: N

### 1. [Pattern Name]
FILES:
- [file1:line] - [brief description]
- [file2:line] - [brief description]

RECOMMENDATION: [Extract to utils/X.ts | Keep separate because Y]

### 2. [Pattern Name]
...

FALSE_POSITIVES_SKIPPED: N
- [pattern]: [reason kept separate]

CONSOLIDATION_PRIORITY:
1. [highest impact pattern]
2. [next pattern]
3. ...

DEDUPLICATION_COMPLETE

Example Output

## Deduplication Report: src/

DUPLICATIONS_FOUND: 3

### 1. copyDirectoryRecursive
FILES:
- src/canon/helpers.ts:114 - sync recursive copy
- src/workflow/index.ts:223 - sync recursive copy
- src/profiles/apply.ts:94 - async recursive copy

RECOMMENDATION: Extract to utils/fs.ts with sync and async variants

### 2. hashDirectory
FILES:
- src/canon/hash.ts:21 - hashSkillDirectory
- src/workflow/index.ts:191 - hashDirectory

RECOMMENDATION: Keep separate - different algorithms for different manifest formats

FALSE_POSITIVES_SKIPPED: 1
- validateProfile: Different validation logic per module

CONSOLIDATION_PRIORITY:
1. copyDirectoryRecursive (3 files, identical logic)
2. git operations (2 files, execSync vs file read)

DEDUPLICATION_COMPLETE

After Analysis

Report findings only. Use /deduplication to consolidate duplicates.

Comparison

SkillFindsFixes
/dedupe-scan✗ (read-only)
/deduplication✓ (consolidates)

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

88/100Analyzed 2/24/2026

A well-structured, actionable skill for scanning duplicated code patterns in TypeScript projects. Provides detailed pattern detection table, specific grep commands, analysis criteria for true vs false positives, and clear output format. Read-only design ensures safety. Includes helpful comparison table with related /deduplication skill. Slightly lacking an explicit 'when to use' trigger section. Tags and structured folder location indicate proper skill organization.

95
88
85
82
90

Metadata

Licenseunknown
Version-
Updated2/20/2026
PublisherObjective-Arts

Tags

github-actionsllmtesting