本文へ移動
cccskills
無料GitHub で公開日本語紹介

improve-codebase-architecture

コードの構造を調べ、理解やテストを難しくしている箇所の改善案を図入りHTMLレポートにまとめます。候補を選んだ後は、制約や設計判断を対話で掘り下げます。

原文Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

インストール方法を見る

こんなときに便利

  • 変更が多い領域の設計を見直したいとき
  • リファクタリング案を図で比較
  • テストしやすいモジュール設計を検討
  • 用語や設計判断の理由を記録

日本語での紹介

できること

コードベースを調べ、理解やテストを難しくしている構造の改善候補を示します。中心となるのは、複雑な処理を簡潔な利用口の内側にまとめる設計です。各候補の対象ファイル、問題、解決案、利点、推奨度を、変更前後の図付きHTMLレポートで比較できます。

こんなときに便利

一つの概念を理解するために多くの小さなモジュールを行き来する場合や、現在の構造ではテストしにくい場合に向いています。指定した領域、または変更履歴で頻繁に登場する領域を優先して調べます。候補を選んだ後は、制約や依存関係、設計、残すテストを対話で検討します。

使い方の例

  • 「最近よく変更している領域の設計を調べ、改善候補を図で比較して」
  • 「このモジュールをテストしやすくする案を検討して」

注意点

codebase-design、grilling、domain-modelingの各スキルを利用します。GLOSSARY.mdとdocs/adr/の設計判断を参照し、検討中に用語集を更新する場合があります。レポートはOSの一時ディレクトリに保存し、表示にはCDN経由のTailwindとMermaidを使用します。

この紹介文は、公開されている SKILL.md をもとに AI(Claude Haiku)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(3)

  • SKILL.md5.9 KB
  • agents/openai.yaml166 B
  • HTML-REPORT.md6.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Improve Codebase Architecture

Surface architectural friction and propose deepening opportunities: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.

This command is informed by the project's domain model and built on a shared design vocabulary:

  • Call the Skill tool with "codebase-design" for the architecture vocabulary (module, interface, depth, seam, adapter, leverage, locality) and its principles (the deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real"). Use these terms exactly in every suggestion, and don't drift into "component," "service," "API," or "boundary."
  • The domain language in GLOSSARY.md gives names to good seams; ADRs in docs/adr/ record decisions this command should not re-litigate.

Process

1. Explore

Scope before you scan: YAGNI. Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide where to look before you look:

  • If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.
  • Otherwise, walk back a good stretch of the commit history (git log --oneline) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.

Read the project's domain glossary (GLOSSARY.md) and any ADRs in the area you're touching first.

Then spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:

  • Where does understanding one concept require bouncing between many small modules?
  • Where are modules shallow, with an interface 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 (no locality)?
  • Where do tightly-coupled modules leak across their seams?
  • Which parts of the codebase are untested, or hard to test through their current interface?

Apply the deletion test to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.

2. Present candidates as an HTML report

Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from $TMPDIR, falling back to /tmp (or %TEMP% on Windows), and write to <tmpdir>/architecture-review-<timestamp>.html so each run gets a fresh file. Open it for the user (xdg-open <path> on Linux, open <path> on macOS, start <path> on Windows) and tell them the absolute path.

The report uses Tailwind via CDN for layout and styling, and Mermaid via CDN for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a before/after visualisation. Be visual.

For each candidate, render a card with:

  • Files: which files/modules are involved
  • Problem: why the current architecture is causing friction
  • Solution: plain English description of what would change
  • Benefits: explained in terms of locality and leverage, and how tests would improve
  • Before / After diagram: side-by-side, custom-drawn, illustrating the shallowness and the deepening
  • Recommendation strength: one of Strong, Worth exploring, Speculative, rendered as a badge

End the report with a Top recommendation section: which candidate you'd tackle first and why.

Use GLOSSARY.md vocabulary for the domain, and the /codebase-design vocabulary for the architecture. If GLOSSARY.md defines "Order," talk about "the Order intake module," not "the FooBarHandler," and not "the Order service."

ADR conflicts: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: "contradicts ADR-0007, but worth reopening because…"). Don't list every theoretical refactor an ADR forbids.

See HTML-REPORT.md for the full HTML scaffold, diagram patterns, and styling guidance.

Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"

3. Grilling loop

Once the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.

Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:

  • Naming a deepened module after a concept not in GLOSSARY.md? Add the term to GLOSSARY.md. Create the file lazily if it doesn't exist.
  • Sharpening a fuzzy term during the conversation? Update GLOSSARY.md right there.
  • User rejects the candidate with a load-bearing reason? Offer an ADR, framed as: "Want me to record this as an ADR so future architecture reviews don't re-suggest it?" Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.
  • Want to explore alternative interfaces for the deepened module? Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

ask-matt

無料日本語概要

アイデアの整理、実装、不具合調査など、状況に合う関連スキルと使う順序を案内します。作業の規模や段階に応じて、次に進む手順を選ぶための相談役です。

  • アイデアから実装までの手順選び
  • 不具合調査の始め方を知りたいとき
  • 複数回に分ける開発の進め方を相談
mattpocock/skills28.5万2026年10月9日 更新

chief-of-staff

無料日本語概要

長期的な目標に向けて複数のサブエージェントの作業を調整し、利用者との対話を続けながら、次の仕事にも役立つ作業環境や規約の改善を進めるスキル。

  • 長期目標に向けて担当を調整したいとき
  • 裏で作業を進めながら対話を続けたいとき
  • 共通の規約や作業環境を改善したいとき
mattpocock/skills28.5万2026年10月9日 更新

claude-handoff

無料日本語概要

進行中の会話を引き継ぎ用に要約し、新しいバックグラウンドエージェントへ渡します。次の作業方針や参照資料を整理して、現在の作業場所で続きを始めます。

  • 新しいエージェントに続きを任せたいとき
  • 次の作業範囲を絞って引き継ぎたいとき
  • 次のセッション用に参照資料を整理
mattpocock/skills28.5万2026年10月9日 更新

code-review

無料日本語概要

指定したコミットやブランチなどを基準にコードの変更を確認し、開発規約への適合と仕様の実現を別々にレビューします。二つの観点の指摘を分けて報告するスキルです。

  • ブランチやPRの変更レビュー
  • 指定コミットやタグ以降の確認
  • 文書化された開発規約との照合
mattpocock/skills28.5万2026年10月9日 更新

codebase-design

無料日本語概要

呼び出し側が覚える使い方を小さく保ち、複雑な処理を内部にまとめる設計を支援します。共通の用語と判断基準で、モジュールの使いやすさやテストのしやすさを検討するスキルです。

  • モジュールの使い方を簡単にしたいとき
  • 散らばった複雑な処理をまとめたいとき
  • 実装を差し替える場所の検討
mattpocock/skills28.5万2026年10月9日 更新

diagnosing-bugs

無料日本語概要

再現しにくい不具合や処理速度の悪化を、症状を判定するテストやスクリプトで調べます。原因候補の検証から修正、再発防止の確認まで進めるスキル。

  • 再現しにくいエラーを調べたいとき
  • 処理が遅くなった原因の調査
  • 断続的な不具合を繰り返し検証
mattpocock/skills28.5万2026年10月9日 更新

mattpocock のスキルをすべて見る

このスキルの問題を報告する