跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

cleanup-feature-flags

Remove a launched Harness FME feature flag from application code, keeping the treatment FME serves today, and open a pull request. Use when asked to remove a flag from code, hardcode the winning treatment after a rollout, or pay down flag debt for a specific flag. Do not use for finding stale flags (discover-feature-flags) or archiving and deleting flags in FME (manage-flag-lifecycle). Trigger phrases: remove flag from code, hardcode treatment, flag cleanup, flag debt, clean up feature flag.

Harness · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add harness/harness-skills --skill cleanup-feature-flags

技能说明


name: cleanup-feature-flags description: >- Remove a launched Harness FME feature flag from application code, keeping the treatment FME serves today, and open a pull request. Use when asked to remove a flag from code, hardcode the winning treatment after a rollout, or pay down flag debt for a specific flag. Do not use for finding stale flags (discover-feature-flags) or archiving and deleting flags in FME (manage-flag-lifecycle). Trigger phrases: remove flag from code, hardcode treatment, flag cleanup, flag debt, clean up feature flag. metadata: author: Harness version: 1.2.2 mcp-server: harness-mcp summary: Remove a launched FME flag from code and open a PR; archive is handed to manage-flag-lifecycle license: Apache-2.0 compatibility: Requires the Harness MCP server or the Harness CLI

Cleanup Feature Flags

Remove one launched FME flag from application code and keep the branch FME serves today. The work ends with a PR. FME is read-only here; archive happens later in manage-flag-lifecycle.

Related: discover-feature-flags finds candidates (stale audit); manage-flag-lifecycle archives after the change deploys.

Tools

Works through the Harness MCP server or the Harness CLI; names are from tool-map.md.

OperationMCPCLI
List environmentsharness_list · fme_environment · compact: falseharness list fme_environment --json
Get flagharness_get · fme_feature_flag · params: { feature_flag_name }harness get feature_flag <flag> --json
List flag definitionsharness_list · fme_feature_flag_definition · params: { feature_flag_name } · filters: { offset: 0, limit: 100 } · compact: falseharness list feature_flag:definition <flag> --json
List experimentsharness_list · fme_experiment · filters: { parent_type: "FEATURE_FLAG", parent_name, status: ["ACTIVE", "PAUSED"], offset: 0, limit: 100 } (apply pagination completeness checks) · compact: falseharness list experiment --parent-type FEATURE_FLAG --parent-name <flag> --status ACTIVE --json, then again with --status PAUSED

Instructions

Load readiness.md before giving a verdict. Load sdk-patterns.md before searching code.

Phase 1: Establish scope

Follow scope-establishment.md. Fully paginate List environments per pagination before confirming the critical environments: by default those with isProduction, plus any the user adds. The critical set must be non-empty and explicitly confirmed back to the user before any later phase. If no environment is marked isProduction and the user hasn't named any, STOP and ask which environments are critical — do not treat an empty critical set as vacuously ready.

Phase 2: Pick the flag

If the user named a flag, Get flag to confirm it exists and note its status and rolloutStatus. If they want candidates instead, hand off to discover-feature-flags (stale audit) and come back with one flag.

Phase 3: Forward treatment and verdict

  1. Fully paginate List flag definitions for the flag with explicit MCP filters.limit: 100 and advancing filters.offset until a short page (size is ignored). Incomplete coverage stops code removal; it cannot establish a missing definition or the live forward treatment. Resolve the forward treatment for each critical environment per readiness.md. If any call site uses WithConfig, also resolve and compare each critical environment's configurations value for that treatment — identical treatment names with differing configs are blocked, not ready.
  2. Run the experiment check with List experiments, covering every page of ACTIVE and PAUSED results before a verdict. An incomplete scan stops code removal. Here ACTIVE means blocked: code removal ends the experiment. PAUSED means caution.
  3. Give the verdict per readiness.md. Stop on blocked.

Never infer the forward treatment from the code's default or fallback value.

Phase 4: Find call sites

In the application repo, identify the SDK and search for the flag key, batch calls, flag sets, config-file entries and tests per sdk-patterns.md. For each hit, record file:line, which branch is the forward one, and any side effects (tracking, metrics, logging).

  • If you find dynamic keys ("prefix-" + id, `flag-${id}`), the verdict is blocked. Stop and ask the user how to proceed; automated removal can't be complete.
  • If you find no hits, the flag may live in another repo or only in a flag set. That is caution.

Phase 5: Present the plan and wait

Show:

  • the forward treatment for each critical environment and why;
  • each call site with the branch to keep and the code to delete;
  • the verdict, with every caution reason;
  • the last impression for each critical environment.

If the forward treatment is control or a killed defaultTreatment, say plainly that the newer code path will be deleted. Edit nothing until the user explicitly confirms this plan.

Phase 6: Edit and verify

  1. Work on a new branch in the application repo.
  2. At each call site, keep the forward branch and inline the config value if WithConfig is used. Remove the dead branches, plus any flag-only constants, wrappers, imports, tests, fixtures, localhost or offline entries, and docs. Don't refactor unrelated code.
  3. Search again for the key and for the batch and flag-set patterns. Any remaining hits must be explained: homonyms, other services, or fixtures the user wants to keep.
  4. Run the repo's own
阅读完整来源 ↗