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

improve-codebase-architecture

コードの構造を調べて改善点を見つけ、特にテストしやすいように浅いモジュールを深くすることで、リファクタリングや結合度の高いモジュール統合、AIによる解析を容易にするSkill。

📜 元の英語説明(参考)

Explore a codebase to find opportunities for architectural improvement, focusing on making the codebase more testable by deepening shallow modules. Use when: user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable.

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

一言でいうと

コードの構造を調べて改善点を見つけ、特にテストしやすいように浅いモジュールを深くすることで、リファクタリングや結合度の高いモジュール統合、AIによる解析を容易にするSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して improve-codebase-architecture.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → improve-codebase-architecture フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

コードベースのアーキテクチャ改善

AIのようにコードベースを探索し、アーキテクチャ上の摩擦を表面化させ、テスト容易性を向上させる機会を発見し、モジュールを深くするリファクタリングを GitHub issue の RFC として提案します。

深いモジュール(John Ousterhout, "A Philosophy of Software Design")は、小さなインターフェースで大きな実装を隠蔽しています。深いモジュールは、よりテストしやすく、AIによるナビゲートが容易で、内部ではなく境界でテストできます。

プロセス

1. コードベースの探索

subagent_type=Explore を指定した Agent ツールを使用して、コードベースを自然にナビゲートします。厳格なヒューリスティクスに従うのではなく、有機的に探索し、摩擦を感じる箇所をメモします。

  • ある概念を理解するために、多くの小さなファイルを飛び回る必要がある場所はどこですか?
  • モジュールが非常に浅く、インターフェースが実装とほぼ同じくらい複雑な場所はどこですか?
  • テスト容易性のためだけに純粋関数が抽出されたが、実際にはそれらの呼び出し方にバグが潜んでいる場所はどこですか?
  • 密結合されたモジュールが、それらの間の継ぎ目で統合リスクを生み出している場所はどこですか?
  • コードベースのどの部分がテストされていないか、またはテストが難しいですか?

あなたが遭遇する摩擦こそがシグナルです。

2. 候補の提示

モジュールを深くする機会を番号付きのリストで提示します。各候補について、以下を示します。

  • クラスタ: どのモジュール/概念が関与しているか
  • 結合している理由: 共有型、呼び出しパターン、概念の共同所有
  • 依存関係のカテゴリ: 4つのカテゴリについては REFERENCE.md を参照してください
  • テストへの影響: 既存のどのテストが境界テストに置き換えられるか

まだインターフェースを提案しないでください。ユーザーに「これらのうち、どれを探索したいですか?」と尋ねてください。

3. ユーザーが候補を選択

4. 問題空間のフレーミング

サブエージェントを生成する前に、選択された候補の問題空間について、ユーザー向けの解説を書きます。

  • 新しいインターフェースが満たす必要のある制約
  • 依存する必要のある依存関係
  • 制約を具体的にするための大まかな説明的なコードスケッチ — これは提案ではなく、制約を具体化する方法にすぎません

これをユーザーに示し、すぐにステップ 5 に進みます。ユーザーはサブエージェントが並行して作業している間、問題を読み、考えます。

5. 複数のインターフェースの設計

Agent ツールを使用して、3つ以上のサブエージェントを並行して生成します。それぞれが、深くされたモジュールに対して根本的に異なるインターフェースを生成する必要があります。

各サブエージェントに、個別の技術概要(ファイルパス、結合の詳細、依存関係のカテゴリ、隠蔽されているもの)をプロンプトとして与えます。この概要は、ステップ 4 のユーザー向けの解説とは独立しています。各エージェントに異なる設計制約を与えます。

  • エージェント 1: 「インターフェースを最小限に抑える — 最大で 1〜3 個のエントリポイントを目指す」
  • エージェント 2: 「柔軟性を最大化する — 多くのユースケースと拡張をサポートする」
  • エージェント 3: 「最も一般的な呼び出し元に合わせて最適化する — デフォルトのケースをトリビアルにする」
  • エージェント 4 (該当する場合): 「境界を越えた依存関係のために、ポートとアダプターのパターンを中心に設計する」

