
Launchdarkly Flag Cleanup
Automate stale LaunchDarkly feature-flag removal while preserving production behavior and opening documented PRs.
Overview
Launchdarkly-flag-cleanup is an agent skill most often used in Operate (also Build integrations, Ship review) that safely retires LaunchDarkly feature flags and code references via the LaunchDarkly MCP server.
Install
npx skills add https://github.com/launchdarkly/agent-skills --skill launchdarkly-flag-cleanupWhat is this skill?
- Judges whether a flag is safe to remove using LaunchDarkly as source of truth
- Computes forward values so production behavior stays unchanged after cleanup
- Orchestrates code reference removal and pull-request creation with clear documentation
- Requires remotely hosted LaunchDarkly MCP server with agent-optimized orchestration tools
- Targets stale flags, tech debt, and safe code-removal workflows
Adoption & trust: 1.6k installs on skills.sh; 16 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have shipped features behind flags but stale toggles and scattered `if (flag)` branches keep adding risk and review overhead.
Who is it for?
Teams already on LaunchDarkly with MCP configured who want agent-driven flag retirement instead of manual audits.
Skip if: Projects without LaunchDarkly, flags still needed for experiments or rollbacks, or environments where MCP is not approved.
When should I use this skill?
A feature flag is fully rolled out and you want the agent to verify readiness, set forward values, remove references, and open a cleanup PR via LaunchDarkly MCP.
What do I get? / Deliverables
You get a verified removal path, preserved production behavior, cleaned code references, and a documented PR ready for merge.
- Readiness assessment for flag removal
- Code changes removing flag references with correct forward values
- Documented pull request for cleanup
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Operate because flag cleanup is ongoing production hygiene and tech-debt reduction after features ship. Iterate fits recurring removal of stale flags and code references once rollouts are complete.
Where it fits
Audit quarterly for flags at 100% rollout and queue agent-driven cleanup PRs.
Strip LaunchDarkly client branches once the default path matches full enablement.
Open a documented PR that explains forward values and links to LaunchDarkly flag history.
How it compares
Use for governed flag teardown with LaunchDarkly truth— not ad-hoc search-and-delete across the repo without forward-value analysis.
Common Questions / FAQ
Who is launchdarkly-flag-cleanup for?
Solo and indie builders (and small teams) shipping SaaS or APIs with LaunchDarkly who need repeatable stale-flag cleanup through their agent.
When should I use launchdarkly-flag-cleanup?
In Operate when iterating on production hygiene; in Build when removing flag calls from integrations; and in Ship when preparing a review-ready PR after a flag is fully rolled out.
Is launchdarkly-flag-cleanup safe to install?
It drives production-impacting changes via MCP and git—review the Security Audits panel on this page and validate forward values before merging any agent-opened PR.
SKILL.md
READMESKILL.md - Launchdarkly Flag Cleanup
{ "name": "launchdarkly-flag-cleanup", "description": "Safely automate feature flag cleanup workflows using LaunchDarkly MCP server", "version": "1.0.0-experimental", "author": "LaunchDarkly", "repository": "https://github.com/launchdarkly/ai-tooling", "skills": ["./"], "tags": [ "launchdarkly", "feature-flags", "feature-management", "stale-flags", "tech-debt", "cleanup", "code-removal", "devops", "mcp" ], "requirements": { "mcp-servers": ["@launchdarkly/mcp-server"] } } # LaunchDarkly Flag Cleanup Skill An Agent Skill for safely automating feature flag cleanup workflows using LaunchDarkly as the source of truth. ## Overview This skill teaches agents how to: - Determine if a feature flag is ready for removal - Calculate the correct forward value to preserve production behavior - Safely remove flag references from code - Create well-documented pull requests ## Installation (Local) For now, install by placing this skill directory where your agent client loads skills. Examples: - **Generic**: copy `skills/feature-flags/launchdarkly-flag-cleanup/` into your client's skills path ## Prerequisites This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment. The remote server provides higher-level, agent-optimized tools that orchestrate multiple API calls and return pruned, actionable responses. Refer to your LaunchDarkly account settings for instructions on connecting to the remotely hosted MCP server. ## Usage Once installed, the skill activates automatically when you ask about flag cleanup: ``` Remove the `new-checkout-flow` feature flag ``` ``` Is the `dark-mode` flag ready to be cleaned up? ``` ``` Clean up stale feature flags in this codebase ``` ## Structure ``` launchdarkly-flag-cleanup/ ├── SKILL.md ├── marketplace.json ├── README.md └── references/ ├── pr-template.md └── sdk-patterns.md ``` ## Related - [LaunchDarkly MCP Server](https://github.com/launchdarkly/mcp-server) - [LaunchDarkly Docs](https://docs.launchdarkly.com) - [Agent Skills Specification](https://agentskills.io/specification) ## License Apache-2.0 # PR Template for Flag Removal Use this template when creating pull requests for flag cleanup. ```markdown ## Flag Removal: `{flag-key}` ### Removal Summary - **Forward Value**: `{variation value being preserved}` - **Critical Environments**: {list environments} - **Status**: ✅ Ready for removal / ⚠️ Proceed with caution / ❌ Not ready ### Removal Readiness Assessment **Configuration Analysis:** | Environment | State | Serving | Rules | Targets | |-------------|-------|---------|-------|---------| | production | ON/OFF | `{value}` | none/present | none/count | | {other env} | ON/OFF | `{value}` | none/present | none/count | **Lifecycle Status:** | Environment | Status | Evaluations (7d) | |-------------|--------|------------------| | production | launched/active/inactive/new | {count} | | {other env} | launched/active/inactive/new | {count} | **Code References:** - Repositories with references: `{count}` - This PR addresses: `{current repo}` - Other repos requiring cleanup: `{list if any}` ### Changes Made - Removed flag evaluation calls: `{count}` occurrences - Files modified: `{list files}` - Preserved behavior: `{describe what code now does}` - Cleaned up: `{list dead code removed}` ### Risk Assessment {Explain why this change is safe. Address:} - Why the forward value is correct - Any edge cases considered - Impact on other environments (if any) ### Reviewer Checklist - [ ] Forward value matches production behavior - [ ] All flag references removed - [ ] No unrelated changes included - [ ] Tests pass (if applicable) - [ ] Dead code properly removed ### Post-Merge Actions - [ ] Archive flag in LaunchDarkly (after deployment confirmed) - [ ] Notify other teams if they have code references ``` ## Example: Ready for Removal ```markdown ## Flag Removal: `new-checkout-flo