/iac-automation-skills:feature-flag-configuration-launchdarkly-and-unleashfrom iac-automation-skills
Designs and operates feature flag configuration with LaunchDarkly or Unleash, covering flag lifecycle (create, target, roll out, retire), kill-switch patterns for fast incident mitigation, targeting/segmentation rules, and cleaning up stale flag debt.
Ships in iac-automation-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Feature flags decouple deploying code from releasing a capability:
new code ships dark behind a flag, then gets turned on for a percentage
of traffic, a specific segment, or instantly rolled back — all without a
redeploy. That decoupling is what makes flags valuable operationally, not
just as an A/B-testing convenience: a flag that wraps a risky code path
gives on-call a sub-second kill switch that a git revert and redeploy
pipeline cannot match. The operational risk flags introduce is the
opposite failure mode — flag debt. Every flag is a live branch in
production code, and a flag left in place after its rollout is "done"
becomes permanent conditional complexity, a source of confusing bugs
(the flag evaluates differently than anyone remembers), and eventually a
security/compliance question ("why does this old admin-bypass flag still
exist"). This skill covers the flag lifecycle and its cleanup, not just
the initial if (flag.isEnabled()) wiring.
release-, experiment-, ops- prefixes signaling expected
lifetime) — retrofitting a convention onto hundreds of ungoverned flags
is far more expensive than establishing one at project start.Name and tag every flag with its intended lifetime up front. A flag meant to be removed within weeks (a release/rollout flag) is a different governance category than one meant to live indefinitely (an ops kill switch or a permanent entitlement flag):
release-new-checkout-flow # temporary — remove after full rollout
experiment-pricing-page-v2 # temporary — remove after experiment ends
ops-disable-recommendations # permanent — kill switch, keep
entitlement-enterprise-sso # permanent — plan-gated capability
Record the intended removal date/condition in the flag's description field in the platform itself (both LaunchDarkly and Unleash support a free-text description), not only in a ticket that will be forgotten.
Wrap the flag check at the narrowest point that lets you cleanly remove it later, not scattered through business logic:
// LaunchDarkly server-side SDK (Node.js)
const showNewCheckout = await ldClient.variation(
"release-new-checkout-flow",
{ key: user.id, custom: { plan: user.plan } },
false // default value if evaluation fails
);
if (showNewCheckout) {
return renderNewCheckout(user);
}
return renderLegacyCheckout(user);
// Unleash server-side SDK (Node.js)
const { unleash } = require("unleash-client");
if (unleash.isEnabled("release-new-checkout-flow", { userId: user.id })) {
return renderNewCheckout(user);
}
return renderLegacyCheckout(user);
A single evaluation call at the top of the request path (not one call
per sub-decision inside renderNewCheckout) keeps the eventual flag
removal a small, mechanical diff.
Roll out gradually with percentage or segment targeting rather than a single on/off flip, so a bad release affects a bounded slice of traffic before it affects everyone:
// LaunchDarkly targeting rule (simplified)
{
"rules": [
{
"clauses": [{ "attribute": "plan", "op": "in", "values": ["internal"] }],
"variation": 0
},
{
"rollout": {
"variations": [
{ "variation": 0, "weight": 10000 },
{ "variation": 1, "weight": 90000 }
]
}
}
]
}
Start internal-only (dogfood), then 5-10% of real traffic, then ramp — watching error rate/latency at each step before increasing the percentage, the same staged-rollout discipline covered generically in blue-green-canary-deployments, here implemented at the application-logic layer instead of the infrastructure-routing layer.
Design kill-switch flags to fail safe on platform unavailability. Both SDKs stream/poll flag state to a local cache and keep serving the last-known value (or a supplied default) if the flagging service is unreachable — verify which behavior a given flag needs:
// Default value is the fail-safe: if LaunchDarkly is unreachable,
// this evaluates to `false` (recommendations stay ON) rather than
// throwing or blocking the request.
const disableRecs = await ldClient.variation(
"ops-disable-recommendations", context, false
);
For a kill switch specifically, decide deliberately which failure mode is safer: defaulting to "feature enabled" (fail open) or "feature disabled" (fail closed) depends on what the flag protects — a kill switch for a flaky third-party integration should default to disabled (fail closed) if the flag platform itself can't be reached, since the whole point is protecting against the integration being unreliable.
Track flag debt as a first-class metric, not an afterthought. Run a periodic audit (scripted against the platform's API) for flags at 100%/0% rollout for longer than a defined threshold (e.g. 30 days) with no experiment/ops tag:
# Unleash: list flags and their environment states via the Admin API
curl -s -H "Authorization: ${UNLEASH_ADMIN_TOKEN}" \
"https://unleash.internal.example.com/api/admin/projects/default/features" \
| jq '.features[] | {name, stale, lastSeenAt}'
Unleash has a built-in stale marker surfaced in its UI/API for this
exact purpose; for LaunchDarkly, use the flag's "code references"
integration (via ld-find-code-refs) plus its dashboard's
last-evaluated timestamp to spot flags no longer referenced in code but
still defined.
Retire a flag in two steps, never one, to avoid a hard cutover surprise:
Warning: Deleting a flag definition while code still references it will make the SDK evaluate to the configured default (or throw, depending on SDK/error-handling mode) — always remove the code reference before deleting the flag definition, not the other way around.
Manage flag definitions as code where the volume justifies it. LaunchDarkly's Terraform provider and Unleash's OpenAPI-driven admin API both allow flag creation/targeting rules to be defined declaratively and reviewed in a PR, the same review discipline as infrastructure-as-code-terraform applies to infrastructure:
# LaunchDarkly Terraform provider
resource "launchdarkly_feature_flag" "new_checkout" {
project_key = "checkout-service"
key = "release-new-checkout-flow"
name = "New checkout flow"
description = "Temporary rollout flag — remove after 100% for 2 weeks. Owner: checkout-team."
variation_type = "boolean"
variations {
value = true
}
variations {
value = false
}
}
Symptom: An incident kill-switch flag is flipped off, but the service keeps behaving as if it's still on. Fix: The flag is likely checked once at process startup/cached in a long-lived variable rather than evaluated per-request (or the SDK's streaming connection silently dropped and fell back to a stale cache). Evaluate the flag at the point of use, and confirm the SDK's connection/cache-refresh status is itself monitored.
Symptom: A rollout flag has been at 100% for eight months and is still in the codebase, and three more flags have since been layered on top of the same code path, producing nested conditionals nobody can reason about. Fix: This is flag debt — run the periodic stale-flag audit (step 5) and treat "flag has been at a terminal value for N days" as an actionable backlog item with the same priority as other tech debt, not a someday task.
Symptom: Two flags that are supposed to be mutually exclusive
(e.g. release-new-checkout-flow and experiment-checkout-v3) are
both enabled for the same user, and the resulting behavior is undefined.
Fix: Either consolidate into a single multivariate flag with
explicit variations, or add an application-level guard that treats
conflicting flag combinations as an error to alert on rather than
silently picking one — flag interactions should be designed
deliberately, not discovered in production.
Symptom: A flag's targeting rule change made in the platform's web console during an incident isn't reflected anywhere in version control, and nobody can explain a week later why the rule looks the way it does. Fix: For any flag whose targeting logic matters beyond a quick on/off flip, manage the definition via Terraform (LaunchDarkly) or a reviewed API script (Unleash) so changes are diffable and reviewable; reserve console/dashboard edits for genuine emergency kill-switch flips, and follow up with a PR that reconciles code-as-config with whatever was changed live.
Symptom: Choosing LaunchDarkly vs. Unleash becomes a stalled debate with no clear criteria. Fix: LaunchDarkly is a managed SaaS with a polished console, built-in experimentation/analytics, and per-seat/per-MAU pricing that scales with usage — pick it when the team wants flagging to be someone else's operational problem and budget allows. Unleash is open-source and self-hostable (or available hosted), giving full data control and no per-seat cost at the price of running/upgrading the Unleash server yourself — pick it when data residency, cost at scale, or avoiding a SaaS dependency for a request-path-adjacent system matters more than turnkey polish. Both support the same core lifecycle in this skill; the choice is an operational-ownership tradeoff, not a capability gap.
Scenario: A payments team is migrating to a new payment provider integration. They want it dark-deployed, dogfooded internally, rolled out gradually, and instantly killable if the new provider misbehaves — without redeploying.
Flag definitions (LaunchDarkly, managed via Terraform):
resource "launchdarkly_feature_flag" "new_payment_provider" {
project_key = "payments"
key = "release-new-payment-provider"
name = "New payment provider integration"
description = "Temporary rollout flag. Owner: payments-team. Remove after 100% for 2 weeks (target: 2026-09-01)."
variation_type = "boolean"
variations { value = true }
variations { value = false }
defaults {
on_variation = 1 # false — new path off by default even when flag targeting is "on"
off_variation = 1
}
}
resource "launchdarkly_feature_flag" "kill_new_payment_provider" {
project_key = "payments"
key = "ops-disable-new-payment-provider"
name = "Kill switch: force legacy payment provider"
description = "Permanent ops kill switch. Fails CLOSED (legacy provider) if unreachable. Owner: payments-team."
variation_type = "boolean"
variations { value = true }
variations { value = false }
}
Application code (Node.js, evaluating both flags at the point of use):
async function chargeCustomer(order) {
const killed = await ldClient.variation(
"ops-disable-new-payment-provider",
{ key: order.merchantId },
true // fail CLOSED: if LaunchDarkly is unreachable, force legacy path
);
const useNewProvider = !killed && await ldClient.variation(
"release-new-payment-provider",
{ key: order.merchantId, custom: { internal: order.isInternalAccount } },
false // fail-safe default: legacy provider
);
return useNewProvider
? newProviderClient.charge(order)
: legacyProviderClient.charge(order);
}
Rollout sequence: internal accounts only (via internal targeting
rule) for one week -> 10% of external merchants for three days, watching
the payment-success-rate dashboard at each step -> 50% -> 100%. Two weeks
after reaching 100% with no incident, release-new-payment-provider is
removed from code (only the newProviderClient.charge branch remains)
and its Terraform resource deleted; ops-disable-new-payment-provider
stays permanently as the team's ongoing kill switch for that integration.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
feature-flags, launchdarkly, unleash, flag-lifecycle, kill-switch
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin iac-automation-skills14 skills in this plugin
/ansible-playbook-and-role-designDesigns and safely runs Ansible playbooks, roles, and inventories for configuration management, including idempotent task design, Ansible Vault for secrets, and choosing config-management (Ansible) versus provisioning (Terraform/CloudFormation) for a given change. Use when the user asks to "write an Ansible playbook/role for X," "structure an Ansible inventory across environments," "make this task idempotent," "encrypt secrets with Ansible Vault," "dry-run a playbook before production," or "should this be Ansible or Terraform."
/aws-cloudformation-templatesAuthors and safely operates AWS CloudFormation templates (YAML/JSON), including stacks, change sets, nested and cross-stack references, StackSets for multi-account/multi-region deployment, and drift detection. Use when the user asks to "write a CloudFormation template for X," "structure nested CloudFormation stacks," "deploy the same stack across AWS accounts/regions," "review a CloudFormation change set before applying," "detect/reconcile drift on a stack," or "migrate/compare CloudFormation with Terraform" for an AWS-native IaC choice.
Other plugins' skills for the same job