[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-83bd539c-479d-4052-9385-d95c0087cbb3":3,"$fqsmect1eGpO6vEQQHRImBBi27ph_tLSbZAoqb6oLUns":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"83bd539c-479d-4052-9385-d95c0087cbb3","feature-flags-architect","使用于添加、退役或审计功能标志。在“添加标志”、“在标志后发布”、“发布计划”、“关闭开关”、“过时标志”、“标志债务”、“LaunchDarkly”、“GrowthBook”、“Statsig”、“Unleash”、“Flipt”或任何渐进式交付问题上触发。提供标志债务扫描仪、发布计划器和关闭开关审计员（所有stdlib Python），4个关于标志分类法+提供商权衡+发布策略+生命周期的参考，以及\u002Fflag-cleanup斜杠命令。","cat_writing_copywriting","mod_writing","alirezarezvani,writing","---\nname: feature-flags-architect\ndescription: Use when adding, retiring, or auditing feature flags. Triggers on \"add a flag\", \"ship behind a flag\", \"rollout plan\", \"kill switch\", \"stale flags\", \"flag debt\", \"LaunchDarkly\", \"GrowthBook\", \"Statsig\", \"Unleash\", \"Flipt\", or any progressive-delivery question. Ships flag debt scanner, rollout planner, and kill-switch auditor (all stdlib Python), 4 references on flag taxonomy + provider trade-offs + rollout strategies + lifecycle, plus a \u002Fflag-cleanup slash command.\ncontext: fork\nversion: 2.4.0\nauthor: claude-code-skills\nlicense: MIT\ntags: [feature-flags, progressive-delivery, rollout, kill-switch, launchdarkly, growthbook, statsig, unleash, flipt, release-engineering]\ncompatible_tools: [claude-code, codex-cli, cursor, antigravity, opencode, gemini-cli]\n---\n\n# Feature Flags Architect\n\nEnd-to-end discipline for feature flags: classify them, ship them, ramp them, and retire them. Most teams treat flags as throwaway `if`-statements; this skill treats them as a controlled lifecycle with measurable debt.\n\n## When to use\n\n- Adding a new flag and need a rollout plan\n- Auditing a codebase for stale or orphaned flags\n- Choosing a flag provider (LaunchDarkly vs GrowthBook vs Statsig vs Unleash vs Flipt vs build-your-own)\n- Designing a kill-switch path for a risky launch\n- Cleaning up flag debt before a release freeze\n- Reviewing whether a feature should ship behind a flag at all\n\n## Core principle: flags are a lifecycle, not an `if`\n\n```\nrequest → design → ship → ramp → cleanup → archive\n```\n\nFlags that skip cleanup become debt: dead branches, stale defaults, untested code paths, unbounded blast radius. The three scripts in this skill enforce the lifecycle.\n\n## Quick start\n\n```bash\n# 1. Audit the repo for flag debt\npython scripts\u002Fflag_debt_scanner.py --repo . --max-age-days 90\n\n# 2. Plan a progressive rollout for a new flag\npython scripts\u002Frollout_planner.py --population 100000 --target-percent 100 --duration-days 14 --strategy ring\n\n# 3. Verify every flag has a documented kill switch\npython scripts\u002Fkill_switch_audit.py --repo . --flag-doc docs\u002Ffeature-flags.md\n```\n\n## The 4 flag types (taxonomy)\n\nDifferent flag types have different lifespans and ownership. Misclassifying creates debt.\n\n| Type | Purpose | Typical lifespan | Owner | Cleanup trigger |\n|---|---|---|---|---|\n| **Release** | Hide unfinished features in production | days–weeks | Eng | 100% rollout reached |\n| **Experiment** | A\u002FB test variants | weeks | Product\u002FMarketing | Test concluded; winner picked |\n| **Operational** | Circuit breakers, perf toggles, kill switches | months–years | Eng\u002FSRE | Replaced by autoscaling\u002Ffeature retirement |\n| **Permission** | Entitlements per user\u002Faccount\u002Fplan | years (permanent) | Product | Plan\u002Frole removed |\n\nOnly Release and Experiment flags should be on a debt-scanner watchlist. Operational and Permission flags are by design long-lived. See `references\u002Fflag_taxonomy.md` for decision tree.\n\n## The 3 Python tools\n\nAll three are stdlib-only. Run with `--help`.\n\n### `flag_debt_scanner.py`\n\nFinds flags older than `--max-age-days` with low usage, suggesting candidates for cleanup.\n\n```bash\npython scripts\u002Fflag_debt_scanner.py --repo . --max-age-days 90 --format text\npython scripts\u002Fflag_debt_scanner.py --repo . --max-age-days 60 --format json > debt.json\n```\n\n**Detection heuristic:**\n1. Walk `--repo` for code references matching common flag-call patterns:\n   - `flag(\"...\")`, `isFlagEnabled(\"...\")`, `featureFlag(\"...\")`, `getFlag(\"...\")`\n   - `client.variation(\"...\", ...)`, `unleash.isEnabled(\"...\")`, `growthbook.feature(\"...\")`\n2. For each unique flag identifier, find the oldest commit that introduced it (`git log --diff-filter=A -S \u003Cname>`).\n3. Flag as DEBT if introduced > `--max-age-days` ago AND used in ≤`--min-uses` places.\n\nOutputs flag name, age in days, file references, suggested action. JSON mode is CI-friendly.\n\n### `rollout_planner.py`\n\nGenerates a phased rollout schedule from population size, target percent, duration, and strategy.\n\n```bash\npython scripts\u002Frollout_planner.py --population 100000 --target-percent 100 --duration-days 14 --strategy ring\npython scripts\u002Frollout_planner.py --population 50000 --target-percent 25 --duration-days 7 --strategy linear\npython scripts\u002Frollout_planner.py --population 1000000 --target-percent 100 --duration-days 30 --strategy log\n```\n\n**Strategies:**\n- `ring`: 1% → 5% → 25% → 50% → 100%, evenly spaced. Default for risky launches.\n- `linear`: constant rate per day. Default for medium-risk.\n- `log`: rapid early, slow tail. Default for low-risk launches with confidence.\n- `cohort`: by named cohort (internal → beta → free → paid → all).\n\nOutputs a markdown table with date, percent, expected user count, abort criteria, and verification step per phase.\n\n### `kill_switch_audit.py`\n\nCross-references code-discovered flags against documentation to verify each has a kill switch path written down.\n\n```bash\npython scripts\u002Fkill_switch_audit.py --repo . --flag-doc docs\u002Ffeature-flags.md\npython scripts\u002Fkill_switch_audit.py --repo . --flag-doc runbooks\u002Fflags.md --format json\n```\n\n**What it checks:**\n1. Every code-discovered flag has an entry in `--flag-doc`\n2. Each entry declares: owner, type, kill-switch trigger, monitoring dashboard\n3. Reports flags missing documentation (FAIL) or missing fields (WARN)\n\nUse as a pre-merge gate before any new flag ships.\n\n## Provider chooser (5 + DIY)\n\n| Provider | Best for | Pricing model | Lock-in risk | OSS option |\n|---|---|---|---|---|\n| **LaunchDarkly** | Enterprise, complex targeting, audit\u002Fcompliance | Per-MAU, expensive | High | No |\n| **GrowthBook** | Mid-market, A\u002FB testing focused, OSS-friendly | Per-MAU + OSS | Low | Yes (self-host) |\n| **Statsig** | Growth\u002Fproduct teams, advanced experimentation | Free tier + per-MAU | Medium | No |\n| **Unleash** | OSS-first, self-hosted, dev-friendly | OSS + Enterprise | Low | Yes |\n| **Flipt** | Lightweight, k8s-native, simple needs | OSS-only | None | Yes |\n| **DIY** | \u003C100 flags, no targeting, full control | None | None | N\u002FA |\n\nDecision rules:\n- \u003C50 flags + no targeting → DIY with config file or env vars\n- Need analytics + experimentation → Statsig or GrowthBook\n- Compliance\u002FSOC2 audit logs required → LaunchDarkly\n- Self-hosting required (data residency \u002F air-gapped) → Unleash or Flipt\n- See `references\u002Fprovider_comparison.md` for detail.\n\n## Workflows\n\n### Workflow 1: Ship a new feature behind a flag\n\n```\n1. Classify: which of the 4 flag types?\n   → Release (most common for engineering work)\n2. Run rollout_planner.py to design the ramp\n3. Add flag entry to docs\u002Ffeature-flags.md BEFORE writing code:\n   - name, owner, type, kill-switch trigger, dashboard URL\n4. Write the code with the flag\n5. Run kill_switch_audit.py — must pass before merge\n6. Deploy at 0%; verify kill switch works\n7. Execute rollout schedule; abort if abort criteria met\n8. At 100% for 7+ days: remove flag, delete dead branch, archive doc entry\n```\n\n### Workflow 2: Quarterly flag cleanup\n\n```\n1. Run flag_debt_scanner.py --repo . --max-age-days 90 > debt.md\n2. For each flagged item:\n   a. Confirm it reached 100% (or was killed)\n   b. Find the issue\u002FPR that introduced it; verify owner agrees to remove\n   c. Delete dead branches; remove flag config\n   d. Run kill_switch_audit.py — should now show one fewer flag\n3. Update CHANGELOG: \"Removed N stale flags\"\n```\n\n### Workflow 3: Choose a provider\n\n```\n1. Estimate flag count (current + 12-month projection)\n2. Required features:\n   - Targeting rules (user, account, geo, %)?\n   - A\u002FB testing + stats?\n   - Audit log \u002F SOC2?\n   - Self-hosting \u002F data residency?\n3. Pricing budget (MAU * cost-per-MAU)\n4. See provider_comparison.md decision tree\n5. Build a 30-day proof-of-concept before signing\n```\n\n### Workflow 4: Design a kill switch\n\n```\n1. Identify the failure modes:\n   - Latency spike (which threshold?)\n   - Error rate spike (which threshold?)\n   - Business metric regression (which threshold?)\n2. Wire each to an abort:\n   - Manual: dashboard link + on-call playbook\n   - Automated: alert threshold flips flag back to 0%\n3. Test the kill switch in staging BEFORE production rollout\n4. Document in flag-doc; pass kill_switch_audit.py\n```\n\n## References\n\n- `references\u002Fflag_taxonomy.md` — 4 types, decision tree, ownership, lifespan\n- `references\u002Fprovider_comparison.md` — LaunchDarkly \u002F GrowthBook \u002F Statsig \u002F Unleash \u002F Flipt \u002F DIY trade-offs\n- `references\u002Frollout_strategies.md` — ring \u002F linear \u002F log \u002F cohort \u002F geo, abort criteria, monitoring\n- `references\u002Fflag_lifecycle.md` — request → design → ship → ramp → cleanup → archive\n\n## Slash command\n\n`\u002Fflag-cleanup` — Run the full cleanup workflow on the current repo: scan for debt, generate a removal plan, audit kill switches.\n\n## Asset templates\n\n- `assets\u002Fflag_request_template.md` — fill-in form for new flag requests (name, owner, type, kill switch, rollout plan)\n\n## Anti-patterns\n\n- **Permanent flag with `if (FLAG_FOO)` 50 places** — should be a Permission flag with a runtime config, not a Release flag\n- **Flag with no owner** — when the original engineer leaves, no one cleans it up\n- **No kill switch documented** — when the feature breaks, no one knows how to disable it\n- **A\u002FB test that ran 6 months** — pick a winner; running indefinitely is debt\n- **Flags as feature toggles for cosmetic changes** — ship via deploy, not flag\n\n## Verifiable success\n\nA team using this skill should achieve:\n- 100% of new flags pass `kill_switch_audit.py` at merge time\n- `flag_debt_scanner.py --max-age-days 90` returns ≤5 stale flags repo-wide\n- Every flag has a documented owner, type, and kill switch\n- Mean time to retire a Release flag: \u003C60 days from 100% rollout\n","","imported","https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills","user_system_seed","SkillOPIC",true,175,358,"2026-05-16 13:53:53",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"写作研究","writing","mdi-pencil-outline","从学术写作到创意文案，让 AI 成为你的专属写作助手",1,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"文案策划","copywriting","mdi-comment-text-outline","广告文案、品牌故事、Slogan",4,72,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"bbe4c92a-1fd1-491c-81f6-1f5acdc4f97c","1.0.0","feature-flags-architect.zip",21153,"uploads\u002Fskills\u002F83bd539c-479d-4052-9385-d95c0087cbb3\u002Ffeature-flags-architect.zip","cffeb0684ccd32fabee6cc83a1e954302690f637e4cec0f031e4d455a4e117a0","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":9795},{\"path\":\"assets\u002Fflag_request_template.md\",\"isDirectory\":false,\"size\":1770},{\"path\":\"references\u002Fflag_lifecycle.md\",\"isDirectory\":false,\"size\":5869},{\"path\":\"references\u002Fflag_taxonomy.md\",\"isDirectory\":false,\"size\":4511},{\"path\":\"references\u002Fprovider_comparison.md\",\"isDirectory\":false,\"size\":5148},{\"path\":\"references\u002Frollout_strategies.md\",\"isDirectory\":false,\"size\":5024},{\"path\":\"scripts\u002Fflag_debt_scanner.py\",\"isDirectory\":false,\"size\":4827},{\"path\":\"scripts\u002Fkill_switch_audit.py\",\"isDirectory\":false,\"size\":5000},{\"path\":\"scripts\u002Frollout_planner.py\",\"isDirectory\":false,\"size\":4533}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]