各サブエージェントは以下を出力します。

  1. インターフェースのシグネチャ(型、メソッド、パラメータ)
  2. 呼び出し元がどのように使用するかを示す使用例
  3. 内部的に隠蔽する複雑さ
  4. 依存関係戦略(依存関係の処理方法 — REFERENCE.md を参照)
  5. トレードオフ

設計を順番に提示し、散文で比較します。

比較後、あなた自身の推奨事項を示してください。どの設計が最も強力であるか、そしてその理由。異なる設計の要素がうまく組み合わされる場合は、ハイブリッドを提案してください。意見を持ってください — ユーザーは単なるメニューではなく、強力な意見を求めています。

6. ユーザーがインターフェースを選択(または推奨事項を受け入れる)

7. GitHub issue の作成

gh issue create を使用して、リファクタリング RFC を GitHub issue として作成します。REFERENCE.md のテンプレートを使用してください。作成する前にユーザーにレビューを依頼しないでください — 作成して URL を共有するだけです。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Improve Codebase Architecture

Explore a codebase like an AI would, surface architectural friction, discover opportunities for improving testability, and propose module-deepening refactors as GitHub issue RFCs.

A deep module (John Ousterhout, "A Philosophy of Software Design") has a small interface hiding a large implementation. Deep modules are more testable, more AI-navigable, and let you test at the boundary instead of inside.

Process

1. Explore the codebase

Use the Agent tool with subagent_type=Explore to navigate the codebase naturally. Do NOT follow rigid heuristics — explore organically and note where you experience friction:

  • Where does understanding one concept require bouncing between many small files?
  • Where are modules so shallow that the interface is nearly as complex as the implementation?
  • Where have pure functions been extracted just for testability, but the real bugs hide in how they're called?
  • Where do tightly-coupled modules create integration risk in the seams between them?
  • Which parts of the codebase are untested, or hard to test?

The friction you encounter IS the signal.

2. Present candidates

Present a numbered list of deepening opportunities. For each candidate, show:

  • Cluster: Which modules/concepts are involved
  • Why they're coupled: Shared types, call patterns, co-ownership of a concept
  • Dependency category: See REFERENCE.md for the four categories
  • Test impact: What existing tests would be replaced by boundary tests

Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"

3. User picks a candidate

4. Frame the problem space

Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:

  • The constraints any new interface would need to satisfy
  • The dependencies it would need to rely on
  • A rough illustrative code sketch to make the constraints concrete — this is not a proposal, just a way to ground the constraints

Show this to the user, then immediately proceed to Step 5. The user reads and thinks about the problem while the sub-agents work in parallel.

5. Design multiple interfaces

Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a radically different interface for the deepened module.

Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category, what's being hidden). This brief is independent of the user-facing explanation in Step 4. Give each agent a different design constraint:

  • Agent 1: "Minimize the interface — aim for 1-3 entry points max"
  • Agent 2: "Maximize flexibility — support many use cases and extension"
  • Agent 3: "Optimize for the most common caller — make the default case trivial"
  • Agent 4 (if applicable): "Design around the ports & adapters pattern for cross-boundary dependencies"

Each sub-agent outputs:

  1. Interface signature (types, methods, params)
  2. Usage example showing how callers use it
  3. What complexity it hides internally
  4. Dependency strategy (how deps are handled — see REFERENCE.md)
  5. Trade-offs

Present designs sequentially, then compare them in prose.

After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not just a menu.

6. User picks an interface (or accepts recommendation)

7. Create GitHub issue

Create a refactor RFC as a GitHub issue using gh issue create. Use the template in REFERENCE.md. Do NOT ask the user to review before creating — just create it and share the URL.