Feature flag strategy, lifecycle, and operations, with three scripts: audit flag debt against a control-plane export, simulate a rollout ramp, generate a kill-switch runbook. Use when designing a flag taxonomy, planning a gradual rollout, building kill switches, auditing stale or orphaned flags, defining flag governance, or rolling back via flags.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Feature Flags Architect?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/borghei-feature-flags-architect)
---
name: feature-flags-architect
description: >
Feature flag strategy, lifecycle, and operations, with three scripts: audit flag debt against a
control-plane export, simulate a rollout ramp, generate a kill-switch runbook. Use when designing
a flag taxonomy, planning a gradual rollout, building kill switches, auditing stale or orphaned
flags, defining flag governance, or rolling back via flags.
license: MIT + Commons Clause
metadata:
version: 1.2.0
author: borghei
category: engineering
domain: engineering
updated: 2026-11-08
tags: [feature-flags, progressive-delivery, rollouts, kill-switches, release-engineering, experimentation, flag-governance]
---
# Feature Flags Architect
End-to-end feature flag design, rollout, and lifecycle management. Covers flag taxonomy (release vs ops vs experiment vs permission), gradual rollout patterns with blast-radius math, kill-switch runbooks, governance (who can flip what), and the flag-debt cleanup loop that keeps a codebase from drowning in stale flags.
This skill is provider-agnostic: the patterns work whether you run LaunchDarkly, Statsig, Unleash, Flagsmith, ConfigCat, GrowthBook, OpenFeature, or a homegrown system backed by Redis/DynamoDB/Postgres.
## Core Capabilities
- **Flag taxonomy** — classify every flag as one of four types (release, ops, experiment, permission); the type sets lifetime, who flips it, and auto-expiry.
- **Rollout ramps** — dogfood → canary → 100% schedules with per-step blast-radius math and ramp templates by change type.
- **Kill switches** — ops-flag pattern with fail-open/closed decisions, runbooks, and alerting for risky dependencies or code paths.
- **Governance** — role-based who-can-flip-what matrix plus audit-log/retention requirements, mappable onto any flag system.
- **Flag debt cleanup** — quarterly inventory → classify → decide → execute → measure loop to keep flag count flat or shrinking.
- **End-to-end workflows** — add a release flag, build a kill switch, audit flag debt, flag-based rollback after a bad release.
## Flag taxonomy — the four types
Every flag belongs to exactly one of these four types. The type determines the lifecycle, who can flip it, and whether it should auto-expire. Mixing types in one flag is a root cause of flag debt.
| Type | Purpose | Lifetime | Who flips | Auto-expire? |
|------|---------|----------|-----------|--------------|
| **Release** | Decouple deploy from release. Ship code dark, ramp to users. | Days to weeks | Engineer who owns the feature | Yes — remove after 100% rollout + 1 release |
| **Ops** | Kill switches, circuit breakers, throttles. Turn off risky behavior fast. | Permanent or long-lived | Oncall / SRE / platform team | No — but review quarterly |
| **Experiment** | A/B test, multi-arm bandit, hold-out group. Measure causal impact. | Weeks to months (test duration) | Product / data / growth | Yes — remove after winner is shipped |
| **Permission** | Entitle users to features based on plan, role, beta-list. | Permanent | Product / billing | No — but consolidate into entitlement system |
**Decision rule when adding a flag:** name the type. If you can't, the flag shouldn't exist yet — clarify intent first.
## When to Use
- Designing a flag system from scratch — start with the **flag taxonomy**.
- Planning a risky release (DB migration, payment-provider swap, framework upgrade) — use the **rollout ramp** + **kill switch**.
- Auditing a codebase with hundreds of growing flags — use **flag debt cleanup** + `scripts/flag_audit.py`.
- Setting up an A/B test or hold-out — covers the flag side; use `data-analytics/statistical-analyst` for sample size and significance.
- Building a kill switch for a third-party dependency outage — use the **kill switch runbook** generator.
- Defining who in the org can flip production flags — use the **governance** matrix.
- Building entitlements / paid-tier gating — use this for flag mechanics; `business-growth/paywall-upgrade-cro` for the UX.
## Clarify First
Before designing or operating flags, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
- **Flag type:** release, ops, experiment, or permission (sets the lifecycle, who can flip it, and auto-expiry — the root decision).
- **Task:** design a taxonomy, simulate a rollout ramp, generate a kill-switch runbook, or audit flag debt (selects `flag_audit.py` vs `rollout_simulator.py` vs `kill_switch_runbook.py`).
- **Blast radius / population:** user count and ramp profile, or the dependency a kill switch guards (drives `--users`/`--profile` and the runbook content).
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
## Workflow
1. **Name the type** of every new flag (release, ops, experiment, permission) and give it an owner and, for release and experiment flags, a removal date.
2. **Plan the ramp** with `rollout_simulator.py` for the user count and risk profile; each step needs the metric that would stop it.
3. **Build the kill switch** for risky dependencies with `kill_switch_runbook.py`, passing the real owner team, oncall rotation and flag-console URL so the runbook has no placeholders.
4. **Audit debt** quarterly with `flag_audit.py` against a control-plane export: delete dead flags, remove stranded 100% release flags and their dead branches, investigate orphan references.
5. **Verify** that the kill switch actually flips in staging (or under fault injection) and that the audit's debt list shrinks quarter over quarter.
## Quick Start
Run from the skill folder; the sample files are in `assets/`.
```bash
python3 scripts/flag_audit.py --path assets/flawed_checkout.ts --flag-export assets/flawed_flag_export.json --as-of 2026-06-01
python3 scripts/rollout_simulator.py --users 500000 --profile standard
python3 scripts/kill_switch_runbook.py --flag ops.recs.kill_switch --feature Recommendations --dependency recs-svc \
--owner-team recs-team --oncall recs-oncall --flag-console-url https://flags.example.com/flags/ops.recs.kill_switch
```
Real output of the first command (excerpt, exit code 1):
```text
Read: 1 source file(s) scanned, 4 flag read(s) found; 4 export entries read
By category:
active_healthy 2
stranded_at_100 1
orphan_reference 1
dead_unreferenced 1
[dead_unreferenced] release.holiday_theme
Type: release Owner: web-team Value(prod): off Days at value: 154
Fix: Delete `release.holiday_theme` in the flag console: no code reads it.
[stranded_at_100] release.old_banner
Type: release Owner: growth-team Value(prod): 100% Days at value: 210
Fix: Release flag `release.old_banner` at 100% for 210 days (> 30, heuristic). Delete the flag and keep the enabled branch at the reads listed below.
@ assets/flawed_checkout.ts:7 const banner = getFlag("release.old_banner"); // shipped to 100% long ago
FIX 3 flags with debt
```
## Tools Overview
| Tool | What it does | Key flags |
|------|--------------|-----------|
| `flag_audit.py` | Find flag reads in code (file or directory), join with a control-plane export, classify each flag (dead, orphan, stranded at 0/100%, should-be-config, no owner, healthy) with a fix and up to three ranked next actions | `--path`, `--flag-export`, `--as-of`, `--pattern <regex>` (repeatable, group 1 = key), `--owner-team`, `--include-active`, `--format text\|json\|markdown`, `--output` |
| `rollout_simulator.py` | Per-step exposure, schedule, stop thresholds; blast radius when you give session and detection numbers; lints custom ramps (descending, jumps over 10x, no canary, never reaching 100%) | `--users`, `--profile`, `--custom-steps`, `--sessions-per-user-per-day`, `--time-to-detect`, `--time-to-mitigate`, `--baseline-error-rate`, `--baseline-latency-p99-ms`, `--severity`, `--format text\|json` |
| `kill_switch_runbook.py` | Runbook: default state, fail mode, flip procedure, validation, flip-back, escalation, test schedule | `--flag`, `--feature`, `--dependency`, `--owner-team`, `--oncall`, `--flag-console-url` (all required), `--fail-mode open\|closed`, `--error-threshold-pct`, `--latency-threshold-ms`, `--error-window-min`, `--format text\|json` |
Always pass `--flag-export` to `flag_audit.py`: without it only code reads are found, dead, stranded and orphan checks are skipped, and the run reports no debt (exit 0). An empty `--path` and bad argument values exit 2 with a one-line message.
All three accept `--output <file>` and a legacy `--json` alias for `--format json`.
### Exit codes
| Tool | 0 | 1 | 2 |
|------|---|---|---|
| `flag_audit.py` | no flag debt | debt found (report still printed) | path missing, no source files and no export, no flag reads and no export, unreadable/empty/wrong-shape export, owner not in export, bad `--pattern` or `--as-of` |
| `rollout_simulator.py` | plan produced | custom ramp has problems (plan still printed) | `--users` not above 0, bad or out-of-range `--custom-steps`, bad date, negative inputs |
| `kill_switch_runbook.py` | runbook generated | not used | empty value, spaces in the flag key, console URL that is not a real http(s) URL (placeholders like `<...>` are rejected), out-of-range threshold |
Every text run ends with a verdict line (`PASS ...` or `FIX n ...`); JSON carries it under `verdict`.
### What the tools will not invent
- `flag_audit.py` reports files scanned, flag reads found and export entries read. A flag with no `lastModified` is reported as age unknown and skipped by the stale checks, not treated as new. The 30-day (stranded) and 180-day (should be config) limits are heuristics and say so in each finding. Recognised SDKs: LaunchDarkly (`variation`, `boolVariation`), OpenFeature (`getBooleanValue`, `useBooleanFlagValue`), Statsig (`checkGate`), Unleash (`isEnabled`), generic `flags.isEnabled/evaluate/getVariant`, homegrown helpers (`getFlag`, `useFlag`, `isFeatureEnabled`, `get_feature_flag`) and flag decorators; for others pass `--pattern`. Flags read through variables built at runtime are not found.
- `rollout_simulator.py`: the ramp profiles and stop multipliers are heuristic templates, not benchmarks. Blast radius (`AT_RISK`) and absolute stop thresholds print only when you pass the inputs; otherwise they read `n/a` / `not computed`.
- `kill_switch_runbook.py`: flip triggers with numbers appear only if you pass them; unset ones are written into the runbook as `NOT SET`. The 30-minute flip-back and post-mortem figures are labelled suggestions.
## Anti-Patterns
**Mistake:** Release flags without a removal date.
**Why it happens:** Once the feature is at 100%, removing the flag has no visible payoff.
**Instead:** Set the date when the flag is created and let the quarterly audit enforce it; stranded flags double the code paths to test.
**Mistake:** A kill switch that has never been flipped.
**Why it happens:** It exists for emergencies, so nobody tries it.
**Instead:** Flip it in staging on a schedule (or under fault injection) and record the time to effect.
**Mistake:** One flag doing two jobs (a release ramp that later becomes a permission gate).
**Why it happens:** Reusing an existing flag is quicker than creating one.
**Instead:** Create a new flag of the right type. Mixed-type flags cannot be removed without breaking someone.
## Files
- `scripts/flag_audit.py`, `scripts/rollout_simulator.py`, `scripts/kill_switch_runbook.py` — the tools above.
- `assets/sample_checkout.ts` + `assets/sample_flag_export.json` (sound, exit 0); `assets/flawed_checkout.ts` + `assets/flawed_flag_export.json` (stranded, dead and orphan flags, exit 1); `assets/malformed_flag_export.json` (exit 2); `assets/contract.json` (the runs `scripts/skill_contract_check.py` replays).
## Reference Documentation
Load the reference that matches the task — keep this file lean and pull detail on demand:
- **[references/flag-types-and-patterns.md](references/flag-types-and-patterns.md)** — the four flag types in depth, code patterns per type, evaluation-context schema, naming conventions, server-vs-client trade-offs, and storage models. Read when designing a flag system or writing the gating code.
- **[references/operations-governance-and-workflows.md](references/operations-governance-and-workflows.md)** — the standard ramp table, blast-radius math, kill-switch design, the governance matrix + audit-log requirements, the flag-debt cleanup loop, all four end-to-end workflows, the anti-patterns list, and the tooling input/output reference. Read when running a rollout, defining governance, or executing a workflow.
- **[references/rollout-and-kill-switch-playbook.md](references/rollout-and-kill-switch-playbook.md)** — rollout decision tree, ramp templates by change type, cohort/segment selection, kill-switch design, and monitoring/alerting hookup. Read when planning a specific ramp or wiring kill-switch alerting.
- **[references/flag-debt-and-cleanup.md](references/flag-debt-and-cleanup.md)** — what flag debt costs, the cleanup cadence, dead-code detection, safe removal procedures, PR templates, and governance for flag count. Read when paying down stale flags.
## Scope & Limitations
**This skill covers:** flag taxonomy and lifecycle, rollout ramps with blast-radius math, kill-switch design and runbooks, governance/audit requirements, and flag-debt cleanup — provider-agnostic across LaunchDarkly, Statsig, Unleash, Flagsmith, ConfigCat, GrowthBook, OpenFeature, and homegrown systems.
**This skill does NOT cover:** the statistical design of A/B tests (`data-analytics/statistical-analyst`), the paywall/upgrade UX for entitlements (`business-growth/paywall-upgrade-cro`), or the metric instrumentation needed to make ramp decisions (`engineering/observability-designer`).
## Related skills
- `engineering/observability-designer` — wire the metrics needed to make ramp decisions
- `engineering/incident-commander` — flag-based rollback during incidents
- `engineering/chaos-engineering` — verify kill switches actually work under fault injection
- `data-analytics/statistical-analyst` — sample size and significance for A/B tests behind flags