Community生产力与协作github.com

launchdarkly/launchdarkly-flag-targeting

控制 LaunchDarkly 特性标志(Feature Flag)的目标定位,包括开关标志、百分比发布、定位规则、个体目标以及跨环境复制标志配置。适用于用户想修改标志的可见范围、按百分比逐步发布、添加定位规则或在不同环境间提升配置的场景。

launchdarkly-flag-targeting 是什么?

该技能专为 AI 代理(如 Claude Code、Cursor、Codex)设计,用于直接通过 LaunchDarkly API 管理特性标志的目标定位。它支持核心操作:开关标志、设置百分比发布、管理基于用户属性(如地区、计划类型)的定位规则、针对特定用户或用户组进行定向,以及在开发、测试、生产等环境间复制标志配置。使用该技能前需通过环境变量 `LAUNCHDARKLY_PROJECT_KEY` 和 `LAUNCHDARKLY_API_KEY` 完成认证。此工具可显著提升工程团队在 CI/CD 流水线中自动化标志管理的效率,避免手动操作,降低配置错误风险,并确保发布流程的灵活性与可控性。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/launchdarkly/agent-skills/tree/main/skills/launchdarkly-flag-targeting

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

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

文档

launchdarkly-flag-targeting 是做什么的?

控制 LaunchDarkly 特性标志的目标定位,包括开关标志、百分比发布、定位规则、个体目标以及跨环境复制标志配置。适用于用户想修改标志的可见范围、按百分比逐步发布、添加定位规则或在不同环境间提升配置的场景。

功能简介

该技能通过 LaunchDarkly 的 REST API 提供对特性标志目标定位的全面控制,包括:

  • 开关标志:一键开启或关闭某个标志。
  • 百分比发布:为目标受众的特定百分比启用标志。
  • 定位规则:根据用户属性(如电子邮件域名、国家、计划类型)定义复杂的定位规则。
  • 个体目标:为特定用户或用户组(通过 key)启用或禁用标志。
  • 跨环境复制:将标志的完整目标定位配置从一个环境复制到另一个环境。

先决条件

使用此技能前,您必须设置以下环境变量:

  • LAUNCHDARKLY_PROJECT_KEY:您的 LaunchDarkly 项目 key。
  • LAUNCHDARKLY_API_KEY:您的 LaunchDarkly API 访问令牌(需具有目标定位管理权限)。

用法示例

示范 1:开启标志

为“my-feature-flag”开启目标定位:

{
  "action": "toggle-flag",
  "parameters": {
    "flagKey": "my-feature-flag",
    "environmentKey": "production",
    "on": true
  }
}

示范 2:设置百分比发布

将“new-checkout-flow”标志逐步发布给 25% 的用户:

{
  "action": "set-percentage-rollout",
  "parameters": {
    "flagKey": "new-checkout-flow",
    "environmentKey": "production",
    "percentage": 25
  }
}

示范 3:添加定位规则

为“premium-users”标志添加一条规则,仅对计划类型为“premium”的用户启用:

{
  "action": "add-targeting-rule",
  "parameters": {
    "flagKey": "premium-users",
    "environmentKey": "production",
    "rule": {
      "clauses": [
        {
          "attribute": "planType",
          "op": "in",
          "values": ["premium"],
          "negate": false
        }
      ],
      "variation": 0
    }
  }
}

示范 4:为特定用户启用标志

为指定用户的 key 启用“beta-feature”标志:

{
  "action": "add-individual-target",
  "parameters": {
    "flagKey": "beta-feature",
    "environmentKey": "staging",
    "users": [
      {
        "key": "user-abc-123",
        "variation": 0
      }
    ]
  }
}

示范 5:跨环境复制配置

将“dark-launch”标志从“staging”环境复制到“production”环境:

{
  "action": "copy-flag-config",
  "parameters": {
    "flagKey": "dark-launch",
    "sourceEnvironmentKey": "staging",
    "targetEnvironmentKey": "production"
  }
}

注意事项

  • 所有操作均通过你的 LaunchDarkly API 密钥进行身份验证。
  • 确保你的 API 令牌具有相关环境的目标定位管理权限。
  • 百分比发布采用基于用户 key 的哈希算法,确保同一用户始终处于同一受众组。
  • 跨环境复制会覆盖目标环境中的现有目标定位配置。

支持平台

  • Claude Code
  • Cursor
  • CopyCat
  • Codex
  • 其他通过 MCP 协议集成的 AI 代理工具

