jpskill.com
🛠️ 開発・MCP コミュニティ

tech-debt-analyzer

ソースコードを調べて、技術的負債につながる兆候を見つけ、ビジネスへの影響が大きいものから優先順位をつけることで、手戻りの多い箇所を特定し、効率的な改善を支援するSkill。

📜 元の英語説明(参考)

Scans codebases for technical debt signals and prioritizes them by business impact. Finds TODO/FIXME/HACK comments, outdated dependencies, code duplication, and correlates with git history to identify high-churn debt hotspots. Use when someone asks about technical debt, code quality audit, refactoring priorities, or maintainability assessment. Trigger words: tech debt, code quality, refactoring, TODOs, maintainability, code health.

🇯🇵 日本人クリエイター向け解説

一言でいうと

ソースコードを調べて、技術的負債につながる兆候を見つけ、ビジネスへの影響が大きいものから優先順位をつけることで、手戻りの多い箇所を特定し、効率的な改善を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o tech-debt-analyzer.zip https://jpskill.com/download/15460.zip && unzip -o tech-debt-analyzer.zip && rm tech-debt-analyzer.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15460.zip -OutFile "$d\tech-debt-analyzer.zip"; Expand-Archive "$d\tech-debt-analyzer.zip" -DestinationPath $d -Force; ri "$d\tech-debt-analyzer.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して tech-debt-analyzer.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → tech-debt-analyzer フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

技術的負債アナライザー

概要

このスキルは、静的コード解析と Git の履歴を組み合わせることで、技術的負債を特定し、優先順位を付けます。単にコードの臭いを見つけるだけでなく、「どの負債が実際に私たちを苦しめているのか?」という重要な問いに答えます。複雑さと変更頻度、バグ密度、開発者の競合を関連付けることで、それを実現します。

手順

ステップ 1: 負債シグナルを収集する

以下の指標について、コードベースをスキャンします。

# コンテキスト付きの TODO/FIXME/HACK マーカー
grep -rn "TODO\|FIXME\|HACK\|XXX\|WORKAROUND" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.java" src/

# 長い関数 (プロキシ: 関数宣言間の行数をカウント)
# 古い依存関係
npm outdated 2>/dev/null || pip list --outdated 2>/dev/null || go list -m -u all 2>/dev/null

ステップ 2: 複雑さを測定する

ファイルごとに、循環的複雑度を推定します。

  • 分岐ステートメント (if、else、switch cases、三項演算子、catch、&&、||) をカウントします。
  • 複雑度が 15 を超える関数を高いとフラグ付けします。
  • 平均複雑度が 10 を超えるファイルを懸念されるものとしてフラグ付けします。

ステップ 3: Git の履歴を分析する

# ファイルごとの変更頻度 (過去 6 か月)
git log --since="6 months ago" --pretty=format: --name-only | sort | uniq -c | sort -rn | head -30

# バグ修正の相関関係 (fix/bug/hotfix に言及するコミット)
git log --since="6 months ago" --grep="fix\|bug\|hotfix" --pretty=format: --name-only | sort | uniq -c | sort -rn | head -20

# 開発者の競合 (ファイルごとのユニークな作成者)
git log --since="3 months ago" --pretty=format:"%an" -- <file> | sort -u | wc -l

ステップ 4: スコアリングと優先順位付け

各負債項目について、複合スコア (0-10) を計算します。

  • 変更頻度 (30%): ファイルが変更される頻度
  • バグ密度 (30%): このファイルを参照するバグ修正コミットの数
  • 開発者の競合 (20%): 週に何人の開発者がそれに取り組んでいるか
  • 複雑さスコア (20%): 正規化された循環的複雑度

以下のように分類します。

  • P0: スコア ≥ 8 — 今すぐこのスプリントで修正してください。積極的に苦痛を引き起こしています。
  • P1: スコア 5-7.9 — 四半期内にスケジュールします。
  • P2: スコア < 5 — 監視しますが、優先順位を付けません。

