Communitygithub.com

ML采纳实战手册

为AI Agent和软件工程师提供端到端方法,将机器学习算法集成到现有非ML代码库中。涵盖问题框架、数据准备、架构解耦和基线模型集成。适用于从零开始为代码库添加机器学习能力时使用。

ML采纳实战手册 是什么?

该技能提供了一种逐步适应的方法,指导AI Agent和软件工程师将机器学习模型无缝集成到现有软件工程项目中。它通过结构化流程(问题框架、数据准备、架构解耦、模型实现与训练、MLOps移交),弥合了传统软件工程与MLOps之间的鸿沟。用户可以在Claude Code、Cursor、Codex等支持Markdown技能定义的Agent平台上使用。该技能强调实用技巧,如启发式检查(避免不必要的ML)、数据合约定义、API边界解耦、特征标志安全上线,以及基线模型优先原则。最终交付物包括可复现的训练脚本、模型工件和与现有CI集成的评估测试。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/ml-adoption-playbook

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

ML采纳实战手册 是做什么的?

本技能提供了一种自适应方法,用于将机器学习模型集成到现有的软件工程项目中。它通过结构化的方式(如何研究、解耦、训练和集成ML)弥合了传统软件工程与MLOps之间的差距。

激活时机

  • 用户要求“添加ML”或“添加算法”到其现有代码库时。
  • 规划将新模型(例如推荐、分类、预测)集成到非ML应用程序中时。
  • 为Agent构建、训练和部署ML组件自适应地编排工作流程时。

第一阶段:问题框架与可行性

在编写模型代码之前,先确立“为什么”和“怎么做”。

  • 启发式检查: 询问用户是否可以通过简单的启发式方法(例如正则表达式、基于规则的排序)更快地解决问题。如果可以,就先用它。
  • 指标定义: 定义ML模型旨在改进的业务指标(例如点击率、降低延迟)。
  • 错误预算: 定义“不良”预测是什么样的,以及系统应如何处理它。

第二阶段:数据准备

没有干净、可访问的数据,ML毫无用处。

  • 审计数据源: 确定训练数据在哪里。是实时数据库、静态CSV还是API?
  • 数据合约: 为输入数据建立模式。需要哪些特征?如果特征缺失怎么办?
  • 泄漏防范: 确保用户提出的数据拆分不会意外地将未来信息泄漏到训练集中(例如,时间序列数据的按时间拆分)。

第三阶段:架构集成与解耦

不要将模型推理与核心业务逻辑紧密耦合。

  • API边界: 建议将模型置于API端点之后(例如使用fastapi-patterns或django-patterns),或放在专用服务类中。
  • 回退机制: 设计默认状态。如果模型响应时间过长或抛出错误,系统必须优雅地回退到硬编码规则。
  • 特性标志: 将新的ML推理调用包装在特性标志中,以便安全地推出(或回滚)。

第四阶段:模型实现与训练

构建可复现且易于迭代的代码结构。

  • 从简单开始: 首先构建基线模型(例如简单的scikit-learn逻辑回归或简陋的PyTorch线性层)。
  • 可复现性: 应用pytorch-patterns或类似最佳实践:固定随机种子、使代码与设备无关、明确记录张量/数组形状。
  • 自动化验证: 要求为数据转换和推理模式编写测试。不接受没有评估脚本(与基线比较)的模型。

第五阶段:移交至MLOps

基线模型集成后,将重点转向持续化运营。

  • 参考mle-workflow: 引导用户设置实验跟踪、模型注册表和漂移检测。
  • CI/CD: 将模型评估步骤添加到现有CI流水线中,确保未来的提交不会降低模型性能。

迭代式Agent工作流

通过本手册协助用户时,Agent应遵循以下步骤:

  1. 提出澄清性问题 以在提出架构之前完成第一阶段。
  2. 起草数据合约 在第二阶段供用户批准。
  3. 编写解耦接口(API/服务)在编写训练循环之前的第三阶段完成。
  4. 交付可复现脚本 在第四阶段完成,该脚本训练模型并保存工件。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能