Communitygithub.com

机器学习采用手册

为AI智能体和软件工程师提供端到端方法论,用于在现有非机器学习代码库中添加机器学习算法。涵盖问题框架、数据准备、架构解耦及基线模型集成。适用于从问题界定到基线模型阶段,为无机器学习功能的代码库添加机器学习能力。

机器学习采用手册 是什么?

机器学习采用手册旨在为开发者及AI智能体提供一套系统化的指导流程,帮助其在现有非机器学习软件项目中引入机器学习功能。该技能的核心价值在于弥合传统软件工程与机器学习运维之间的鸿沟,通过五个阶段(问题框架与可行性、数据准备、架构集成与解耦、模型实现与训练、交接至MLOps)的结构化方法,确保从问题定义到基线模型部署的每个步骤都有据可依。它支持多种平台(如基于Python的代码库),强调启发式检查、数据合同、API边界及特性标志等实用策略,以避免紧密耦合并保障系统健壮性。智能体遵循迭代工作流程:先澄清问题,再起草数据合约,然后编写解耦接口,最后交付可复现的训练脚本,从而高效地为现有应用添加分类、推荐或预测等机器学习能力。

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

在你喜欢的 AI 中提问

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

文档

ML采用手册

本技能提供一种适应性方法论,用于在现有软件工程项目中实现机器学习模型。它通过结构化机器学习的研究、解耦、训练和集成方式,弥合传统软件工程与机器学习运维之间的差距。

何时激活

  • 用户请求为其现有代码库“添加ML”或“添加算法”。
  • 规划将新模型(如推荐、分类、预测)集成到非机器学习应用中。
  • 为智能体构建工作流以自适应地构建、训练和部署机器学习组件。

阶段1:问题框架与可行性

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

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

阶段2:数据准备

没有干净、可访问的数据,机器学习就毫无用处。

  • 审计数据源: 确定训练数据存放的位置。是实时数据库、静态CSV文件还是API?
  • 数据合同: 为输入数据建立一个模式。需要哪些特征?如果某个特征缺失会发生什么?
  • 泄漏预防: 确保用户提议的数据拆分不会意外地将未来信息泄露到训练集中(例如,对时间序列数据进行时间顺序拆分)。

阶段3:架构集成与解耦

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

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

阶段4:模型实现与训练

为使代码可重复和可迭代而结构化。

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

阶段5:交接至MLOps

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

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

迭代智能体工作流

通过本手册协助用户时,智能体应:

  1. 提出澄清性问题 以在提出架构之前完成阶段1。
  2. 起草数据合同 在阶段2供用户批准。
  3. 编写解耦接口(API/服务)在阶段3中,在编写训练循环之前。
  4. 交付可复现的脚本 在阶段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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能