Communitygithub.com

A/B 测试

实验设置、变体分配、统计显著性以及特性标志集成。

B 测试 是什么?

该 A/B 测试技能提供了一套完整且严谨的框架,用于在 AI 代理(如 Claude Code、Cursor 等)中设计和执行 A/B 实验。它基于哈希的确定性分配机制,确保用户会话间变体一致,并强调服务端流量拆分以避免用户端闪烁问题。技能明确要求达到 95% 的统计显著性(p < 0.05)才能宣布胜者,并使用 z 检验进行比例分析,同时提供了最小样本量计算公式。此外,它还包含了实验互斥(通过分层)、特性标志集成、实验时长至少 7-14 天等最佳实践,以及详细的日志记录要求,帮助开发者避免常见的数据窥探和参数中途修改等陷阱。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/ab-testing

在你喜欢的 AI 中提问

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

文档

B 测试 是做什么的?

规则

  • 基于哈希的分配:使用 hash(userId + experimentId) % 100 进行确定性变体选择——会话间无随机漂移
  • 变体配置:将实验存储在一个配置对象 { id, name, variants: [{ id, weight }], status } 中——切勿硬编码变体
  • 服务端流量拆分:在中间件或 API 路由中进行分配,并设置 Cookie 以保持一致性——客户端拆分会导致闪烁
  • 统计显著性:在宣布胜者前要求 95% 的置信度(p < 0.05)——对比例使用 z 检验
  • 样本量:在开始前计算最小样本量——n = (Z^2 * p * (1-p)) / E^2,其中 E 为最小可检测效应
  • 每次实验一个指标:预先定义主要指标(转化率、点击率、收入)——次要指标仅为探索性
  • 互斥性:一个实验中的用户不应与冲突的实验重叠——使用实验分层
  • 特性标志:将实验代码包裹在特性标志检查中——实验结束后清理失败的变体
  • 持续时间:至少运行 1-2 个完整的业务周期(最少 7-14 天)以考虑星期效应
  • 日志记录:为每个展示和转化事件记录 experiment_id、variant_id、user_id、timestamp

避免

  • 在样本量达到之前偷看结果——会增加假阳性率
  • 中途更改实验参数——会使统计分析失效
  • 一次测试过多变体——会指数级增加所需样本量
  • 在客户端进行变体分配而不使用 Cookie——会导致闪烁和不一致的体验

Individual skills in this repo

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

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Tenant isolation (row-level vs schema), subdomain routing, per-tenant config, and data partitioning.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相关技能