ステップ 5: 改善チケットを生成する

P0 および P1 項目について、構造化されたチケットを以下のように作成します。

  • 具体的なメトリクスを含む問題の説明
  • 受け入れ基準 (測定可能)
  • 推奨されるリファクタリングアプローチ
  • ストーリーポイントでの見積もり工数 (1-13 スケール)
  • リスク評価

例 1: モノレポスキャン

ユーザープロンプト:

Python Django プロジェクトの技術的負債の優先順位を分析してください

エージェントの出力:

技術的負債分析 — myproject/ (156 ファイル、22,400 LOC)

P0 — 今すぐこのスプリントで修正してください
  views/checkout.py     スコア: 9.1  複雑さ: 38  チャーン: 24/月  バグ: 9
    → 340 行の process_order() が、支払い、在庫、メール、ロギングを処理します
    → 推奨事項: OrderProcessor、PaymentHandler、NotificationService に抽出します

P1 — 今四半期
  models/user.py        スコア: 6.8  複雑さ: 22  チャーン: 12/月  バグ: 4
    → User モデルには 28 個のメソッドがあり、一部はユーザー ドメインとは関係ありません
    → 推奨事項: ProfileMixin、PreferencesMixin を抽出します

P2 — 監視
  utils/legacy_xml.py   スコア: 1.3  複雑さ: 31  チャーン: 0/月   バグ: 0
    → 複雑ですが、完全に安定しています。リファクタリングしないでください。

負債トレンド指標: 📈 増加 (3 か月前と比較して、しきい値を超えるファイルが +3)

例 2: 依存関係監査

ユーザープロンプト:

Node.js プロジェクトで、古くて危険な依存関係がないか確認してください

エージェントの出力:

依存関係の負債レポート
──────────────────────

重大 (セキュリティ + メジャーバージョンが遅れている)
  lodash          4.17.15 → 4.17.21    3 件の既知の脆弱性
  express         4.17.1  → 4.21.2     1 件の中程度の CVE

メジャーバージョンが遅れている
  typescript      4.9.5   → 5.7.3      5.x で破壊的な変更
  jest            27.5.1  → 29.7.0     移行ガイドが利用可能

マイナーアップデート (低リスク)
  axios           1.6.0   → 1.7.9
  dotenv          16.3.1  → 16.4.7

推奨事項: 重大な項目にすぐに対処してください (1 ~ 2 時間)。
TypeScript 5.x への移行を専用のスプリントタスクとしてスケジュールします (2 ~ 3 日)。

ガイドライン

  • コードの純粋さよりもビジネスへの影響 — 決して変更されず、決して壊れない複雑なファイルは、優先度の高い負債ではありません
  • 意見よりもデータ — 勘ではなく、常に Git メトリクスで優先順位付けを裏付けてください
  • 安定したレガシーコードの書き換えを推奨しないでください — 動作し、誰も触れない場合は、そのままにしておきます
  • 工数の見積もりを含める — 改善コストのない負債は実行可能ではありません
  • トレンドを追跡する — 単一のスナップショットは役立ちます。時間の経過とともにスナップショットを比較すると強力です
  • チームのコンテキストを尊重する — リファクタリングにドメイン知識またはチーム間の連携が必要な場合は、注意してください
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Technical Debt Analyzer

Overview

This skill identifies and prioritizes technical debt by combining static code analysis with git history. Instead of just finding code smells, it answers the critical question: "Which debt is actually hurting us?" by correlating complexity with change frequency, bug density, and developer contention.

Instructions

Step 1: Gather Debt Signals

Scan the codebase for these indicators:

# TODO/FIXME/HACK markers with context
grep -rn "TODO\|FIXME\|HACK\|XXX\|WORKAROUND" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.java" src/

# Long functions (proxy: count lines between function declarations)
# Outdated dependencies
npm outdated 2>/dev/null || pip list --outdated 2>/dev/null || go list -m -u all 2>/dev/null

