architecture-design
できること
このスキルは、ファクトリーとレジストリを中心にした、機械学習プロジェクトのモジュール式のコード構成を説明します。MLプロジェクトに新しいデータセット、モデル、その他の差し替え可能な部品を追加する開発者のためのものです。
使う場面
- ✓登録が必要なデータセットやモデルのクラスを作るとき。
- ✓ファクトリーの配線を伴う新しいモジュールのフォルダを、MLプロジェクトに追加するとき。
- ✓MLプロジェクトを一から始めて、明確な構成がほしいとき。
スキルのリンク
https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/architecture-design/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“MLプロジェクトに、私たちのファクトリーのパターンに従って、新しい登録済みのデータセットのクラスを追加してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはプロジェクトのパターンに従い、登録用のデコレータを追加して、モジュールのファクトリーを通して新しい部品をつなぎます。バグ修正や小さな編集には、このパターンを使いません。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Architecture Design - ML Project Template
This skill defines the standard code architecture for machine learning projects based on the template structure. When modifying or extending code, follow these patterns to maintain consistency.
Overview
The project follows a modular, extensible architecture with clear separation of concerns. Each module (data, model, trainer, analysis) is independently organized using factory and registry patterns for maximum flexibility.
When to Use
Use this skill when:
- Creating a new Dataset class that needs
@register_dataset - Creating a new Model class that needs
@register_model - Creating a new module directory with
__init__.pyfactory wiring - Initializing a new ML project structure from scratch
- Adding new component types such as Augmentation, CollateFunction, or Metrics
When Not to Use
Do not use this skill when:
- Modifying existing functions or methods
- Fixing bugs in existing code
- Adding helper functions or utilities
- Refactoring without adding new registrable components
- Making simple code changes to a single file
- Modifying configuration files
- Reading or understanding existing code
Key indicator: if the task does not require a @register_* decorator or a Factory pattern, skip this skill.
Core Design Patterns
Factory Pattern
Each module uses a factory to create instances dynamically:
# Example from data_module/dataset/__init__.py
DATASET_FACTORY: Dict = {}
def DatasetFactory(data_name: str):
dataset = DATASET_FACTORY.get(data_name, None)
if dataset is None:
print(f"{data_name} dataset is not implementation, use simple dataset")
dataset = DATASET_FACTORY.get('simple')
return dataset
For detailed guidance, refer to references/factory_pattern.md.
Registry Pattern
Components register themselves via decorators:
# Example from data_module/dataset/simple_dataset.py
@register_dataset("simple")
class SimpleDataset(Dataset):
def __init__(self, data):
self.data = data
For detailed guidance, refer to references/registry_pattern.md.
Auto-Import Pattern
Modules automatically discover and import submodules:
# Example from data_module/dataset/__init__.py
models_dir = os.path.dirname(__file__)
import_modules(models_dir, "src.data_module.dataset")
For detailed guidance, refer to references/auto_import.md.
Directory Structure
project/
├── run/
│ ├── pipeline/ # Main workflow scripts
│ │ ├── training/ # Training pipelines
│ │ ├── prepare_data/ # Data preparation pipelines
│ │ └── analysis/ # Analysis pipelines
│ └── conf/ # Hydra configuration files
│ ├── training/ # Training configs
│ ├── dataset/ # Dataset configs
│ ├── model/ # Model configs
│ ├── prepare_data/ # Data prep configs
│ └── analysis/ # Analysis configs
│
├── src/
│ ├── data_module/ # Data processing module
│ │ ├── dataset/ # Dataset implementations
│ │ ├── augmentation/ # Data augmentation
│ │ ├── collate_fn/ # Collate functions
│ │ ├── compute_metrics/ # Metrics computation
│ │ ├── prepare_data/ # Data preparation logic
│ │ ├── data_func/ # Data utility functions
│ │ └── utils.py # Module-specific utilities
│ │
│ ├── model_module/ # Model implementations
│ │ ├── brain_decoder/ # Brain decoder models
│ │ └── model/ # Alternative model location
│ │
│ ├── trainer_module/ # Training logic
│ ├── analysis_module/ # Analysis and evaluation
│ ├── llm/ # LLM-related code
│ └── utils/ # Shared utilities
│
├── data/
│ ├── raw/ # Original, immutable data
│ ├── processed/ # Cleaned, transformed data
│ └── external/ # Third-party data
│
├── outputs/
│ ├── logs/ # Training and evaluation logs
│ ├── checkpoints/ # Model checkpoints
│ ├── tables/ # Result tables
│ └── figures/ # Plots and visualizations
│
├── pyproject.toml # Project configuration
├── uv.lock # Dependency lock file
├── TODO.md # Task tracking
├── README.md # Project documentation
└── .gitignore # Git ignore rules
For detailed directory structure with file descriptions, refer to `r
よくある質問
いつ使うべきではありませんか?
登録された部品を追加しないバグ修正、小さなヘルパー関数、設定の変更には使いません。
レジストリとは何ですか?
部品が自分を登録する検索リストで、ファクトリーが名前で部品を作れるようにします。
ほかの種類の部品も扱いますか?
はい。augmentation、collate関数、メトリクスなど、ほかの部品も挙げられています。
詳細
作者による元の説明
Use only when creating new registrable ML components that require Factory or Registry patterns.
人気
- GitHubのスター
- 6.0k
- ランキング
- #14479
- ライセンス
- MIT
- 更新日
- 2026/10/19
コメント
- …
このリポジトリの他のスキル
agent-identifier
6.0kClaude Codeのエージェントを作る方法をエージェントに教えます。名前、トリガーの説明、システムプロンプト、設定を正しく書きます。
bug-detective
6.0k理解、証拠の収集、仮説の検証、修正の確認という手順で、コードのエラーを見つけて直すようエージェントを支援します。
citation-verification
6.0k学術論文の各引用を信頼できる学術情報源と照らして確認し、偽物や誤った参考文献を見つけるようエージェントを支援します。
code-review-excellence
6.0kコードの変更とプルリクエストを、明確で親切で優先順位の付いたフィードバックでレビューし、本当のバグを見つけてコードを改善するようエージェントを支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。