Agent Skillszerx-lab/zap › remove-feature-flag

remove-feature-flag

GitHub

指导在功能标志稳定后,从代码库中彻底移除该标志以减少技术债务。包括清理配置、枚举、条件编译指令及死代码,并执行测试验证。

.agents/skills/remove-feature-flag/SKILL.md zerx-lab/zap

Trigger Scenarios

需要移除已上线的功能标志 清理废弃的代码分支

Install

npx skills add zerx-lab/zap --skill remove-feature-flag -g -y
More Options

Non-standard path

npx skills add https://github.com/zerx-lab/zap/tree/main/.agents/skills/remove-feature-flag -g -y

Use without installing

npx skills use zerx-lab/zap@remove-feature-flag

指定 Agent (Claude Code)

npx skills add zerx-lab/zap --skill remove-feature-flag -a claude-code -g -y

安装 repo 全部 skill

npx skills add zerx-lab/zap --all -g -y

预览 repo 内 skill

npx skills add zerx-lab/zap --list

SKILL.md

Frontmatter
{
    "name": "remove-feature-flag",
    "description": "Remove a feature flag after it has been rolled out and stabilized in the Warp codebase."
}

remove-feature-flag

Remove a feature flag after it has been rolled out and stabilized in the Warp codebase.

Overview

After a feature flag has been enabled for all users and has stabilized in production, the flag should be removed to reduce technical debt and simplify the codebase. This involves removing the flag definition and all conditional checks.

When to Remove

Remove a feature flag when:

  • The feature has been enabled in default features in app/Cargo.toml
  • The feature has been stable in production for a reasonable period
  • There are no plans to disable the feature or provide configuration options
  • The team agrees the feature is permanent

Steps

1. Remove from app/Cargo.toml

Remove the feature from both the [features] section and the default array:

[features]
default = [
    # Remove "your_feature_name" from here
]

# Remove this line:
# your_feature_name = []

2. Remove from FeatureFlag enum

Remove the variant from the FeatureFlag enum in warp_core/src/features.rs:

#[derive(Sequence)]
pub enum FeatureFlag {
    // Remove YourFeatureName,
}

3. Remove from app/src/lib.rs

Remove the conditional compilation directive:

// Remove these lines:
// #[cfg(feature = "your_feature_name")]
// YourFeatureName,

4. Remove from DOGFOOD_FLAGS/PREVIEW_FLAGS/RELEASE_FLAGS

If the flag was listed in any of these arrays in features.rs, remove it:

pub const DOGFOOD_FLAGS: &[FeatureFlag] = &[
    // Remove FeatureFlag::YourFeatureName,
];

5. Remove all runtime checks and dead code

Find and remove all FeatureFlag::YourFeatureName.is_enabled() checks throughout the codebase:

Before:

if FeatureFlag::YourFeatureName.is_enabled() {
    // new behavior
} else {
    // old behavior (dead code)
}

After:

// new behavior (unconditionally enabled)

Use ripgrep to find all occurrences:

rg "YourFeatureName" app/ warp_core/

6. Remove keybinding predicates

If the feature flag was used in keybinding enabled predicates, remove the predicate:

Before:

EditableBinding::new(
    "action:name",
    "Action description",
    YourAction::Variant
)
.with_enabled(|| FeatureFlag::YourFeatureName.is_enabled())
.with_key_binding("cmdorctrl-key")

After:

EditableBinding::new(
    "action:name",
    "Action description",
    YourAction::Variant
)
.with_key_binding("cmdorctrl-key")

7. Clean up dead code branches

Remove any code paths that were only executed when the feature was disabled (the else branches in feature checks). These are now dead code.

8. Run tests and validation

After removing the flag:

# Format and lint
cargo fmt
cargo clippy --workspace --all-targets --all-features --tests -- -D warnings

# Run tests
cargo nextest run --no-fail-fast --workspace --exclude command-signatures-v2

# Build the app
cargo run

Best Practices

  • Remove feature flags promptly after they're no longer needed to reduce technical debt
  • When removing a flag, remove ALL related code (checks, dead branches, keybinding predicates)
  • Use grep/ripgrep to ensure you've found all occurrences
  • Test thoroughly after removal to ensure no regressions
  • Consider doing flag removal in a separate PR for easier review

Example Search Commands

# Find all occurrences of the flag name
rg "YourFeatureName" app/ warp_core/

# Find feature flag checks
rg "FeatureFlag::YourFeatureName" app/

# Find cfg attributes
rg 'cfg\(feature = "your_feature_name"\)' app/

Version History

  • 5d87445 Current 2026-07-24 17:35

Same Skill Collection

.agents/skills/add-feature-flag/SKILL.md
.agents/skills/add-telemetry/SKILL.md
.agents/skills/dedupe-issue-local/SKILL.md
.agents/skills/diagnose-ci-failures/SKILL.md
.agents/skills/fix-errors/SKILL.md
.agents/skills/implement-specs/SKILL.md
.agents/skills/promote-feature/SKILL.md
.agents/skills/resolve-merge-conflicts/SKILL.md
.agents/skills/review-pr-local/SKILL.md
.agents/skills/review-pr/SKILL.md
.agents/skills/rust-unit-tests/SKILL.md
.agents/skills/spec-driven-implementation/SKILL.md
.agents/skills/triage-issue-local/SKILL.md
.agents/skills/update-skill/SKILL.md
.agents/skills/warp-integration-test/SKILL.md
.agents/skills/warp-ui-guidelines/SKILL.md
.agents/skills/write-product-spec/SKILL.md
.agents/skills/write-tech-spec/SKILL.md
resources/bundled/mcp_skills/figma/figma-code-connect-components/SKILL.md
resources/bundled/mcp_skills/figma/figma-create-design-system-rules/SKILL.md
resources/bundled/mcp_skills/figma/figma-create-new-file/SKILL.md
resources/bundled/mcp_skills/figma/figma-generate-library/SKILL.md
resources/bundled/mcp_skills/figma/figma-implement-design/SKILL.md
resources/bundled/skills/add-mcp-server/SKILL.md
resources/bundled/skills/create-skill/SKILL.md
resources/bundled/skills/create-tab-config/SKILL.md
resources/bundled/skills/feedback/SKILL.md
resources/bundled/skills/modify-settings/SKILL.md
resources/bundled/skills/pr-comments/SKILL.md
resources/bundled/skills/tab-configs/SKILL.md
resources/bundled/skills/update-tab-config/SKILL.md
resources/channel-gated-skills/dogfood/triage-vulnerabilities/SKILL.md
resources/bundled/mcp_skills/figma/edit-figma-design/SKILL.md
resources/bundled/mcp_skills/figma/figma-generate-design/SKILL.md
resources/bundled/mcp_skills/figma/figma-use/SKILL.md
resources/bundled/skills/claude-api/SKILL.md

Metadata

Files
0
Version
5d87445
Hash
5251d7c5
Indexed
2026-07-24 17:35

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 23:25
浙ICP备14020137号-1 $mapa de visitantes$