Catalog
affaan-m/ml-adoption-playbook

affaan-m

ml-adoption-playbook

End-to-end methodology for AI agents and software engineers to add machine learning algorithms to existing non-ML codebases. Covers problem framing, data readiness, architectural decoupling, and baseline model integration. Use when adding a machine learning capability to a codebase that has none, from problem framing through a baseline model.

NewUpdated Sep 9, 2026

ML Adoption Playbook

This skill provides an adaptive methodology for implementing machine learning models into existing software engineering projects. It bridges the gap between traditional SWE and MLOps by structuring how ML should be researched, decoupled, trained, and integrated.

When to Activate

  • A user asks to "add ML" or "add an algorithm" to their existing codebase.
  • Planning the integration of a new model (e.g., recommendation, classification, forecasting) into a non-ML application.
  • Structuring a workflow for an agent to build, train, and deploy an ML component adaptively.

Phase 1: Problem Framing & Feasibility

Before writing model code, establish the "why" and "how".

  • Heuristic Check: Ask the user if a simple heuristic (e.g., regex, rule-based sorting) could solve the problem faster. If yes, start there.
  • Metric Definition: Define what business metric the ML model is trying to improve (e.g., click-through rate, reduced latency).
  • Mistake Budget: Define what a "bad" prediction looks like and how the system should handle it.

Phase 2: Data Readiness

ML is useless without clean, accessible data.

  • Audit Data Sources: Identify where the training data lives. Is it a live database, a static CSV, or an API?
  • Data Contract: Establish a schema for the input data. What features are required? What happens if a feature is missing?
  • Leakage Prevention: Ensure the user's proposed data split does not accidentally leak future information into the training set (e.g., chronological splitting for time-series data).

Phase 3: Architectural Integration & Decoupling

Do not tightly couple model inference to core business logic.

  • API Boundary: Suggest placing the model behind an API endpoint (e.g., using fastapi-patterns or django-patterns) or a dedicated service class.
  • Fallback Mechanisms: Design a default state. If the model takes too long to respond or throws an error, the system must gracefully fall back to a hardcoded rule.
  • Feature Flags: Wrap the new ML inference call in a feature flag so it can be rolled out (or rolled back) safely.

Phase 4: Model Implementation & Training

Structure the code for reproducibility and iteration.

  • Start Simple: Build a baseline model first (e.g., a simple scikit-learn Logistic Regression or a barebones PyTorch linear layer).
  • Reproducibility: Apply pytorch-patterns or similar best practices: fix random seeds, make code device-agnostic, and explicitly document tensor/array shapes.
  • Automated Evidence: Require tests for the data transforms and inference schema. Do not accept a model without an evaluation script comparing it against the baseline.

Phase 5: Handoff to MLOps

Once the baseline model is integrated, shift focus to continuous operations.

  • Refer to mle-workflow: Guide the user toward setting up experiment tracking, model registries, and drift detection.
  • CI/CD: Add the model evaluation step to the existing CI pipeline to ensure future commits do not degrade model performance.

Iterative Agent Workflow

When assisting a user via this playbook, agents should:

  1. Ask clarifying questions to complete Phase 1 before proposing architectures.
  2. Draft a data contract in Phase 2 for user approval.
  3. Write the decoupling interface (API/Service) in Phase 3 before writing the training loop.
  4. Deliver a reproducible script in Phase 4 that trains the model and saves the artifact.
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

78/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

88

Quality

76

Clarity

82

Completeness

68

Summary

An end-to-end methodology for integrating machine learning capabilities into existing non-ML codebases. The skill structures the ML adoption process through five phases: problem framing, data readiness, architectural decoupling, model implementation, and handoff to MLOps operations. It guides both agents and engineers through feasibility checks, data validation, API design, and reproducible model training before production deployment.

Detected Capabilities

code analysis and reviewarchitectural guidancedocumentation and planningprocess structuring

Trigger Keywords

Phrases that agents use to match this skill to user intent.

add machine learningintegrate ml algorithmml adoption strategybaseline model setupdata pipeline planning

Use Cases

  • Add a recommendation algorithm to an existing product
  • Implement classification model for user segmentation in legacy codebase
  • Integrate forecasting capability into SaaS application
  • Structure ML feature development with clear architectural boundaries
  • Plan data pipelines and model integration strategy for non-ML team

Quality Notes

  • +Project-specific scope: clearly defines when to activate (users asking to 'add ML' to non-ML codebases)
  • +Five-phase structure with clear progression: problem framing → data readiness → architecture → implementation → operations
  • +Explicit guardrails: mentions mistake budgets, fallback mechanisms, feature flags, and data leakage prevention
  • +Iterative workflow section gives agents concrete action steps (ask questions → draft contracts → write decoupling → deliver script)
  • +References supporting patterns ('fastapi-patterns', 'django-patterns', 'pytorch-patterns', 'mle-workflow') for deeper guidance
  • +Addresses common ML pitfalls: tight coupling, missing error handling, unreproducible training, data leakage
  • −Lacks concrete code examples or templates for Phase 3 (API boundary) and Phase 4 (model script structure)
  • −No discussion of common model evaluation metrics or baseline performance thresholds
  • −Missing guidance on feature engineering complexity vs. data quality tradeoffs
  • −Phase 2 (data readiness) lacks specific SQL/query patterns or validation techniques
  • −No explicit discussion of compute resource requirements or model inference latency budgets
Model: claude-haiku-4-5-20251001Analyzed: Sep 9, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v2.0

    Contract changed: description

    ✦ AIClarifies skill activation trigger: now explicitly covers problem framing through baseline model for ML-free codebases.

    triggering2026-09-09

    LATEST
  2. v1.0

    2026-06-15

    View This VersionInitial version

Use affaan-m/ml-adoption-playbook in your dev environment

Command Palette

Search for a command to run...