Individual skills in this repo

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

launchdarkly/aiconfig-agent-graphs

DEPRECATED redirect — this skill was renamed to agent-graphs. Do not use this skill; invoke agent-graphs instead. Kept only so old references to aiconfig-agent-graphs still point users to the new name.

launchdarkly/aiconfig-ai-metrics

DEPRECATED redirect — this skill was renamed to built-in-metrics. Do not use this skill; invoke built-in-metrics instead. Kept only so old references to aiconfig-ai-metrics still point users to the new name.

launchdarkly/aiconfig-create

DEPRECATED redirect — this skill was renamed to configs-create. Do not use this skill; invoke configs-create instead. Kept only so old references to aiconfig-create still point users to the new name.

launchdarkly/aiconfig-custom-metrics

DEPRECATED redirect — this skill was renamed to custom-metrics. Do not use this skill; invoke custom-metrics instead. Kept only so old references to aiconfig-custom-metrics still point users to the new name.

launchdarkly/aiconfig-migrate

DEPRECATED redirect — this skill was renamed to migrate. Do not use this skill; invoke migrate instead. Kept only so old references to aiconfig-migrate still point users to the new name.

launchdarkly/aiconfig-online-evals

DEPRECATED redirect — this skill was renamed to online-evals. Do not use this skill; invoke online-evals instead. Kept only so old references to aiconfig-online-evals still point users to the new name.

launchdarkly/aiconfig-projects

DEPRECATED redirect — this skill was renamed to projects. Do not use this skill; invoke projects instead. Kept only so old references to aiconfig-projects still point users to the new name.

launchdarkly/aiconfig-snippets

DEPRECATED redirect — this skill was renamed to snippets. Do not use this skill; invoke snippets instead. Kept only so old references to aiconfig-snippets still point users to the new name.

launchdarkly/aiconfig-targeting

DEPRECATED redirect — this skill was renamed to configs-targeting. Do not use this skill; invoke configs-targeting instead. Kept only so old references to aiconfig-targeting still point users to the new name.

launchdarkly/aiconfig-tools

DEPRECATED redirect — this skill was renamed to tools. Do not use this skill; invoke tools instead. Kept only so old references to aiconfig-tools still point users to the new name.

launchdarkly/aiconfig-update

DEPRECATED redirect — this skill was renamed to configs-update. Do not use this skill; invoke configs-update instead. Kept only so old references to aiconfig-update still point users to the new name.

launchdarkly/aiconfig-variations

DEPRECATED redirect — this skill was renamed to configs-variations. Do not use this skill; invoke configs-variations instead. Kept only so old references to aiconfig-variations still point users to the new name.

launchdarkly/apply

Apply LaunchDarkly SDK onboarding: install dependency (or dual-SDK pair), configure env and secrets with consent, add init at entrypoint(s), verify compile. Nested under sdk-install; next is run.

launchdarkly/detect

Detect repository stack for LaunchDarkly SDK onboarding: languages, frameworks, package managers, monorepo targets, entrypoints, existing LD usage. Nested under sdk-install; next is plan.

launchdarkly/first-flag

Create a boolean first flag, add evaluation, toggle on/off for end-to-end proof. Parent onboarding Step 6; uses MCP, API, or ldcli; optional flag-create skill.

launchdarkly/launchdarkly-experiment-setup

Set up and run experiments in LaunchDarkly. Create experiments with metrics, treatments, and flag config, start iterations to collect data, swap design between iterations, and stop with a winner.

launchdarkly/launchdarkly-flag-cleanup

Safely remove a feature flag from code while preserving production behavior. Use when the user wants to remove a flag from code, delete flag references, or create a PR that hardcodes the winning variation after a rollout is complete.

launchdarkly/launchdarkly-flag-create

Create and configure LaunchDarkly feature flags in a way that fits the existing codebase. Use when the user wants to create a new flag, wrap code in a flag, add a feature toggle, or set up an experiment. Guides exploration of existing patterns before creating.

launchdarkly/launchdarkly-flag-discovery

Audit your LaunchDarkly feature flags to understand the landscape, find stale or launched flags, and assess removal readiness. Use when the user asks about flag debt, stale flags, cleanup candidates, flag health, or wants to understand their flag inventory.

launchdarkly/launchdarkly-guarded-rollout

Configure guarded rollouts with progressive traffic increases, metric monitoring, and automatic rollback. Use when releasing features gradually with safety thresholds.

相关技能