Technical Debt Detector

VerifiedSafe

Detects and reports technical debt including TODO comments, duplicate code, unused imports, long functions, deep nesting, magic numbers, and outdated dependencies. Generates a prioritized report to help developers improve code quality and maintainability.

Sby Skills Guide Bot
DevelopmentIntermediate
1606/2/2026
Claude Code
#techdebt#code-quality#static-analysis#refactoring

Recommended for

Our review

Scans and reports technical debt in source code, including TODOs, dead code, overly long functions, and outdated dependencies.

Strengths

  • Systematic detection of multiple types of technical debt
  • Prioritized report that facilitates corrective actions
  • Uses native tools (grep, bash) with no external dependencies
  • Multi-language support (JS, Python, Go, Ruby)

Limitations

  • Heuristic detection may produce false positives
  • No automatic fixes, only reports
  • Can be slow on very large codebases
When to use it

When you want to assess codebase quality, prepare for refactoring, or track technical debt over time.

When not to use it

If you need automatic problem correction, or if you require a deeper analysis with specific metrics.

Security analysis

Safe
Quality score88/100

The skill uses only read-only shell commands (grep) to scan source files for patterns; no destructive commands, no exfiltration, no disabling of safety features. The allowed Bash tool is used for benign code analysis.

No concerns found

Examples

Full scan of current project
/techdebt
Scan a specific directory
/techdebt src/
Show only high-priority items
/techdebt --high-only

name: techdebt description: "技術的負債の検出と修正提案。重複コード、TODOコメント、未使用import、複雑度の高い関数を検出。トリガー: /techdebt, 技術的負債, コード品質チェック" user-invocable: true allowed-tools: Read, Grep, Glob, Bash model: sonnet

技術的負債レポーター

コードベースの技術的負債を検出し、優先度付きのレポートを生成します。

検出項目

1. TODOコメント

# 検出パターン
grep -rn "TODO\|FIXME\|HACK\|XXX\|TEMP" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.rb"

2. 重複コード

  • 類似パターンの検出(5行以上の重複)
  • コピペの痕跡

3. 未使用コード

  • 未使用の import/require
  • 未使用の変数・関数・クラス
  • デッドコード(到達不能なコード)

4. 長すぎる関数

  • 100行以上の関数を検出
  • パラメータが6個以上の関数

5. 深いネスト

  • 4階層以上のネストを検出
  • 複雑な条件分岐

6. マジックナンバー

  • 意味不明な数値リテラル
  • ハードコードされた文字列

7. 古い依存関係

  • package.json / go.mod / requirements.txt の outdated チェック
  • セキュリティ脆弱性のある依存

実行フロー

  1. 対象ディレクトリを特定(引数がなければ src/ または現在ディレクトリ)
  2. 各検出項目を並列で実行
  3. 結果を集計・優先度付け
  4. レポートを生成

優先度の基準

| 優先度 | 条件 | |--------|------| | 高 | セキュリティリスク、本番障害の可能性 | | 中 | 保守性低下、バグの温床になりやすい | | 低 | コード品質向上、リファクタリング推奨 |

出力形式

## 技術的負債レポート

**スキャン日時**: YYYY-MM-DD HH:MM
**対象**: <directory>
**ファイル数**: N files

---

### サマリー

| カテゴリ | 件数 | 優先度高 | 優先度中 | 優先度低 |
|---------|------|---------|---------|---------|
| TODO | 5 | 1 | 2 | 2 |
| 重複コード | 3 | 0 | 3 | 0 |
| 未使用コード | 8 | 0 | 2 | 6 |
| 長い関数 | 2 | 0 | 2 | 0 |
| 深いネスト | 4 | 1 | 3 | 0 |
| マジックナンバー | 6 | 0 | 0 | 6 |

**合計**: 28件 (高:2, 中:12, 低:14)

---

### 詳細

#### TODO (5件)

| ファイル | 行 | 内容 | 優先度 |
|---------|-----|------|-------|
| src/api.ts | 45 | TODO: エラーハンドリング追加 | 高 |
| src/util.ts | 12 | FIXME: レースコンディション | 中 |

#### 重複コード (3件)

| 場所1 | 場所2 | 行数 | 優先度 |
|-------|-------|------|-------|
| src/a.ts:10-30 | src/b.ts:45-65 | 20行 | 中 |

#### 長い関数 (2件)

| ファイル | 関数名 | 行数 | 優先度 |
|---------|--------|------|-------|
| src/handler.ts | processRequest | 150行 | 中 |

---

### 改善推奨度

⭐⭐⭐⭐ (対応を強く推奨)

### 次のアクション

1. [高] src/api.ts:45 のエラーハンドリングを追加
2. [高] src/handler.ts:78 の深いネストをリファクタリング
3. [中] 重複コード3箇所を共通関数に抽出

使用方法

/techdebt              # 現在のプロジェクト全体をスキャン
/techdebt src/         # src/ ディレクトリのみ
/techdebt --high-only  # 優先度高のみ表示

注意事項

  • 大規模プロジェクトでは時間がかかる場合がある
  • 検出結果はヒューリスティクスに基づくため、誤検出の可能性がある
  • 自動修正は行わない(レポートのみ)
Related skills