architecture-design

Implements Factory and Registry patterns for new registrable components in ML projects.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-skills --skill architecture-design-clay-hhk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: architecture-design
Source: https://github.com/Clay-HHK/claude-skills/tree/main/architecture-design
Command: npx skills add https://github.com/Clay-HHK/claude-skills --skill architecture-design-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, and includes references (resource) components.

What problem does it solve? When adding new datasets, models, or augmentations to a machine learning project, inconsistent architecture leads to tangled imports, manual registration boilerplate, and config drift. This Skill enforces a standardized Factory/Registry architecture so every new component integrates cleanly with Hydra configs and auto-discovery. ## Core Features & Use Cases - Registry Decorators: Register new datasets, models, and augmentations with @register_dataset, @register_model, and @register_augmentation decorators. - Config-Driven Models: Enforces a model pattern where init accepts only a Hydra cfg object and forward() returns a dict with loss, labels, and logits. - Auto-Import Discovery: Automatically imports all submodules in a directory so new files register themselves without manual import statements. - Use Case: You need to add a new Transformer model to an existing brain-decoding project. The Skill guides you to create the file in src/model_module/, apply @register_model('Transformer'), read all hyperparameters from cfg, and add a matching Hydra YAML config. ## Quick Start Ask the AI to create a new dataset class named 'custom' following the project architecture with the register_dataset decorator and a matching Hydra config file.

Frequently Asked Questions about architecture-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new dataset class to a PyTorch project?▼

Create a file in src/data_module/dataset/, inherit from torch.utils.data.Dataset, and apply the @register_dataset("name") decorator. Implement __init__, __len__, and __getitem__, then the auto-import pattern registers it automatically.

How do I create a config-driven model with Hydra?▼

Define the model with @register_model('ModelName') and make __init__ accept only a cfg parameter. Read all hyperparameters from cfg.model and cfg.dataset, and have forward() return a dict containing loss, labels, and logits.

What is the difference between Factory and Registry patterns?▼

The Registry pattern uses decorators to add classes to a central dictionary at import time. The Factory pattern provides a lookup function that retrieves the registered class by name, decoupling consumers from concrete implementations.

When should I not use this architecture design skill?▼

Skip it when modifying existing functions, fixing bugs, adding helper utilities, refactoring without new registrable components, or editing configuration files. It only applies when a task requires a @register_* decorator or Factory pattern.

Why is my new dataset not found by DatasetFactory?▼

The factory falls back to the 'simple' dataset when the name is missing from DATASET_FACTORY. Verify the file does not start with an underscore, the decorator name matches your config, and the module was imported via import_modules.