Skip to content
Skillpedia
General coding6.0k Β· #14479

architecture-design

What it does

This skill explains a modular code layout for machine learning projects, built around factories and registries. It is for ML developers adding new datasets, models or other pluggable parts to a project.

When to use it

  • βœ“When you are creating a new dataset or model class that must be registered.
  • βœ“When you are adding a new module folder with factory wiring to an ML project.
  • βœ“When you are starting an ML project from scratch and want a clear structure.

Skill link

https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/architecture-design/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/architecture-design/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œAdd a new registered dataset class to my ML project following our factory pattern.”

5 new skills a week. 1 minute to read.

How it works

The agent follows the project pattern, adds a registration decorator and wires the new component through the module's factory. It skips this pattern for simple fixes and small edits.

Technical content (original SKILL.md)

Original text by the author, straight from 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__.py factory 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

FAQ

When should I not use it?

Skip it for bug fixes, small helper functions and config changes, where no registered component is added.

What is a registry?

It is a lookup list where components register themselves, so a factory can create them by name.

Does it cover other component types?

Yes. It mentions others such as augmentation, collate functions and metrics.

Details

Original description by the author

Use only when creating new registrable ML components that require Factory or Registry patterns.

repo: Galaxy-Dawn/claude-scholar

Popularity

GitHub stars
6.0k
Ranking position
#14479
License
MIT
Updated
10/19/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills