feature-flags
Designs feature-flag systems and lifecycle policy - flag taxonomy (release, ops/kill-switch, experiment, permission), percentage rollouts with stable bucketing, safe defaults, and mandatory removal deadlines so flags don't rot into dead code. Use when someone asks "how should I roll this out behind a flag", "kill switch vs feature flag", "how do I do a percentage rollout", "we have hundreds of stale flags", or is wiring up LaunchDarkly or a homegrown flag service. Do NOT use for designing the A/B test analysis itself - use ab-test-analyzer instead - and do NOT use for CI/CD pipeline gating - use github-actions instead.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 25
- Forks
- 3
01 前言 Front Matter
- name
- feature-flags
- metadata
- { "title": "Feature Flags" }
- description
- Designs feature-flag systems and lifecycle policy - flag taxonomy (release, ops/kill-switch, experiment, permission), percentage rollouts with stable bucketing, safe defaults, and mandatory removal deadlines so flags don't rot into dead code. Use when someone asks "how should I roll this out behind a flag", "kill switch vs feature flag", "how do I do a percentage rollout", "we have hundreds of stale flags", or is wiring up LaunchDarkly or a homegrown flag service. Do NOT use for designing the A/B test analysis itself - use ab-test-analyzer instead - and do NOT use for CI/CD pipeline gating - use github-actions instead.
03 SKILL.md 正文
Feature Flags
Flags decouple deploy from release: code ships dark and turns on safely, in stages, with an instant off switch. The costly mistake this skill prevents is flag debt - every flag is a fork in your codebase that doubles the test matrix, and a flag without an owner and a removal deadline set at creation becomes permanent dead code that someone flips three years later during an incident with no idea what it does.
Operating procedure
Step 1: Gather inputs
Before creating any flag, collect:
- Purpose - which of the four types below it is. If the answer is "two of them", that is two flags.
- Blast radius if the new path misbehaves (cosmetic / degraded / data-corrupting / revenue-affecting).
- Bucketing key - usually user id; sometimes account id so a whole team sees one variant.
- Owner (a person, not a team) and the removal condition.
- Safe default - the value served if the flag service is unreachable.
Step 2: Classify the flag - lifecycle follows type
- Release flag: gates unfinished or risky features during rollout. Lifetime: days to weeks. Removal deadline set at creation, maximum 90 days out; most should die within 30 days of full rollout.
- Ops flag / kill switch: disables a feature or dependency during an incident. Long-lived by design, but the inventory must stay small (a service with 50 kill switches has 50 untested code paths) and each must be re-tested on a schedule - flip it in staging at least quarterly, because an untested kill switch fails exactly when you need it.
- Experiment flag: A/B test with metrics. Lifetime equals the experiment duration plus one decision week. When the experiment concludes, the losing branch and the flag are deleted in the same PR that records the result.
- Permission flag: gates by plan or entitlement. This is not a temporary flag - it is product configuration. Model it as entitlements data, not in the same system as release flags, or it will pollute every "stale flag" report forever.
Never mix purposes in one flag; lifecycle and ownership differ.
Step 3: Implement evaluation safely
const ctx = { userId, plan, country };
if (flags.isEnabled('new-checkout', ctx)) {
renderNewCheckout();
} else {
renderOldCheckout();
}
- Evaluate with context (user, attributes) for targeting.
- Default to the safe value - usually "off" - when the flag service is unreachable. The flag SDK failing must never take the product down.
- Cache evaluations locally and stream updates; a per-request network call to the flag service puts the flag provider on your critical path.
- Flag checks must be side-effect free and fast (microseconds, from local cache).
- Evaluate on the server and pass the decision to the client to avoid UI flicker and variant mismatch.
- Log which variant served each request - you cannot debug or analyze an experiment without exposure logs.
Step 4: Roll out in rings
Percentage rollout requires hashing a stable key (user id) into buckets so a user's experience is consistent across sessions and services. Standard ring progression, with a soak period at each stage sized to the blast radius:
- Internal/employees - hours to a day.
- 1% - watch error rate and the feature's core metric for at least one business cycle (usually 24h).
- 10% - this is where load-related problems appear; soak 1-3 days.
- 50% - the largest honest A/B comparison you will ever get; capture metrics here.
- 100% - the feature is launched. Start the removal clock.
Advance only when error rate and latency for the flagged cohort are within noise of control. Roll back to the previous ring on any regression - that is the entire point of the flag.
Step 5: Remove the flag
At 100% plus the soak period, delete the flag, the old branch, and its tests in one PR. The definition of done for a flagged feature includes the flag's removal, not just its rollout.
Worked artifact: flag lifecycle record
Bad: new_checkout_v2 - created by a departed engineer, no expiry, still evaluated on every request, nobody knows if any traffic hits the old branch.
Good - every flag gets this record at creation:
FLAG: checkout-address-autocomplete
TYPE: release
OWNER: [FILL: person, not team]
CREATED: [FILL: date]
REMOVE BY: [FILL: date, max 90 days out] <- CI warns past this date
SAFE DEFAULT: off
BUCKETING KEY: userId
BLAST RADIUS: degraded (falls back to manual address entry)
ROLLOUT PLAN: internal 1d -> 1% 1d -> 10% 2d -> 50% 2d -> 100%
ROLLBACK TRIGGER: checkout completion rate drops > 0.5% vs control,
or address-service error rate > 1%
REMOVAL PR: [FILL: link when the flag dies]
Enforce the deadline mechanically: a CI check or weekly report that flags (sic) any release flag past its remove-by date, escalating to the owner's manager after 30 days overdue.
Deliverable
Produce a flag design containing: the flag's type and lifecycle record (owner, remove-by date, safe default, bucketing key), the ring rollout plan with per-ring soak times and a numeric rollback trigger, and the removal PR criteria.
Do NOT
- Do not create a flag without an owner and removal deadline - flag debt is the default outcome, not the exception.
- Do not reuse a release flag as a permanent kill switch; recreate it deliberately as an ops flag with its own testing schedule.
- Do not change experiment allocation mid-experiment or use non-sticky assignment - both invalidate the results.
- Do not nest flags into combinations (
flagA && !flagB); the test matrix goes exponential and untested interactions ship. - Do not bucket on session id or random-per-request - users flip between variants and support tickets become unreproducible.
- Do not let the flag service become a hard dependency; an outage at the provider must degrade to safe defaults, not errors.
- Do not use different bucketing keys across services - a user must see one variant everywhere.
Quality bar
- Every flag has exactly one type, one owner, a safe default, and (for release/experiment flags) a remove-by date.
- Rollout plan names rings, soak durations, and a numeric rollback trigger.
- Exposure logging is in place before the first external ring.
- Kill switches have a scheduled re-test cadence.
- A stale-flag report exists and is empty or actively burning down.
Escalation
For designing the experiment metrics and reading significance, use ab-test-analyzer. For gating deploys rather than features, use github-actions or vercel-deploy-pipeline. If a flag flip is the response to an active incident, pair with sev-triage.
04 同仓库更多 Skills
zone-2-cardio-plan
Use when someone asks to build a steady-state cardio plan, train an aerobic base or Zone 2, structure easy or endurance weekly cardio, train by heart-rate zones, or improve resting heart rate, VO2, or endurance. Builds a heart-rate-zone aerobic training block with session structure, modality choice, and progression. General fitness guidance, not medical advice. Do NOT use to design a strength or lifting program (use Strength Training Plan), high-intensity interval conditioning, HIIT, or circuits (use Conditioning & HIIT Program), or a mobility/flexibility routine (use Mobility Routine).
youtube-script-writer
Writes retention-engineered long-form YouTube scripts on a hook/body/payoff architecture - a first-30-seconds hook that survives the retention cliff, a beat-sheet body with mini-hooks and bridges, timed pattern interrupts, and a payoff that over-delivers - with B-roll and editing cues marked inline. Use when someone says "script my next video", "my retention graph dies at the start", "tighten this draft", or "outline a video on X". Do NOT use for the 3-second opener of TikTok, Reels, or Shorts - use video-hook-writer instead; do NOT use for spoken voiceover synced to on-screen tutorial actions - use narration-script instead; do NOT use for a sales demo built on a buyer's discovery notes - use demo-script instead; do NOT use to design the thumbnail and title - use thumbnail-concept instead.
win-back-campaign
Designs segmented win-back email sequences for dormant users - dormancy tiers, a three-beat sequence with a single proportional incentive, and a suppression rule - and measures success by re-activation, not opens. Use when someone says "our users went quiet", "design a win-back campaign", "how do I re-engage lapsed customers", "should we email people who haven't logged in for months", or lifecycle messaging has stopped landing with a lapsed segment. Do NOT use for recovering an unfinished checkout - use abandoned-cart-sequence instead. Do NOT use for diagnosing and fixing why active customers cancel - use churn-reduction instead. Do NOT use for building always-on onboarding or nurture flows - use email-drip-builder instead.
wikipedia-style
Writes neutral, verifiable, encyclopedic prose following Wikipedia's core content policies and manual of style - NPOV, inline citations, notability-backed claims, and a strict ban on promotional language. Use when someone asks "write this like a Wikipedia article", "draft a Wikipedia page for this company or person", "make this neutral and encyclopedic", or "why does my article draft keep getting rejected". Do NOT use for persuasive or opinion writing - use op-ed-writer instead; for thesis-driven academic papers, use academic-essay; for verifying claims in existing text, use fact-checker.
whitepapers
Structures and writes authoritative B2B whitepapers - a standalone executive summary, a data-sized problem statement, methodology, evidence-driven findings, recommendations, and a soft call to action - flagging every claim that needs a real citation. Use when a marketer asks "write a whitepaper on this topic", "turn our research into a lead-gen asset", "make this credible enough for executives", or a draft reads like a product pitch instead of analysis. Do NOT use for customer-story-driven proof - use case-study-builder instead; for policy audiences, use policy-brief.
white-space-analysis
Finds unmet market gaps by ranking jobs-to-be-done on importance versus satisfaction, overlaying them against current solutions and workarounds, and validating that each gap is real, winnable, and worth winning. Use when someone asks "where are the gaps in this market", "what's underserved here", "where should we play next", or is hunting for product, feature, or market-entry opportunities. Do NOT use for profiling competitors and building battle cards - use competitive-intelligence instead; for putting a dollar figure on an identified opportunity - use market-sizing instead; for extracting jobs-to-be-done from raw customer interviews - use jtbd-extractor instead.