Communitygithub.com

機器學習導入手冊

提供一套從問題定義到基礎模型整合的端到端方法,協助AI代理與軟體工程師在現有非機器學習程式碼庫中加入機器學習演算法。

機器學習導入手冊 是什麼?

這項技能提供了一個結構化的方法論,用於將機器學習模型整合到現有的軟體工程專案中,特別適用於程式碼庫中完全沒有機器學習程式碼的情境。它涵蓋從問題定義與可行性評估、資料準備、架構解耦,到基礎模型實作與整合的完整流程。技能特別強調在整合機器學習時,不應將模型推論與核心業務邏輯緊密耦合,並提倡透過API邊界、備援機制與功能切換來實現安全、可逆的導入。最後,它還會引導使用者銜接至MLOps工作流程,包括實驗追蹤、模型註冊與CI/CD整合。這項技能支援Claude Code、Cursor、Codex等平台,並設計了一套迭代代理工作流程,確保代理在每個階段都能提出適當的確認問題並產出具體、可執行的交付項目。

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

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

機器學習導入手冊 是做什麼的?

這項技能提供一套適合性方法,用於將機器學習模型實作到現有的軟體工程專案中。它透過結構化機器學習應如何被研究、解耦、訓練與整合,來彌補傳統軟體工程與MLOps之間的鴻溝。

啟用時機

  • 使用者要求在其現有程式碼庫中「加入機器學習」或「加入演算法」。
  • 規劃將新模型(例如推薦、分類、預測)整合到非機器學習應用中。
  • 為代理建構、訓練與部署機器學習元件建立具適應性的工作流程。

第一階段:問題定義與可行性評估

在編寫模型程式碼之前,先確立「為什麼」與「如何做」。

  • 啟發式檢查:詢問使用者是否可以用簡單的啟發式方法(例如正規表示、基於規則的排序)更快解決問題。如果可以,從那裡開始。
  • 指標定義:定義機器學習模型試圖改善的業務指標(例如點擊率、降低延遲)。
  • 錯誤預算:定義「糟糕的」預測長什麼樣子,以及系統應該如何處理它。

第二階段:資料準備

沒有乾淨、可存取的資料,機器學習就毫無用處。

  • 稽核資料來源:找出訓練資料存放在哪裡。是即時資料庫、靜態CSV檔案,還是API?
  • 資料契約:為輸入資料建立結構定義。需要哪些特徵?如果某個特徵遺失了會怎樣?
  • 防範資料洩漏:確保使用者提議的資料分割方式不會意外將未來資訊洩漏到訓練集中(例如對時間序列資料進行時間順序分割)。

第三階段:架構整合與解耦

不要將模型推論與核心業務邏輯緊密耦合。

  • API邊界:建議將模型放置在API端點後面(例如使用 fastapi-patterns 或 django-patterns)或專門的服務類別中。
  • 備援機制:設計一個預設狀態。如果模型回應時間過長或拋出錯誤,系統必須能優雅地退回至硬編碼的規則。
  • 功能切換:將新的機器學習推論呼叫包裹在功能切換中,以便安全地逐步推出(或回退)。

第四階段:模型實作與訓練

為可重現性與迭代性來結構化程式碼。

  • 從簡單開始:先建立一個基礎模型(例如簡單的 scikit-learn 邏輯迴歸,或精簡的 PyTorch 線性層)。
  • 可重現性:應用 pytorch-patterns 或類似最佳實務:設定隨機種子、使程式碼與裝置無關、並明確記錄張量/陣列形狀。
  • 自動化證據:要求為資料轉換與推論結構寫測試。不接受沒有評估腳本(用於與基礎模型比較)的模型。

第五階段:交接至MLOps

一旦基礎模型整合完成,就將焦點轉移到持續營運上。

  • 參考 mle-workflow:引導使用者設定實驗追蹤、模型註冊與漂移偵測。
  • CI/CD:將模型評估步驟加入現有的CI管線中,以確保未來的提交不會降低模型效能。

迭代代理工作流程

當透過此手冊協助使用者時,代理應:

  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/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.

相關技能