architecture-design
Skill này làm gì
Skill này giải thích một bố cục code mô-đun cho dự án machine learning, xây dựng quanh factory và registry. Skill dành cho lập trình viên ML thêm các dataset, mô hình hoặc thành phần có thể cắm thêm khác vào dự án.
Khi nào nên dùng
- ✓Khi bạn đang tạo một lớp dataset hoặc mô hình mới cần được đăng ký.
- ✓Khi bạn đang thêm một thư mục mô-đun có kết nối factory vào dự án ML.
- ✓Khi bạn bắt đầu một dự án ML từ đầu và muốn có cấu trúc rõ ràng.
Liên kết skill
https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/architecture-design/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thêm một lớp dataset mới đã đăng ký vào dự án ML của tôi theo mẫu factory của chúng tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent làm theo mẫu của dự án, thêm một decorator đăng ký và kết nối thành phần mới qua factory của mô-đun. Agent bỏ qua mẫu này với các sửa lỗi đơn giản và chỉnh sửa nhỏ.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Khi nào không nên dùng nó?
Hãy bỏ qua nó với sửa lỗi, hàm trợ giúp nhỏ và thay đổi cấu hình, vì không có thành phần đăng ký nào được thêm vào.
Registry là gì?
Đó là một danh sách tra cứu nơi các thành phần tự đăng ký, để factory có thể tạo chúng theo tên.
Skill có bao quát các loại thành phần khác không?
Có. Skill có nhắc đến các loại khác như augmentation, hàm collate và metric.
Chi tiết
Mô tả gốc của tác giả
Use only when creating new registrable ML components that require Factory or Registry patterns.
Độ phổ biến
- Sao GitHub
- 6.0k
- Vị trí xếp hạng
- #14479
- Giấy phép
- MIT
- Cập nhật
- 19/10/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-identifier
6.0kDạy agent của bạn tạo agent Claude Code, viết đúng tên, mô tả kích hoạt, system prompt và cài đặt của chúng.
bug-detective
6.0kGiúp agent của bạn tìm và sửa lỗi code bằng một phương pháp rõ ràng: hiểu vấn đề, thu thập bằng chứng, thử giả thuyết và xác minh bản sửa.
citation-verification
6.0kDạy agent của bạn kiểm tra từng trích dẫn trong một bài báo học thuật với các nguồn học thuật đáng tin cậy, phát hiện tài liệu tham khảo giả hoặc sai.
code-review-excellence
6.0kGiúp agent của bạn rà soát các thay đổi code và pull request với nhận xét rõ ràng, tử tế, có ưu tiên, bắt được lỗi thật và làm code tốt hơn.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.