growth-engineering

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Growth Engineering Skill

增长工程技能

Infrastructure and patterns for product-led growth, experimentation, and conversion optimization.

面向产品驱动增长(PLG)、实验与转化优化的基础设施及模式。

Feature Flag Systems

功能标志系统

Implementation Pattern

实现模式

typescript
// lib/feature-flags.ts
import { PostHog } from 'posthog-node';

const posthog = new PostHog(process.env.POSTHOG_API_KEY!);

interface FeatureFlags {
  'new-onboarding-flow': boolean;
  'pricing-experiment': 'control' | 'variant-a' | 'variant-b';
  'ai-suggestions': boolean;
}

export async function getFlag<K extends keyof FeatureFlags>(
  key: K,
  userId: string,
): Promise<FeatureFlags[K]> {
  const value = await posthog.getFeatureFlag(key, userId);
  return value as FeatureFlags[K];
}

// Usage in component
const showNewOnboarding = await getFlag('new-onboarding-flow', user.id);
typescript
// lib/feature-flags.ts
import { PostHog } from 'posthog-node';

const posthog = new PostHog(process.env.POSTHOG_API_KEY!);

interface FeatureFlags {
  'new-onboarding-flow': boolean;
  'pricing-experiment': 'control' | 'variant-a' | 'variant-b';
  'ai-suggestions': boolean;
}

export async function getFlag<K extends keyof FeatureFlags>(
  key: K,
  userId: string,
): Promise<FeatureFlags[K]> {
  const value = await posthog.getFeatureFlag(key, userId);
  return value as FeatureFlags[K];
}

// 组件中的用法
const showNewOnboarding = await getFlag('new-onboarding-flow', user.id);

Feature Flag Best Practices

功能标志最佳实践

  • Short-lived flags: Remove after experiment concludes (< 2 weeks)
  • Long-lived flags: Ops toggles for gradual rollouts, kill switches
  • Never nest feature flags (creates exponential complexity)
  • Clean up stale flags monthly
  • Log flag evaluations for debugging

  • 短期标志:实验结束后移除(<2周)
  • 长期标志:用于逐步发布的运维开关、应急关停开关
  • 切勿嵌套功能标志(会导致指数级复杂度)
  • 每月清理过期标志
  • 记录标志评估结果以便调试

A/B Testing Infrastructure

A/B测试基础设施

Experiment Design

实验设计

typescript
// lib/experiments.ts
interface Experiment {
  id: string;
  name: string;
  variants: {
    id: string;
    weight: number; // 0-100, must sum to 100
  }[];
  targetAudience: {
    percentage: number; // % of users included
    filters?: Record<string, unknown>;
  };
  primaryMetric: string;
  secondaryMetrics: string[];
  minimumSampleSize: number;
  startDate: Date;
  endDate?: Date;
}

// Track experiment exposure
function trackExposure(experimentId: string, variantId: string, userId: string) {
  analytics.capture({
    event: '$experiment_started',
    distinctId: userId,
    properties: {
      $experiment_id: experimentId,
      $variant_id: variantId,
    },
  });
}
typescript
// lib/experiments.ts
interface Experiment {
  id: string;
  name: string;
  variants: {
    id: string;
    weight: number; // 0-100,总和必须为100
  }[];
  targetAudience: {
    percentage: number; // 纳入实验的用户占比
    filters?: Record<string, unknown>;
  };
  primaryMetric: string;
  secondaryMetrics: string[];
  minimumSampleSize: number;
  startDate: Date;
  endDate?: Date;
}

// 追踪实验曝光
function trackExposure(experimentId: string, variantId: string, userId: string) {
  analytics.capture({
    event: '$experiment_started',
    distinctId: userId,
    properties: {
      $experiment_id: experimentId,
      $variant_id: variantId,
    },
  });
}

Statistical Significance

统计显著性

  • Minimum sample size: Calculate before starting (use Evan Miller calculator)
  • Don't peek: Set duration upfront, don't stop early on promising results
  • Sequential testing: Use if you must check early (adjusts p-values)
  • Minimum detectable effect: Define what improvement matters (e.g., 5% lift)

  • 最小样本量:实验开始前计算(使用Evan Miller计算器)
  • 不要中途偷看:提前设置实验时长,不要因初步利好结果提前终止
  • 序贯测试:如果必须提前检查则使用(会调整p值)
  • 最小可检测效果:定义有意义的提升幅度(例如5%的增长)

