TypeScriptコード重複検出・共通化スキル。similarity-tsを使用してコードの意味的類似を検出し、リファクタリング計画を立てる。「重複コードを見つけて」「共通化したい」「類似コード検出」「似たコードがある」などのリクエスト時に使用。
How this skill is triggered — by the user, by Claude, or both
Slash command
/typescript-rules-plugin:code-similarity-tsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```
1. similarity-tsで類似コード検出
↓
2. 検出結果を分析
↓
3. 共通化の優先度判断
↓
4. リファクタリング計画を提示
similarity-ts . --threshold 0.8 --min-lines 10
# ヘルプ確認
similarity-ts -h
# 閾値調整(類似度80%以上)
--threshold 0.8
# 最小行数(10行以上のブロック)
--min-lines 10
# 特定ディレクトリのみ
similarity-ts src/
| 優先度 | 条件 |
|---|---|
| High | 類似度90%以上、頻出パターン |
| Medium | 類似度80-90%、複数ファイルに分散 |
| Low | 類似度80%未満、局所的 |
## 重複検出結果
### 🔴 High Priority
1. **{ファイル1}:{行} ↔ {ファイル2}:{行}**
- 類似度: 95%
- 推奨: ユーティリティ関数に抽出
- 共通化案: `utils/parseConfig.ts`
### 🟡 Medium Priority
...
## リファクタリング計画
1. {共通化対象1} → {対応方針}
2. {共通化対象2} → {対応方針}
npx claudepluginhub dio0550/d-market-typescript --plugin typescript-rules-pluginDetects code duplicates using jscpd token-level analysis across files, classifies exact/near/structural clones, ranks by impact score (lines x instances), prepares prioritized refactoring plans.
Extracts duplicated code into shared utilities, components, hooks, and modules from repeated patterns across files like identical functions, UI blocks, state management, or boilerplate.
Detects code clones and copy-paste patterns in any language using structural fingerprinting. Surfaces duplicate candidates for AI-assisted review and refactoring.