instrument-feature-flag
Gate application code behind an existing Harness FME feature flag. Detect the app's language, framework and any existing flag wrapper first; ask only what that can't resolve (target app, subject identity, gating point, treatment/config/fallback names, extension needs). Prefer an existing wrapper; otherwise propose a thin, customer-extensible facade or hook — never a new framework or second SDK client — approved before editing. Map named treatments to branches with a safe, non-boolean-coerced fallback, then add tests at the wrapper and call-site boundary. New flags delegate to create-feature-flag with the one environment actually selected; missing targeting delegates to update-flag-targeting under fresh approval. Not for flag creation alone, metrics (choose-metric, create-metric, instrument-metric), or first-time onboarding (feature-flag-onboarding). Trigger phrases: gate this code behind a flag, add flag check, wire up getTreatment, add SDK evaluation call.
Harness · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add harness/harness-skills --skill instrument-feature-flag技能说明
name: instrument-feature-flag description: >- Gate application code behind an existing Harness FME feature flag. Detect the app's language, framework and any existing flag wrapper first; ask only what that can't resolve (target app, subject identity, gating point, treatment/config/fallback names, extension needs). Prefer an existing wrapper; otherwise propose a thin, customer-extensible facade or hook — never a new framework or second SDK client — approved before editing. Map named treatments to branches with a safe, non-boolean-coerced fallback, then add tests at the wrapper and call-site boundary. New flags delegate to create-feature-flag with the one environment actually selected; missing targeting delegates to update-flag-targeting under fresh approval. Not for flag creation alone, metrics (choose-metric, create-metric, instrument-metric), or first-time onboarding (feature-flag-onboarding). Trigger phrases: gate this code behind a flag, add flag check, wire up getTreatment, add SDK evaluation call. metadata: author: Harness version: 1.0.1 mcp-server: harness-mcp license: Apache-2.0 compatibility: Requires the Harness MCP server or the Harness CLI for flag reads, plus local application code access to make edits; guidance-only (no edits) if application access is unavailable
Instrument Feature Flag
Skill identifier: instrument-feature-flag. Gate application code behind an existing FME flag: inspect the real app first, prefer or design a small customer-extensible wrapper, get it approved, implement the minimal edits, and test at the wrapper and call-site boundary. Related: /create-feature-flag (new flag), /update-flag-targeting (missing/insufficient targeting), /feature-flag-onboarding (first-time setup, which delegates here for code).
Tools
Works through the Harness MCP server or the Harness CLI; names are from tool-map.md. This skill only reads Harness flag state for the selected environment — flag/definition writes are delegated to /create-feature-flag and /update-flag-targeting.
| Operation | MCP | CLI |
|---|---|---|
| List flags | harness_list · fme_feature_flag · size: 50 · compact: false | harness list feature_flag --json --limit 50 |
| Get flag | harness_get · fme_feature_flag · params.feature_flag_name | harness get feature_flag <name> --json |
| List environments | harness_list · fme_environment · compact: false | harness list fme_environment --json |
| List traffic types | harness_list · fme_traffic_type · compact: false | harness list traffic_type --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 |
Instructions
Phase 1: Scope
Follow scope-establishment.md. Carry confirmed account/org/project, transport and application target from the request/caller; ask only for missing context before API calls. Keep Harness scope separate from the application repo/runtime — never derive one from the other. See mcp-setup.md for a supported CLI or MCP choice. List environments and require one explicitly confirmed environment before any flag/definition handoff. Resolve its ID and isProduction; if none is selected or the choice is ambiguous, ask and STOP—never inherit an all-environments default. This selection does not authorize a write.
Phase 2: Detect the codebase before integration questions
Inspect the real application: language/framework/runtime and package manager (lockfiles/manifests), which app/package in a monorepo is plausible, the installed FME/OpenFeature/Classic-FF SDK and its version, and any existing flag wrapper/facade (grep flag-adjacent helper names, not only raw SDK calls). See sdk-patterns.md for detection signals and language-guidance.md for the native-FME/OpenFeature/Classic-FF contract table — FME native treatments are names, not booleans, and batch/config/async evaluation calls have their own result shapes; never assume a signature shared across them. Stop: Classic FF-only repo with no matching FME flag; or an OpenFeature provider whose configured target (FME project/environment) is unverified — confirm it before treating getBooleanValue/etc. as evidence about this flag. Summarize detected facts in 3–5 bullets before asking integration questions. With no application access, ask for the missing non-secret context and provide guidance only: no invented file locations, edits or test success. An absent SDK is a setup case, not an unknown-signature exception: propose a runtime-appropriate package from verified official docs, and include installation/version changes in the approval plan.
Phase 3: Ask only what inspection didn't resolve
Ask only for facts Phase 2 left open, and never re-ask a fact already confirmed by inspection or already supplied by a calling skill (e.g. /feature-flag-onboarding):
- Target app/package, if a monorepo has more than one plausible target.
- Evaluation subject key source and traffic type, if more than one identity candidate exists (user vs. account vs. anonymous).
- Exact gating point — candidate
file:lineif more than one placement is plausible. - Named treatments/config this call site must branch on, and the safe fallback for
control/errors. - Extension needs — will the app or its customers add treatments/branches later without touching this call site again?
Phase 4: Resolve the flag definition
Get flag using the confirmed name and scope. A 404 is not proof a new flag is needed: recheck the identifier, scope and access per tool-map.md. Only after resolving
阅读完整来源 ↗