mlops-industrialization

1
0
Source

Guide to transform prototypes into robust, distributable Python packages using the src layout, hybrid paradigm, and strict configuration management.

Install

mkdir -p .claude/skills/mlops-industrialization && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4096" && unzip -o skill.zip -d .claude/skills/mlops-industrialization && rm skill.zip

Installs to .claude/skills/mlops-industrialization

About this skill

MLOps Coding - Productionizing Skill

Goal

To convert experimental code (notebooks/scripts) into a high-quality, distributable Python package. This skill enforces the src/ layout, a Hybrid Paradigm (OOP structure + Functional purity), and Strict Configuration to ensure scalability, security, and maintainability.

Prerequisites

  • Language: Python
  • Manager: uv
  • Context: Moving from notebooks/ to src/.

Instructions

1. Packaging Structure (src Layout)

Adopt the src layout to prevent import errors and separate source from tooling.

  1. Directory Tree:

    my-project/
    ├── pyproject.toml       # Dependencies & Metadata
    ├── uv.lock
    ├── README.md
    └── src/
        └── my_package/      # Main package directory
            ├── __init__.py
            ├── io/          # Side-effects (Datasets, APIs)
            ├── domain/      # Pure business logic (Models, Features)
            └── application/ # Orchestration (Training loops, Inference)
    
  2. Configuration: Use pyproject.toml for all build metadata and dependencies.

2. Modularity & Paradigm (Hybrid Style)

Balance structure with predictability.

  1. Domain Layer (Pure):
    • Rule: Code here must be deterministic and free of side effects (no I/O).
    • Use Case: Feature transformations, Model architecture definitions.
    • Style: Functional (pure functions) or Immutable Objects (dataclasses).
  2. I/O Layer (Impure):
    • Rule: Isolate external interactions here.
    • Use Case: Loading data from S3, saving models to disk, logging to MLflow.
    • Style: OOP (Classes to manage connections/state).
  3. Application Layer (Orchestration):
    • Rule: Wire Domain and I/O together.
    • Use Case: Tuning, Training, Inference, Evaluation, etc.

3. Application Entrypoints

Create standard, installable CLI tools.

  1. Define Script: Create src/my_package/scripts.py with a main() function.

  2. Register: Add to pyproject.toml:

    [project.scripts]
    my-tool = "my_package.scripts:main"
    
  3. CLI Execution:

    • Dev: uv run my-tool (No install needed).
    • Prod: pip install . -> my-tool (Installed on PATH).
  4. Guard: Always use if __name__ == "__main__": in scripts to prevent execution on import.

4. Configuration Management

Decouple settings from code using OmegaConf (Parsing) and Pydantic (Validation).

  1. Define Schema (Pydantic):

    • Create a class that defines expected types and defaults.
    from pydantic import BaseModel
    
    class TrainingConfig(BaseModel):
        batch_size: int = 32
        learning_rate: float = 0.001
        use_gpu: bool = False
    
  2. Parse & Validate (OmegaConf):

    • Load YAML, merge with CLI args, and validate against the schema.
    import omegaconf
    
    # 1. Load YAML
    conf = omegaconf.OmegaConf.load("config.yaml")
    # 2. Merge with CLI (optional)
    cli_conf = omegaconf.OmegaConf.from_cli()
    merged = omegaconf.OmegaConf.merge(conf, cli_conf)
    # 3. Validate -> Returns a validated Pydantic object
    cfg: TrainingConfig = TrainingConfig(**omegaconf.OmegaConf.to_container(merged))
    
  3. Secrets: Use Environment Variables (os.getenv), never commit them.

5. Documentation & Quality

Make code usable and maintainable.

  1. Docstrings: Use Google Style docstrings for all modules, classes, and functions.

    def calculate_metric(y_true: np.ndarray, y_pred: np.ndarray) -> float:
        """Calculates the accuracy score.
    
        Args:
            y_true: Ground truth labels.
            y_pred: Predicted labels.
    
        Returns:
            The accuracy as a float between 0 and 1.
        """
    
  2. Type Hints: Use standard python typing (typing, list[str]) everywhere.

6. Best Practices Summary

  • Config != Code: Never hardcode paths or hyperparams; use the Pydantic + OmegaConf pattern.
  • Entrypoints are APIs: Design your CLI ([project.scripts]) as the public interface for your automation tools.
  • Immutable Core: Keep your domain logic side-effect free; push I/O to the edges.

Self-Correction Checklist

  • No Side Effects on Import: Does import my_package run any code? (It shouldn't).
  • Src Layout: Is code inside src/?
  • Config Safety: Are secrets excluded from pyproject.toml and YAML?
  • Typing: Are function signatures fully type-hinted?
  • Entrypoints: Is the CLI registered in pyproject.toml?

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

250779

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

195410

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

173269

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

200227

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

156191

rust-coding-skill

UtakataKyosui

Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.

158171

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.