Product-Led Growth Patterns

产品驱动增长(PLG)模式

Activation Metrics

激活指标

StageMetricExample
Sign upRegistration completeUser creates account
SetupProfile completeFills required fields
Aha momentCore value experiencedCreates first project
HabitRepeated engagement3 sessions in first week
RevenueConversion to paidSubscribes to plan
阶段指标示例
注册完成注册用户创建账户
设置完成资料填写填写必填字段
顿悟时刻体验核心价值创建首个项目
习惯养成重复参与首周内完成3次会话
营收转化为付费用户订阅付费方案

Viral Loops

病毒循环

typescript
// Referral system pattern
interface Referral {
  referrerId: string;
  referredEmail: string;
  status: 'pending' | 'signed_up' | 'activated' | 'converted';
  rewardGranted: boolean;
}

// Track referral funnel
function trackReferralStep(referralId: string, step: Referral['status']) {
  analytics.capture({
    event: 'referral_step',
    properties: { referralId, step },
  });
}
typescript
// 推荐系统模式
interface Referral {
  referrerId: string;
  referredEmail: string;
  status: 'pending' | 'signed_up' | 'activated' | 'converted';
  rewardGranted: boolean;
}

// 追踪推荐漏斗
function trackReferralStep(referralId: string, step: Referral['status']) {
  analytics.capture({
    event: 'referral_step',
    properties: { referralId, step },
  });
}

Conversion Optimization

转化优化

  • Reduce friction: Minimize form fields, enable social login
  • Social proof: Show user counts, testimonials, logos
  • Urgency: Trial countdown, limited-time offers (use sparingly)
  • Value demonstration: Interactive demos, free tier with clear upgrade path
  • Personalization: Onboarding flow based on use case selection

  • 降低摩擦:减少表单字段数量,支持社交账号登录
  • 社交证明:展示用户数量、客户 testimonial、合作品牌标志
  • 紧迫感:试用倒计时、限时优惠(谨慎使用)
  • 价值展示:交互式演示、带有清晰升级路径的免费版
  • 个性化:根据用户选择的使用场景定制引导流程

Growth Metrics

增长指标

MetricFormulaTarget
Activation rateActivated / Signed up> 40%
Trial-to-paidPaid / Trial started> 15%
Net revenue retention(Start MRR + Expansion - Contraction - Churn) / Start MRR> 110%
Viral coefficientInvites sent * Conversion rate> 0.5
Time to valueMedian time from signup to aha moment< 5 min
DAU/MAU ratioDaily active / Monthly active> 20%

指标计算公式目标值
激活率激活用户数 / 注册用户数>40%
试用转付费付费用户数 / 开始试用用户数>15%
净收入留存率(期初MRR + 扩容收入 - 缩容收入 - 流失收入)/ 期初MRR>110%
病毒系数发出邀请数 * 转化率>0.5
价值实现时间从注册到顿悟时刻的中位时长<5分钟
DAU/MAU比率日活跃用户数 / 月活跃用户数>20%

Experimentation Platforms

实验平台

PlatformTypeBest For
PostHogSelf-hosted/cloudFull-stack, open source
LaunchDarklyCloudFeature flags at scale
StatsigCloudAuto-stats, warehouse-native
GrowthbookSelf-hosted/cloudOpen source, Bayesian stats
OptimizelyCloudEnterprise, multi-channel

平台类型适用场景
PostHog自托管/云服务全栈、开源
LaunchDarkly云服务大规模功能标志管理
Statsig云服务自动统计、数据仓库原生
Growthbook自托管/云服务开源、贝叶斯统计
Optimizely云服务企业级、多渠道

Related Resources

相关资源

  • ~/.claude/skills/product-analytics/SKILL.md
    - Analytics and tracking
  • ~/.claude/agents/product-analytics-specialist.md
    - Analytics agent
  • ~/.claude/skills/authentication-patterns/SKILL.md
    - Auth for PLG

Measure everything. Experiment constantly. Remove what doesn't work.
  • ~/.claude/skills/product-analytics/SKILL.md
    - 分析与追踪
  • ~/.claude/agents/product-analytics-specialist.md
    - 分析Agent
  • ~/.claude/skills/authentication-patterns/SKILL.md
    - PLG场景下的身份验证

Measure everything. Experiment constantly. Remove what doesn't work.