Skip to main content

feature-flag

Registers a feature flag as additive-only and verifies the flag-off path still matches the previous default. Use whenever adding or extending a feature flag, editing FeatureFlags.cs, changing feature_flags in assembler.yml, gating a code path behind a FEATURE_* environment variable, or enabling a flag in an environment. Do not skip this skill for flag work even if the user does not name it.

소스 정보

저장소
elastic/docs-builder
최근 소스 활동
2026년 9월 2일 08:45
감지된 SKILL.md 언어
영어
스타
25
포크
46

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
feature-flag
description
Registers a feature flag as additive-only and verifies the flag-off path still matches the previous default. Use whenever adding or extending a feature flag, editing FeatureFlags.cs, changing feature_flags in assembler.yml, gating a code path behind a FEATURE_* environment variable, or enabling a flag in an environment. Do not skip this skill for flag work even if the user does not name it.
# Feature Flag Skill A feature flag is additive. Flag off keeps the previous default. Flag on adds new behavior only. ## When to use Read this skill before you add any of these: - A typed flag on `FeatureFlags` - A `feature_flags` YAML key - A `FEATURE_*` environment override - An `if (flag)` around a code path ## How flags work - Typed flags live in `src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs` - Keys normalize to kebab-case. The env override is `FEATURE_<UPPER_SNAKE>` - Per-environment YAML keys live under `feature_flags` in `config/assembler.yml` as `UPPER_SNAKE` - Flags stay off unless listed. Do not enable a new flag in `prod` when you create it - `PublishEnvironment.ToFeatureFlags()` in `src/Elastic.Documentation.Configuration/Assembler/PublishEnvironment.cs` loads YAML keys through `Set()` - Follow the test pattern in `tests/Elastic.Documentation.Build.Tests/FeatureFlagsTests.cs` ## Steps ### 1. Additive means Flag off equals the previous default in behavior. Flag on adds new behavior only. Do not move, hide, relocate, or delete existing output when you introduce the flag. New behavior is a new panel, a new build step, or a new field. It is not a relocated copy of something that already shipped. ### 2. Register the flag 1. Add a typed property on `FeatureFlags`. The default stays false. 2. Add YAML keys only in the environments that opt in. 3. Do not turn the flag on in `prod` as part of creating it. ### 3. Gate only the new path Put the `if (flag)` around new code. Leave the existing branch as it was. Shared markup, layout, and data wiring that the old path still needs stay outside the flag. ### 4. Verify additivity before you finish This step is required. Do not skip it. 1. List every existing surface the change touches. Include render paths, CLI output, build steps, API payloads, mobile and desktop, and assembler vs isolated builds. 2. For each surface, compare the flag-off branch to the pre-change code or output. 3. If anything that already shipped is missing, moved, or changed when the flag is off, stop. Restore it on the default path. ### 5. Prove it with tests - The flag defaults to false. - Flag-off preserves existing behavior. - Flag-on shows the new behavior. - Sibling flags stay unchanged. - Prod, or the default environment, does not enable the new flag. ### 6. Stop conditions Do not ship a flag whose existing behavior lives only on the new path. Do not treat "the new path has it" as coverage for the old path.
GitHub에서 보기