用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/tomes --skill remove-feature-flag命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | remove-feature-flag |
| description | Use this skill to remove a feature flag when the flag is no longer needed and its |
| metadata | {"author":"androidx"} |
| Term | Definition |
|---|---|
| Feature Flag | A mechanism to toggle functionality without deploying new code. The value can be a boolean, enum, or similar type. |
| Refactoring | The process of restructuring existing computer code without changing its external, observable behavior. Removing a feature flag is a refactoring change. |
| Dead Code | Code that is part of the source but is unreachable and can never be executed. |
The primary goal is to remove the feature flag and codepaths related to the feature flag without any observable impact on library behavior.
Determine the final, permanent, static value of the feature flag, which will be used to replace all
usages of the feature flag. For a boolean flag, this will either be true or false.
In the codebase, find all instances where the feature flag is used, and replace the usage of the feature flag with the static value from Step 1.
ComposeUiFlags.isMyFeatureEnabled is a boolean feature flag that being replaced with true.
Before:
if (myState && ComposeUiFlags.isMyFeatureEnabled) {
newBehavior()
} else {
oldBehavior()
}
After:
if (myState) {
newBehavior()
} else {
oldBehavior()
}
After replacing the feature flag with a static value, some code paths will become unreachable. This dead code must be removed.
For example:
true, then a codepath that is only used when the feature flag was false
is dead code and must be removed.false, then a codepath that is only used when the feature flag was true
is dead code and must be removed.ComposeUiFlags.isMyFeatureEnabled is a boolean feature flag that is being replaced with true.
Before:
if (ComposeUiFlags.isMyFeatureEnabled) {
newBehavior()
} else {
oldBehavior()
}
After:
newBehavior()
Find any tests that are related to the feature flag. If a test was validating a codepath that was removed in Step 3, then that test must be removed. If the only place where code is used is in a test, then that code can still be considered unreachable, and must be removed.
All places where the feature flag is being read to or written should now be removed. Remove the declaration of the feature flag.
Source: androidx/androidx — distributed by TomeVault.