# Source Command Tech Dupes

> Code duplication analysis for StarMapper using jscpd. Detects repeated patterns across geocoding helpers, GitHub API formatting, compression utils, and cache logic.

- Skill: `florianbruniaux/source-command-tech-dupes` (Agent Skill)
- Install (CLI): `npx skillmds@latest add florianbruniaux/source-command-tech-dupes`
- Raw SKILL.md: https://api.skillmd.com/api/skills/florianbruniaux/source-command-tech-dupes/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: FlorianBruniaux (https://skillmd.com/u/florianbruniaux)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/florianbruniaux/source-command-tech-dupes

---


# source-command-tech-dupes

Use this skill when the user asks to run the migrated source command `tech-dupes`.

## Command Template

# Code Duplication Detector — StarMapper

## Usage

```
/tech:dupes
```

## What It Does

1. Runs `pnpm dupes` (jscpd) on the `src/` directory
2. Analyzes results against StarMapper-specific patterns
3. Outputs structured report with action plan

## Setup Check

If `pnpm dupes` is not configured, add to package.json:
```json
"dupes": "jscpd src/ --threshold 3 --min-lines 5 --reporters console,json --output .dupes-report"
```

And install: `pnpm add -D jscpd`

## StarMapper Duplication Patterns to Watch

| Pattern | Location | Risk |
|---------|----------|------|
| `location.toLowerCase().trim()` | geocoder, routes | Should exist ONLY in geocoder.ts |
| GitHub error parsing | github.ts, chunk/route.ts | Extract to github.ts |
| Compression/decompression logic | page.tsx, cache routes | Extract to lib/compression.ts |
| `checkDbHealth()` call pattern | user-cache, cache routes | OK if identical — it's a guard |
| `NextResponse.json({ error: ... })` patterns | all routes | Accept duplication here |
| `cursor ? { cursor } : {}` | github.ts | Should only be in github.ts |

## Thresholds

| Metric | Target | Action |
|--------|--------|--------|
| Duplication % | < 3% | Above → refactor |
| Clone count | < 10 | Above → prioritize |
| Max clone size | < 25 lines | Above → extract function |

## Output Format

```
## Duplication Report — StarMapper

**Date**: {date}
**Duplication**: X% ({target: < 3%})
**Clones found**: N

### Top Clones
1. [file:line] ↔ [file:line] — {N} lines
   Pattern: {brief description}
   Action: {extract to / delete duplicate}

### Action Plan
#### Quick Wins (< 30min)
1. ...

#### Refactoring (1-2h)
2. ...

#### Prevention
- Add `pnpm dupes` to CI check
```

