launchdarkly-flag-cleanup
БесплатноБез исполняемых скриптовНе проверенSafely remove a feature flag from code while preserving production behavior. Use when the user wants to remove a flag from code, delete flag references, or…
от launchdarkly★ 32 звезды на GitHubОб этом скилле
LaunchDarkly Flag Cleanup
You're using a skill that will guide you through safely removing a feature flag from a codebase while preserving production behavior. Your job is to explore the codebase to understand how the flag is used, query LaunchDarkly to determine the correct forward value, remove the flag code cleanly, and verify the result.
If you haven't already identified which flag to clean up, use the flag discovery skill first to audit the landscape and find candidates.
Prerequisites
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.
Required MCP tools:
get-removal-readiness: detailed safety check (orchestrates flag config, cross-env status, dependencies, code references, and expiring targets in parallel)get-flags: fetch flag configuration for a specific environment
Optional MCP tools:
archive-flag: archive the flag in LaunchDarkly after code removaldelete-flag: permanently delete the flag (irreversible, prefer archive)
Core Principles
- Safety First: Always preserve current production behavior.
- LaunchDarkly as Source of Truth: Never guess the forward value. Query the actual configuration.
- Follow Conventions: Respect existing code style and structure.
- Minimal Change: Only remove flag-related code. No unrelated refactors.
Workflow
Step 1: Explore the Codebase
Before touching LaunchDarkly or removing code, understand how this flag is used in the codebase.
Find all references to the flag key. Search for the flag key string (e.g.,
new-checkout-flow) across the codebase. Check for:- Direct SDK evaluation calls (
variation(),boolVariation(),useFlags(), etc.) - Constants/enums that reference the key
- Wrapper/service patterns that abstract the SDK
- Configuration files, tests, and documentation
- See SDK Patterns for the full list of patterns by language
- Direct SDK evaluation calls (
Understand the branching. For each reference, identify:
- What code runs when the flag is
true(or variation A)? - What code runs when the flag is
false(or variation B)? - Are there side effects, early returns, or nested conditions?
- What code runs when the flag is
Note the scope. How many files, components, or modules does this flag touch? A flag used in one
ifblock is simpler than one threaded through multiple layers.
Step 2: Run the Removal Readiness Check
Use get-removal-readiness to get a detailed safety assessment. This single tool call orchestrates multiple checks in parallel:
- Flag configuration and targeting state
- Cross-environment status
- Dependent flags (prerequisites)
- Expiring targets
- Code reference statistics
The tool returns a readiness verdict:
safe: No blockers or warnings. Proceed with removal.
caution: No hard blockers but warnings exist (e.g., code references in other repos, expiring targets scheduled, flag marked as permanent). Present warnings and let the user decide.
blocked: Hard blockers prevent safe removal (e.g., dependent flags, actively receiving requests, targeting is on with active rules). Present blockers: the user must resolve them first.
Step 3: Determine the Forward Value
Use get-flags to fetch the flag configuration in each critical environment. The forward value is the variation that replaces the flag in code.
| Scenario | Forward Value |
|---|---|
| All critical envs ON, same fallthrough, no rules/targets | Use fallthrough.variation |
| All critical envs OFF, same offVariation | Use offVariation |
| Critical envs differ in ON/OFF state | NOT SAFE: stop and inform the user |
| Critical envs serve different variations | NOT SAFE: stop and inform the user |
Step 4: Present the Cleanup Plan
Before modifying any code, present a summary to the user and wait for confirmation:
- The forward value — which variation will be hardcoded and why (based on the flag's current state).
- All code references found — file paths and line numbers from Step 1.
- Planned changes — for each reference, describe what will be removed and what will be kept.
- Readiness verdict — the result from
get-removal-readiness(safe, caution, or blocked) and any warnings. - LaunchDarkly action — confirm the flag will be archived after code changes are complete.
Do not proceed with code changes until the user explicitly confirms.
Step 5: Remove the Flag from Code
Now execute the removal using what you learned in Step 1.
Replace flag evaluations with the forward value.
- Preserve the code branch matching the forward value
- Remove the dead branch entirely
- If the flag value was assigned to a variable, replace the variable with the literal value or inline it
Clean up dead code.
- Remove imports, constants, and type definitions that only existed for the flag
- Remove functions,
Установить launchdarkly-flag-cleanup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл launchdarkly-flag-cleanup?
Safely remove a feature flag from code while preserving production behavior. Use when the user wants to remove a flag from code, delete flag references, or create a PR that hardcodes the winning variation after a rollout is complete.
Как установить скилл launchdarkly-flag-cleanup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл launchdarkly-flag-cleanup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic