Communitygithub.com

アーキテクチャ改善スキル

コードベースを探索し、アーキテクチャ改善の機会を見つけ出します。テスト容易性を高めるため、浅いモジュールを深くするリファクタリングを提案します。ユーザーがアーキテクチャ改善、リファクタリング機会の発見、密結合モジュールの統合、AIがナビゲートしやすいコードベースへの改善を望む場合に使用します。

アーキテクチャ改善スキル とは?

このスキルは、John Ousterhout氏の『A Philosophy of Software Design』で提唱された「深いモジュール」概念に基づき、コードベースのアーキテクチャを改善するための包括的なプロセスを提供します。AIエージェント(Claude Code、Cursorなど)上で動作し、コードベースを有機的に探索して、テスト容易性やAIによるナビゲーションの障壁となるアーキテクチャ上の摩擦点を発見します。具体的には、浅いモジュール(インターフェースが実装とほぼ同等に複雑なもの)や密結合モジュールを特定し、それらを深いモジュール(小さなインターフェースで大きな実装を隠す)へとリファクタリングするための複数の設計案を生成します。プロセスは、コードベース探索→改善候補の提示→ユーザーによる選択→問題領域のフレーム化→複数エージェントによる並行設計→比較・推奨→GitHub Issue作成、という7つのステップで構成され、アーキテクチャ改善における人間の判断とAIの高速な探索・設計能力を組み合わせた効率的なワークフローを実現します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/improve-codebase-architecture

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

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

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

深いモジュール(John Ousterhout著『A Philosophy of Software Design』)とは、小さなインターフェースの背後に大きな実装を隠したモジュールのことです。深いモジュールはテスト容易性が高く、AIによるナビゲーションが容易であり、内部ではなく境界でテストすることが可能になります。

プロセス

1. コードベースの探索

Agentツールをsubagent_type=Exploreで使用し、コードベースを自然にナビゲートします。厳格なヒューリスティックに従わず、有機的に探索し、摩擦を感じた箇所を記録します。

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

あなたが感じた摩擦こそがシグナルです。

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を共有します。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cdcoonce/Portfolio_Website

Git commit workflow with enforced conventional commit style. Use when Claude needs to stage and commit changes, craft commit messages, or the user asks to commit, make a commit, or save their work. Ensures consistent commit message format, proper scoping, and atomic commits across the project.

cdcoonce/Portfolio_Website

AI-powered code quality analysis for Python, Markdown, and Mermaid diagrams. Use this skill when: (1) reviewing code for quality issues, (2) checking Python files for PEP8 violations, unused code, missing type hints, docstring problems, complexity issues, or potential runtime errors, (3) validating Markdown documentation for broken links, heading structure, or formatting issues, (4) validating Mermaid diagram syntax, (5) the user asks for a "code review" or "quality check", (6) analyzing code snippets pasted in conversation, or (7) suggesting and applying fixes for code quality issues.

cdcoonce/Portfolio_Website

Deploy the portfolio chat agent Lambda function to AWS. Use when the user asks to deploy, redeploy, push to Lambda, update the chat agent, or after updating context files or lambda_function.py. Rebuilds the knowledge base, packages dependencies, and deploys to AWS Lambda.

cdcoonce/Portfolio_Website

Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".

cdcoonce/Portfolio_Website

Orchestrate the full GitHub-issues-driven development lifecycle. 7-phase pipeline from brainstorm through PR with state tracking and cross-conversation resume. Use when user says "dev cycle", "development workflow", "full development pipeline", or invokes /dev-cycle.

cdcoonce/Portfolio_Website

Production Python coding standards with automatic version detection (3.10-3.13). Use when writing, reviewing, or refactoring Python to ensure adherence to modern type syntax, LBYL exception handling, pathlib operations, ABC-based interfaces, and production-tested patterns. Not Dagster-specific - applies to any Python project.

cdcoonce/Portfolio_Website

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

cdcoonce/Portfolio_Website

GitHub CLI (gh) integration for managing issues, pull requests, branches,

cdcoonce/Portfolio_Website

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

cdcoonce/Portfolio_Website

CEO/founder-mode plan review. Rethink the problem, find the 10-star product, challenge premises, expand scope when it creates a better product. Three modes: SCOPE EXPANSION (dream big), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Use when the user asks for a plan review, CEO review, mega review, or wants a plan challenged/stress-tested before implementation.

cdcoonce/Portfolio_Website

Break a PRD into independently-grabbable GitHub issues using tracer-bullet vertical slices. Use when user wants to convert a PRD to issues, create implementation tickets, or break down a PRD into work items.

cdcoonce/Portfolio_Website

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in docs/plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

cdcoonce/Portfolio_Website

Generate or update the `.claude/docs/project.md` file that gives Claude project-specific context. Use this skill when the user asks to create, update, regenerate, or refresh project context, or says things like "update project.md", "generate project context", "this repo needs a project.md", or "Claude doesn't know about this project". Also trigger when onboarding Claude to a new repository for the first time.

cdcoonce/Portfolio_Website

Generate comprehensive, high-quality README.md files for code repositories. Use this skill whenever the user asks to create, write, generate, update, or improve a README for any project or repository. Also trigger when the user says things like "document this project", "write docs for this repo", "this repo needs a README", "help me onboard developers to this codebase", or asks for project documentation in markdown. Even if the user just says "README" or "readme" in the context of a codebase, use this skill.

cdcoonce/Portfolio_Website

Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

cdcoonce/Portfolio_Website

Set up pre-commit hooks for the current repo. Use when user wants to add pre-commit hooks, configure commit-time linting, formatting, type checking, or testing. Triggers on "pre-commit", "git hooks", "linting hooks", or /setup-pre-commit.

cdcoonce/Portfolio_Website

Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

cdcoonce/Portfolio_Website

Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.

cdcoonce/Portfolio_Website

Rewrites the prose sections of wiki pages in-place. Reads source files to understand current context, then updates only the content inside <!-- claude:prose --> ... <!-- claude:prose:end --> markers. Never touches <!-- generated:start --> ... <!-- generated:end --> blocks. Supports targeting a single page with /update-wiki {PageName}.

cdcoonce/Portfolio_Website

Create a PRD through user interview, codebase exploration, and module design, then submit as a GitHub issue. Use when user wants to write a PRD, create a product requirements document, or plan a new feature.

関連スキル