ml-adoption-playbook
它能做什么
这份指南可以帮你为原本没有人工智能(AI)功能的程序添加 AI 能力。它会介绍如何规划、准备数据、把 AI 整合进现有代码,并搭建一个简单的初版模型。
适用场景
- ✓当你想为某个程序添加 AI 功能时。
- ✓当你在规划一个新的 AI 模型(比如推荐模型)如何在应用中运行时。
- ✓当你要组织构建、训练和使用 AI 组件的工作时。
技能链接
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/ml-adoption-playbook/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“怎样给我的网站添加一个推荐模型?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先弄清楚问题,并检查是否有更简单的方案就能解决。然后,它会整理所需数据,规划 AI 如何与程序的其他部分通信,同时避免各部分代码互相混杂。最后,它会搭建一个基础模型,并讲解如何逐步改进。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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-patternsordjango-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-patternsor 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:
- Ask clarifying questions to complete Phase 1 before proposing architectures.
- Draft a data contract in Phase 2 for user approval.
- Write the decoupling interface (API/Service) in Phase 3 before writing the training loop.
- Deliver a reproducible script in Phase 4 that trains the model and saves the artifact.
常见问题
什么是“启发式方法”(heuristic)?
这是一种简单、快速的解决办法,比如一条基本规则。它可能比复杂的 AI 更容易实现,效率也更高。
什么是“架构解耦”(architectural decoupling)?
就是把 AI 部分和程序的其他部分分开,这样一方的改动就不容易影响另一方,让整个程序更有条理,也更稳定。
什么是“基线模型”(baseline model)?
这是你为了先跑通流程而创建的第一个简单 AI 模型。它可以作为之后比较和改进的起点。
详情
作者的原始描述
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.
repo: affaan-m/ECC
热度
- GitHub 星标
- 280k
- 排名
- #208
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
accessibility
280k帮你的智能体创建人人都能使用的界面。确保网站和应用对残障人士友好,比如失明或行动不便的用户也能顺畅使用。
agent-architecture-audit
280k让你的智能体检查一切是否正常运行。它能找出并修复 AI 系统中的问题,确保系统按预期工作。
agent-eval
280k帮你的智能体比较不同的 AI 编程工具。它能衡量哪个工具在特定任务上更快、更便宜、更可靠。
agent-harness-construction
280k让你的智能体更好地理解如何完成任务。它会优化智能体使用的工具和指令,提高成功的几率。