Step 2: Measure Complexity

For each file, estimate cyclomatic complexity:

  • Count branching statements (if, else, switch cases, ternary, catch, &&, ||)
  • Flag functions with complexity > 15 as high
  • Flag files with average complexity > 10 as concerning

Step 3: Analyze Git History

# Change frequency per file (last 6 months)
git log --since="6 months ago" --pretty=format: --name-only | sort | uniq -c | sort -rn | head -30

# Bug-fix correlation (commits mentioning fix/bug/hotfix)
git log --since="6 months ago" --grep="fix\|bug\|hotfix" --pretty=format: --name-only | sort | uniq -c | sort -rn | head -20

# Developer contention (unique authors per file)
git log --since="3 months ago" --pretty=format:"%an" -- <file> | sort -u | wc -l

Step 4: Score and Prioritize

Calculate a composite score (0-10) for each debt item:

  • Change frequency (30%): How often the file is modified
  • Bug density (30%): How many bug-fix commits reference this file
  • Developer contention (20%): How many developers work on it weekly
  • Complexity score (20%): Normalized cyclomatic complexity

Classify into:

  • P0: Score ≥ 8 — Fix this sprint, it's actively causing pain
  • P1: Score 5-7.9 — Schedule within the quarter
  • P2: Score < 5 — Monitor but don't prioritize

Step 5: Generate Remediation Tickets

For P0 and P1 items, produce structured tickets with:

  • Problem description with specific metrics
  • Acceptance criteria (measurable)
  • Suggested refactoring approach
  • Estimated effort in story points (1-13 scale)
  • Risk assessment

Examples

Example 1: Monorepo Scan

User prompt:

Analyze our Python Django project for tech debt priorities

Agent output:

Tech Debt Analysis — myproject/ (156 files, 22,400 LOC)

P0 — Fix This Sprint
  views/checkout.py     Score: 9.1  Complexity: 38  Churn: 24/mo  Bugs: 9
    → 340-line process_order() handles payment, inventory, email, logging
    → Recommendation: Extract into OrderProcessor, PaymentHandler, NotificationService

P1 — This Quarter
  models/user.py        Score: 6.8  Complexity: 22  Churn: 12/mo  Bugs: 4
    → User model has 28 methods, some unrelated to user domain
    → Recommendation: Extract ProfileMixin, PreferencesMixin

P2 — Monitor
  utils/legacy_xml.py   Score: 1.3  Complexity: 31  Churn: 0/mo   Bugs: 0
    → Complex but completely stable. Do not refactor.

Debt trend indicator: 📈 Growing (+3 files above threshold vs 3 months ago)

Example 2: Dependency Audit

User prompt:

Check for outdated and risky dependencies in our Node.js project

Agent output:

Dependency Debt Report
──────────────────────

CRITICAL (security + major version behind)
  lodash          4.17.15 → 4.17.21    3 known vulnerabilities
  express         4.17.1  → 4.21.2     1 moderate CVE

MAJOR VERSION BEHIND
  typescript      4.9.5   → 5.7.3      Breaking changes in 5.x
  jest            27.5.1  → 29.7.0     Migration guide available

MINOR UPDATES (low risk)
  axios           1.6.0   → 1.7.9
  dotenv          16.3.1  → 16.4.7

Recommendation: Address critical items immediately (1-2 hours).
Schedule TypeScript 5.x migration as a dedicated sprint task (2-3 days).

Guidelines

  • Business impact over code purity — a complex file that never changes and never breaks is NOT high priority debt
  • Data over opinions — always back prioritization with git metrics, not gut feeling
  • Don't recommend rewriting stable legacy code — if it works and nobody touches it, leave it alone
  • Include effort estimates — debt without remediation cost is not actionable
  • Track trends — a single snapshot is useful; comparing snapshots over time is powerful
  • Respect team context — note when refactoring requires domain knowledge or coordination across teams