Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/ai-ml/automl-pipeline-builder/skills/building-automl-pipelines

building-automl-pipelines

Verified

Build automated machine learning pipelines with feature engineering, model selection, and hyperparameter tuning. Use when automating ML workflows from data preparation through model deployment. Trigger with phrases like "build automl pipeline", "automate ml workflow", or "create automated training pipeline".

scripts/pipeline_deployment.py

View on GitHub
#!/usr/bin/env python3
"""
automl-pipeline-builder - Deployment Script
Script to deploy the trained AutoML pipeline to a production environment.
Generated: 2025-12-10 03:48:17
"""

import json
import shutil
import argparse
from pathlib import Path
from datetime import datetime
from typing import Dict


class Deployer:
    def __init__(self, source: str, target: str):
        self.source = Path(source)
        self.target = Path(target)
        self.deployed = []
        self.failed = []

    def validate_source(self) -> bool:
        """Validate source directory exists."""
        if not self.source.exists():
            print(f"❌ Source directory not found: {self.source}")
            return False

        if not any(self.source.iterdir()):
            print(f"❌ Source directory is empty: {self.source}")
            return False

        print(f"✓ Source validated: {self.source}")
        return True

    def prepare_target(self) -> bool:
        """Prepare target directory."""
        try:
            self.target.mkdir(parents=True, exist_ok=True)

            # Create deployment metadata
            metadata = {
                "deployment_time": datetime.now().isoformat(),
                "source": str(self.source),
                "skill": "automl-pipeline-builder",
                "category": "ai-ml",
                "plugin": "automl-pipeline-builder",
            }

            metadata_file = self.target / ".deployment.json"
            with open(metadata_file, "w") as f:
                json.dump(metadata, f, indent=2)

            print(f"✓ Target prepared: {self.target}")
            return True
        except Exception as e:
            print(f"❌ Failed to prepare target: {e}")
            return False

    def deploy_files(self) -> bool:
        """Deploy files from source to target."""
        success = True

        for source_file in self.source.rglob("*"):
            if source_file.is_file():
                relative_path = source_file.relative_to(self.source)
                target_file = self.target / relative_path

                try:
                    target_file.parent.mkdir(parents=True, exist_ok=True)
                    shutil.copy2(source_file, target_file)
                    self.deployed.append(str(relative_path))
                    print(f"  ✓ Deployed: {relative_path}")
                except Exception as e:
                    self.failed.append({"file": str(relative_path), "error": str(e)})
                    print(f"  ✗ Failed: {relative_path} - {e}")
                    success = False

        return success

    def generate_report(self) -> Dict:
        """Generate deployment report."""
        report = {
            "deployment_time": datetime.now().isoformat(),
            "skill": "automl-pipeline-builder",
            "source": str(self.source),
            "target": str(self.target),
            "total_files": len(self.deployed) + len(self.failed),
            "deployed": len(self.deployed),
            "failed": len(self.failed),
            "deployed_files": self.deployed,
            "failed_files": self.failed,
        }

        # Save report
        report_file = self.target / "deployment_report.json"
        with open(report_file, "w") as f:
            json.dump(report, f, indent=2)

        return report

    def rollback(self):
        """Rollback deployment on failure."""
        print("⚠️  Rolling back deployment...")

        for deployed_file in self.deployed:
            file_path = self.target / deployed_file
            if file_path.exists():
                file_path.unlink()
                print(f"  ✓ Removed: {deployed_file}")

        # Remove empty directories
        for dir_path in sorted(self.target.rglob("*"), reverse=True):
            if dir_path.is_dir() and not any(dir_path.iterdir()):
                dir_path.rmdir()


def main():
    parser = argparse.ArgumentParser(
        description="Script to deploy the trained AutoML pipeline to a production environment."
    )
    parser.add_argument("source", help="Source directory")
    parser.add_argument("target", help="Target deployment directory")
    parser.add_argument("--dry-run", action="store_true", help="Simulate deployment")
    parser.add_argument("--force", action="store_true", help="Overwrite existing files")
    parser.add_argument("--rollback-on-error", action="store_true", help="Rollback on any error")

    args = parser.parse_args()

    deployer = Deployer(args.source, args.target)

    print("🚀 Deploying automl-pipeline-builder...")
    print(f"   Source: {args.source}")
    print(f"   Target: {args.target}")

    if args.dry_run:
        print("\n⚠️  DRY RUN MODE - No files will be deployed")
        return 0

    # Validate and prepare
    if not deployer.validate_source():
        return 1

    if not deployer.prepare_target():
        return 1

    # Deploy
    success = deployer.deploy_files()

    # Generate report
    report = deployer.generate_report()

    print("\n📊 DEPLOYMENT SUMMARY")
    print(f"   Total Files: {report['total_files']}")
    print(f"   ✅ Deployed: {report['deployed']}")
    print(f"   ❌ Failed: {report['failed']}")

    if not success and args.rollback_on_error:
        deployer.rollback()
        return 1

    if report["failed"] == 0:
        print("\n✅ Deployment completed successfully!")
        return 0
    else:
        print("\n⚠️  Deployment completed with errors")
        return 1


if __name__ == "__main__":
    import sys

    sys.exit(main())
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 323kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall