Communitygithub.com

ml-adoption-playbook

為 AI 代理與軟體工程師提供的端到端方法,用於在現有非 ML 程式碼庫中新增機器學習演算法。涵蓋問題框架、資料就緒性、架構解耦及基線模型整合。適用於從問題框架到基線模型,為完全沒有 ML 能力的程式碼庫新增機器學習功能。

ml-adoption-playbook 是什麼?

這個技能(ML Adoption Playbook)提供了一套適應性強的方法論,幫助將機器學習模型導入現有的軟體工程專案中。它透過結構化 ML 的研究、解耦、訓練與整合方式,縮小了傳統軟體工程(SWE)與 MLOps 之間的鴻溝。此技能適用於 Claude Code、Cursor 等 AI 代理平台,當使用者要求「新增 ML」或「新增演算法」至現有程式碼庫時即可啟用。其工作流程分為五個階段:問題框架與可行性、資料就緒性、架構整合與解耦、模型實作與訓練,以及移交至 MLOps。每個階段都包含可操作的指引,例如引導使用者使用啟發式檢查(Heuristic Check)、定義資料合約(Data Contract)、透過 API 邊界進行解耦、建構基線模型,並確保可重現性與自動化驗證。代理需遵循疊代式工作流程,在各個階段提出釐清問題,並在編寫訓練迴圈前先建立解耦介面。

相容平台~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 的研究、解耦、訓練與整合方式,縮小了傳統軟體工程(SWE)與 MLOps 之間的鴻溝。

啟用時機

  • 使用者要求在其現有程式碼庫中「新增 ML」或「新增演算法」。
  • 正在規劃將新模型(例如推薦、分類、預測)整合到非 ML 應用程式中。
  • 為代理建構一個工作流程,以自適應地建立、訓練並部署 ML 元件。

階段 1:問題框架與可行性

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

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

階段 2:資料就緒性

沒有乾淨、可存取的資料,ML 就毫無用處。

  • 審查資料來源: 識別訓練資料的存放位置。是即時資料庫、靜態 CSV 還是 API?
  • 資料合約: 為輸入資料建立一個架構(schema)。需要哪些特徵?如果某個特徵遺失該怎麼辦?
  • 防止資料洩漏: 確保使用者提出的資料分割不會意外地將未來資訊洩漏到訓練集中(例如,對時間序列資料進行時間順序分割)。

階段 3:架構整合與解耦

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

  • API 邊界: 建議將模型放在 API 端點後面(例如使用 fastapi-patterns 或 django-patterns),或放在一個專用的服務類別中。
  • 備用機制: 設計一個預設狀態。如果模型回應時間過長或拋出錯誤,系統必須優雅地回退到硬編碼規則。
  • 功能標誌: 將新的 ML 推理呼叫包裝在功能標誌(feature flag)中,以便可以安全地逐步推出(或回滾)。

階段 4:模型實作與訓練

為程式碼建立可重現且可迭代的結構。

  • 從簡單開始: 先建立一個基線模型(例如一個簡單的 scikit-learn Logistic Regression 或一個最基本的 PyTorch 線性層)。
  • 可重現性: 應用 pytorch-patterns 或類似的最佳實踐:設定隨機種子、使程式碼無關裝置、並明確記錄張量/陣列形狀。
  • 自動化驗證: 要求對資料轉換和推理架構進行測試。不接受沒有評估腳本(能與基線進行比較)的模型。

階段 5:移交至 MLOps

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

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

代理疊代工作流程

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

  1. 提出釐清問題 以在提出架構之前完成階段 1。
  2. 草擬資料合約(階段 2)供使用者核准。
  3. 在編寫訓練迴圈 之前,於階段 3 先撰寫解耦介面(API/服務)。
  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/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.

相關技能