update-flag-targeting
Change how a Harness FME feature flag serves traffic in environments. Covers percentage rollout, individual targets, targeting rules (attribute/segment/flag-dependency), defaultTreatment, trafficAllocation, treatments, kill/restore, and copying or initializing a definition in an environment. Use when asked to ramp a flag, add rules/users, change allocation, kill/restore, or promote config. Not for creating flags (create-feature-flag), metadata like tags/owners/archive (manage-flag-lifecycle), segment keys (manage-segments), pipeline rollouts (fme-pipeline), or flag analysis (explain-flag). Trigger phrases: update targeting, ramp flag, percentage rollout, add rule, add users, kill flag, restore, copy config.
Harness · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add harness/harness-skills --skill update-flag-targeting技能说明
name: update-flag-targeting description: >- Change how a Harness FME feature flag serves traffic in environments. Covers percentage rollout, individual targets, targeting rules (attribute/segment/flag-dependency), defaultTreatment, trafficAllocation, treatments, kill/restore, and copying or initializing a definition in an environment. Use when asked to ramp a flag, add rules/users, change allocation, kill/restore, or promote config. Not for creating flags (create-feature-flag), metadata like tags/owners/archive (manage-flag-lifecycle), segment keys (manage-segments), pipeline rollouts (fme-pipeline), or flag analysis (explain-flag). Trigger phrases: update targeting, ramp flag, percentage rollout, add rule, add users, kill flag, restore, copy config. metadata: author: Harness version: 1.2.2 mcp-server: harness-mcp summary: Ramp, rules, individual targets, allocation, treatments, kill/restore, env-to-env copy, and initializing definitions license: Apache-2.0 compatibility: Requires the Harness MCP server or the Harness CLI
Update Flag Targeting
Change how an existing Harness FME feature flag serves traffic in one or more environments. Always read the current definition first, then merge-patch only what changes. Show a diff of just what changed and use plain-language before/after to describe who gets what.
Related: Segment membership changes are /manage-segments; deep flag analysis (impact, dependencies, single-flag state) is /explain-flag. Reverse-lookup scans (dependents, segment usage) are in tool-map.md.
Tools
Works through the Harness MCP server or the Harness CLI; names are from tool-map.md.
| Operation | MCP | CLI |
|---|---|---|
| List environments | harness_list · fme_environment · compact: false | harness list fme_environment --json |
| List flag definitions | harness_list · fme_feature_flag_definition · params: { feature_flag_name } · filters: { offset: 0, limit: 100 } · compact: false | harness list feature_flag:definition <flag> --json |
| Get definition | harness_get · fme_feature_flag_definition · params: { feature_flag_name, environment_id } | harness get feature_flag:definition <flag> --env <env-id> --json |
| Get parent flag definition | harness_get · fme_feature_flag_definition · params: { feature_flag_name: <parent>, environment_id } | harness get feature_flag:definition <parent> --env <env-id> --json |
| Update definition | harness_update · fme_feature_flag_definition · params: { feature_flag_name, environment_id } · body: { <fields>, comment, title? } | harness update feature_flag:definition <flag> --env <env-id> -f patch.json --json (include comment/supported title in the file) |
| Create definition | harness_create · fme_feature_flag_definition · params: { feature_flag_name, environment_id } · body: { treatments, defaultTreatment, defaultRule, rules?, baselineTreatment?, trafficAllocation?, comment? } | harness create feature_flag:definition <flag> --env <env-id> -f def.json |
| Kill flag | harness_execute · fme_feature_flag · action="kill" · params: { feature_flag_name, environment_id } · body: { comment?, title? }? | harness execute feature_flag:kill <flag> --env <env-id> --comment <text> |
| Restore flag | harness_execute · fme_feature_flag · action="restore" · params: { feature_flag_name, environment_id } · body: { comment?, title? }? | harness execute feature_flag:restore <flag> --env <env-id> --comment <text> |
| Get segment metadata (all types) | harness_get · fme_segment · params: { segment_name, segment_type } | harness get segment <segment> --segment-type <type> --json |
| Get STANDARD segment definition | harness_get · fme_segment_definition · params: { segment_name, environment_id } | harness get segment:definition <segment> --env <env-id> --json |
| List experiments | harness_list · fme_experiment · filters: { parent_type: "FEATURE_FLAG", parent_name, environment_id, status: ["ACTIVE", "PAUSED"], offset: 0, limit: 100 } (apply pagination completeness checks) · compact: false | harness list experiment --parent-type FEATURE_FLAG --parent-name <flag> --env <env-id> --status ACTIVE --json, then again with --status PAUSED |
Instructions
See concepts.md for FME evaluation order, killed state, treatments vs control, and round-tripping shapes. See write-safety.md for the confirm-before-write protocol; this skill links to it and does not duplicate it.
Phase 1: Establish scope
Follow scope-establishment.md. Ask for org_id and project_id if not already known. Restate: Working in org=..., project=...
Phase 2: Gather intent
Ask only for what's missing:
- Flag name (case-sensitive identifier)
- Target environments (names or IDs, or "all")
- What to change (map the user's request to one or more operations in the table below)
Phase 3: Read current state
Always fully paginate List flag definitions for the flag before planning changes in the target environments: explicitly set MCP filters.limit: 100, advance filters.offset, and stop only on a short page. size is ignored for this list. Incomplete inventory is not evidence a definition is missing; stop rather than initialize from a first-page miss. Follow pagination for environment and experiment lookups too. Never compose rules, targets, or matchers from memory — copy shapes from the live definition or another flag in the project that already uses that shape. If no example exists, warn that the shape is unverified, try it in a non-production env first, and let the API's 400