/vibe:mlops-expertfrom vibe
Provides deep expertise in MLOps practices including ML pipelines, model deployment, monitoring, experiment tracking, and production ML systems. Covers tools like MLflow, Kubeflow, Airflow, Ray, and KServe.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in MLOps practices, covering end-to-end ML pipelines, model deployment, monitoring, and production ML systems.
# MLflow Experiment Tracking
import mlflow
from mlflow.tracking import MlflowClient
from mlflow.models.signature import infer_signature
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
class MLExperiment:
"""MLflow-based experiment tracking."""
def __init__(
self,
experiment_name: str,
tracking_uri: str = "http://localhost:5000",
):
mlflow.set_tracking_uri(tracking_uri)
mlflow.set_experiment(experiment_name)
self.client = MlflowClient()
self.experiment_name = experiment_name
def train_and_log(
self,
X: pd.DataFrame,
y: pd.Series,
model_params: dict,
model_name: str = "model",
test_size: float = 0.2,
) -> str:
"""Train model and log everything to MLflow."""
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=test_size, random_state=42
)
with mlflow.start_run() as run:
# Log parameters
mlflow.log_params(model_params)
mlflow.log_param("test_size", test_size)
mlflow.log_param("n_features", X.shape[1])
mlflow.log_param("n_samples", len(X))
# Train model
model = RandomForestClassifier(**model_params)
model.fit(X_train, y_train)
# Predictions
y_pred = model.predict(X_test)
y_pred_proba = model.predict_proba(X_test)
# Calculate metrics
metrics = {
"accuracy": accuracy_score(y_test, y_pred),
"precision": precision_score(y_test, y_pred, average="weighted"),
"recall": recall_score(y_test, y_pred, average="weighted"),
"f1": f1_score(y_test, y_pred, average="weighted"),
}
# Log metrics
mlflow.log_metrics(metrics)
# Log feature importances
feature_importance = pd.DataFrame({
"feature": X.columns,
"importance": model.feature_importances_
}).sort_values("importance", ascending=False)
mlflow.log_table(feature_importance, "feature_importances.json")
# Log model with signature
signature = infer_signature(X_train, y_pred)
mlflow.sklearn.log_model(
model,
model_name,
signature=signature,
registered_model_name=model_name,
)
# Log artifacts
mlflow.log_dict({"columns": X.columns.tolist()}, "columns.json")
return run.info.run_id
def compare_runs(self, metric: str = "accuracy", top_n: int = 5) -> pd.DataFrame:
"""Compare experiment runs."""
experiment = mlflow.get_experiment_by_name(self.experiment_name)
runs = mlflow.search_runs(
experiment_ids=[experiment.experiment_id],
order_by=[f"metrics.{metric} DESC"],
max_results=top_n,
)
return runs[["run_id", f"metrics.{metric}", "params.n_estimators", "params.max_depth"]]
def promote_model(
self,
model_name: str,
version: int,
stage: str = "Production",
):
"""Promote model to a stage."""
self.client.transition_model_version_stage(
name=model_name,
version=version,
stage=stage,
archive_existing_versions=True,
)
# Feature Store with Feast
from feast import FeatureStore, Entity, Feature, FeatureView, FileSource, ValueType
from feast.types import Float32, Int64, String
from datetime import timedelta
import pandas as pd
class FeatureStoreManager:
"""Feast feature store management."""
def __init__(self, repo_path: str = "."):
self.store = FeatureStore(repo_path=repo_path)
def define_features(self):
"""Define feature views and entities."""
# Define entity
user = Entity(
name="user_id",
value_type=ValueType.STRING,
description="User identifier",
)
# Define data source
user_stats_source = FileSource(
path="data/user_stats.parquet",
timestamp_field="event_timestamp",
created_timestamp_column="created_timestamp",
)
# Define feature view
user_stats_fv = FeatureView(
name="user_stats",
entities=["user_id"],
ttl=timedelta(days=1),
schema=[
Feature(name="total_purchases", dtype=Int64),
Feature(name="avg_purchase_value", dtype=Float32),
Feature(name="days_since_last_purchase", dtype=Int64),
Feature(name="user_segment", dtype=String),
],
source=user_stats_source,
online=True,
)
return [user], [user_stats_fv]
def materialize(self, start_date: str, end_date: str):
"""Materialize features to online store."""
from datetime import datetime
self.store.materialize(
start_date=datetime.fromisoformat(start_date),
end_date=datetime.fromisoformat(end_date),
)
def get_online_features(
self,
entity_df: pd.DataFrame,
features: list[str],
) -> pd.DataFrame:
"""Get features for online serving."""
feature_vector = self.store.get_online_features(
features=features,
entity_rows=entity_df.to_dict("records"),
)
return feature_vector.to_df()
def get_historical_features(
self,
entity_df: pd.DataFrame,
features: list[str],
) -> pd.DataFrame:
"""Get historical features for training."""
training_df = self.store.get_historical_features(
entity_df=entity_df,
features=features,
)
return training_df.to_df()
# Model Serving with FastAPI and async
from fastapi import FastAPI, HTTPException, BackgroundTasks
from pydantic import BaseModel, Field
from typing import List, Dict, Any, Optional
import mlflow
import numpy as np
import asyncio
from datetime import datetime
import logging
logger = logging.getLogger(__name__)
class PredictionRequest(BaseModel):
features: List[float] = Field(..., min_items=1)
request_id: Optional[str] = None
class PredictionResponse(BaseModel):
prediction: Any
probabilities: Optional[List[float]] = None
model_version: str
latency_ms: float
request_id: Optional[str] = None
class BatchPredictionRequest(BaseModel):
instances: List[List[float]]
request_id: Optional[str] = None
class ModelServer:
"""Production model serving with monitoring."""
def __init__(
self,
model_name: str,
model_stage: str = "Production",
):
self.model_name = model_name
self.model_stage = model_stage
self.model = None
self.model_version = None
self.prediction_count = 0
self.error_count = 0
self.latencies: List[float] = []
async def load_model(self):
"""Load model from registry."""
model_uri = f"models:/{self.model_name}/{self.model_stage}"
self.model = mlflow.pyfunc.load_model(model_uri)
# Get version info
client = mlflow.tracking.MlflowClient()
versions = client.get_latest_versions(self.model_name, stages=[self.model_stage])
self.model_version = versions[0].version if versions else "unknown"
logger.info(f"Loaded model {self.model_name} version {self.model_version}")
async def predict(self, request: PredictionRequest) -> PredictionResponse:
"""Make prediction with monitoring."""
start_time = datetime.now()
try:
features = np.array(request.features).reshape(1, -1)
prediction = self.model.predict(features)
# Get probabilities if available
probabilities = None
if hasattr(self.model._model_impl, "predict_proba"):
probabilities = self.model._model_impl.predict_proba(features)[0].tolist()
latency = (datetime.now() - start_time).total_seconds() * 1000
self.latencies.append(latency)
self.prediction_count += 1
return PredictionResponse(
prediction=prediction[0].item() if hasattr(prediction[0], 'item') else prediction[0],
probabilities=probabilities,
model_version=self.model_version,
latency_ms=latency,
request_id=request.request_id,
)
except Exception as e:
self.error_count += 1
logger.error(f"Prediction error: {e}")
raise HTTPException(status_code=500, detail=str(e))
async def predict_batch(
self,
request: BatchPredictionRequest,
) -> List[PredictionResponse]:
"""Batch prediction."""
tasks = [
self.predict(PredictionRequest(features=instance, request_id=request.request_id))
for instance in request.instances
]
return await asyncio.gather(*tasks)
def get_metrics(self) -> Dict[str, Any]:
"""Get serving metrics."""
return {
"model_name": self.model_name,
"model_version": self.model_version,
"prediction_count": self.prediction_count,
"error_count": self.error_count,
"error_rate": self.error_count / max(self.prediction_count, 1),
"avg_latency_ms": np.mean(self.latencies) if self.latencies else 0,
"p95_latency_ms": np.percentile(self.latencies, 95) if self.latencies else 0,
"p99_latency_ms": np.percentile(self.latencies, 99) if self.latencies else 0,
}
# FastAPI application
app = FastAPI(title="ML Model Server")
model_server = ModelServer("my_model")
@app.on_event("startup")
async def startup():
await model_server.load_model()
@app.post("/predict", response_model=PredictionResponse)
async def predict(request: PredictionRequest):
return await model_server.predict(request)
@app.post("/predict/batch", response_model=List[PredictionResponse])
async def predict_batch(request: BatchPredictionRequest):
return await model_server.predict_batch(request)
@app.get("/health")
async def health():
return {"status": "healthy", "model_loaded": model_server.model is not None}
@app.get("/metrics")
async def metrics():
return model_server.get_metrics()
# Model Monitoring for Drift Detection
from evidently import ColumnMapping
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset, TargetDriftPreset
from evidently.metrics import (
DatasetDriftMetric,
ColumnDriftMetric,
DatasetMissingValuesMetric,
)
import pandas as pd
from typing import Dict, Any
import json
class ModelMonitor:
"""Production model monitoring for drift and performance."""
def __init__(
self,
reference_data: pd.DataFrame,
column_mapping: Dict[str, Any],
):
self.reference_data = reference_data
self.column_mapping = ColumnMapping(**column_mapping)
self.drift_history = []
def check_data_drift(
self,
current_data: pd.DataFrame,
threshold: float = 0.5,
) -> Dict[str, Any]:
"""Check for data drift."""
report = Report(metrics=[
DatasetDriftMetric(),
DatasetMissingValuesMetric(),
])
report.run(
reference_data=self.reference_data,
current_data=current_data,
column_mapping=self.column_mapping,
)
result = report.as_dict()
drift_detected = result["metrics"][0]["result"]["dataset_drift"]
drift_share = result["metrics"][0]["result"]["share_of_drifted_columns"]
drift_result = {
"drift_detected": drift_detected,
"drift_share": drift_share,
"threshold": threshold,
"alert": drift_share > threshold,
"timestamp": pd.Timestamp.now().isoformat(),
"n_samples": len(current_data),
}
self.drift_history.append(drift_result)
return drift_result
def check_column_drift(
self,
current_data: pd.DataFrame,
columns: list[str],
) -> Dict[str, Any]:
"""Check drift for specific columns."""
report = Report(metrics=[
ColumnDriftMetric(column_name=col)
for col in columns
])
report.run(
reference_data=self.reference_data,
current_data=current_data,
column_mapping=self.column_mapping,
)
result = report.as_dict()
column_drifts = {}
for i, col in enumerate(columns):
metric_result = result["metrics"][i]["result"]
column_drifts[col] = {
"drift_detected": metric_result["drift_detected"],
"drift_score": metric_result["drift_score"],
"stattest_name": metric_result["stattest_name"],
}
return column_drifts
def generate_report(
self,
current_data: pd.DataFrame,
output_path: str,
):
"""Generate full drift report."""
report = Report(metrics=[
DataDriftPreset(),
TargetDriftPreset(),
])
report.run(
reference_data=self.reference_data,
current_data=current_data,
column_mapping=self.column_mapping,
)
report.save_html(output_path)
return output_path
def get_drift_trends(self) -> pd.DataFrame:
"""Get historical drift trends."""
return pd.DataFrame(self.drift_history)
You build robust MLOps infrastructure with proper experiment tracking, feature management, and production monitoring.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job