Packages and deploys trained ML models to production with FastAPI, Docker, and model registries. Covers inference endpoints, scaling, drift detection, and rollback strategies.
Ships in claude-skills-collection. 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.
| Cas d'usage | Volume | Stack recommandée |
|---|---|---|
| MVP / POC rapide | < 100 req/s | FastAPI + Docker + MLflow |
| Real-time faible latence | 100–10k req/s | BentoML ou TorchServe + K8s |
| Batch nuit/semaine | très grand | Spark ML / Airflow batch job |
| Multi-framework / GPU | élevé | NVIDIA Triton Inference Server |
| Edge / embarqué | N/A | ONNX Runtime / TFLite |
| Géré full-cloud | variable | SageMaker / Azure ML / Vertex AI |
Choisir le format selon le framework :
# scikit-learn → joblib (préféré à pickle)
import joblib
joblib.dump(model, "model.joblib")
# PyTorch → TorchScript (portable, pas besoin du code source)
scripted = torch.jit.script(model)
scripted.save("model.pt")
# TensorFlow → SavedModel
model.save("saved_model/")
# Convertir en ONNX (interopérabilité max)
import torch.onnx
torch.onnx.export(model, dummy_input, "model.onnx", opset_version=17)
Créer une model card minimale (YAML dans le registre) :
model_name: churn-predictor-v2
framework: scikit-learn 1.4.2
python: "3.11"
metrics:
auc_roc: 0.887
precision: 0.81
dataset_hash: sha256:abc123...
trained_at: 2026-05-10
known_limitations: "Biais sous-représentation < 25 ans"
# MLflow — enregistrement depuis le training run
mlflow models register \
--model-uri "runs:/RUN_ID/model" \
--name "churn-predictor"
# Passer en Staging puis Production via API
mlflow models transition-version-stage \
--name "churn-predictor" --version 3 --stage Production
Alternatives : W&B Artifacts (wandb.log_artifact), Azure ML Registry (az ml model create), SageMaker (create_model).
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY model.joblib .
COPY app.py .
# Health check obligatoire
HEALTHCHECK --interval=30s --timeout=5s CMD curl -f http://localhost:8000/health || exit 1
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
# Tagging sémantique : image = version du modèle
docker build -t myregistry/churn-predictor:v2.3.1 .
docker push myregistry/churn-predictor:v2.3.1
from fastapi import FastAPI
from pydantic import BaseModel
import joblib, numpy as np
app = FastAPI()
model = joblib.load("model.joblib")
class PredictRequest(BaseModel):
features: list[float]
@app.get("/health")
def health(): return {"status": "ok"}
@app.post("/predict")
def predict(req: PredictRequest):
arr = np.array(req.features).reshape(1, -1)
proba = model.predict_proba(arr)[0, 1]
return {"churn_proba": round(float(proba), 4)}
Pour TorchServe ou Triton, exporter en TorchScript / ONNX puis déclarer le model config.
# .github/workflows/ml-deploy.yml (extrait)
- name: Run model quality gate
run: |
python scripts/eval_gate.py \
--model model.joblib \
--min-auc 0.85 \
--max-latency-ms 120
- name: Build & push image
if: success()
run: |
docker build -t $IMAGE_TAG .
docker push $IMAGE_TAG
- name: Deploy canary (5%)
run: kubectl set image deployment/churn-api churn-api=$IMAGE_TAG
Gate minimal : AUC/F1 ≥ baseline − 1 %, latence p99 < seuil, fairness check sur sous-groupes sensibles.
# Canary K8s — 5 % du trafic sur la nouvelle version
kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
spec:
http:
- route:
- destination: {host: churn-api, subset: v2}
weight: 5
- destination: {host: churn-api, subset: v1}
weight: 95
EOF
Shadow mode : dupliquer le trafic vers le nouveau modèle sans retourner sa réponse aux clients — idéal pour valider avant tout impact.
Métriques à surveiller :
| Métrique | Outil | Alerte si |
|---|---|---|
| Data drift (features) | Evidently, NannyML | PSI > 0.2 ou KL-div > 0.1 |
| Model drift (labels) | NannyML, Arize | accuracy < baseline − 3 % |
| Latence p99 | Prometheus + Grafana | > 200 ms |
| Taux d'erreur | Prometheus | > 1 % sur 5 min |
# Evidently — rapport drift hebdomadaire
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset
report = Report(metrics=[DataDriftPreset()])
report.run(reference_data=ref_df, current_data=prod_df)
report.save_html("drift_report.html")
# Pseudo-code — watcher de métriques
if current_auc < baseline_auc * 0.97:
mlflow.models.transition_version_stage(
name="churn-predictor",
version=current_version,
stage="Archived"
)
mlflow.models.transition_version_stage(
name="churn-predictor",
version=previous_version,
stage="Production"
)
alert("Rollback automatique déclenché — v{} → v{}".format(
current_version, previous_version))
requirements.txt et préférer joblib ou ONNX./health peut router du trafic vers une instance cassée pendant des minutes.What SKILL.md sets; muted values are Claude Code's defaults
/claude-skills-collection:dev-ml-model-deployerfrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests".Other plugins' skills for the same job