Implement feature flags (toggles) for controlled feature rollouts, A/B testing, canary deployments, and kill switches. Use when deploying new features gradually, testing in production, or managing feature lifecycles.
Implement feature flags to decouple deployment from release, enable gradual rollouts, A/B testing, and provide emergency kill switches.
Minimal working example:
interface FlagConfig {
key: string;
enabled: boolean;
description: string;
rules?: FlagRule[];
variants?: FlagVariant[];
createdAt: Date;
updatedAt: Date;
}
interface FlagRule {
type: "user" | "percentage" | "attribute" | "datetime";
operator: "in" | "equals" | "contains" | "gt" | "lt" | "between";
attribute?: string;
values: any[];
}
interface FlagVariant {
key: string;
weight: number;
value: any;
}
interface EvaluationContext {
userId?: string;
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | Feature Flag Service (TypeScript) | Feature Flag Service (TypeScript) | | React Hook for Feature Flags | React Hook for Feature Flags | | Feature Flag with Analytics | Feature Flag with Analytics | | LaunchDarkly-Style SDK | LaunchDarkly-Style SDK | | Admin UI for Feature Flags | Admin UI for Feature Flags |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/feature-flag-system · pinned to the source commit
git clone https://github.com/aj-geddes/useful-ai-prompts.git
cd useful-ai-prompts
git checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills/feature-flag-system"
cp -r "skills/feature-flag-system" ".claude/skills/feature-flag-system"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
No static rules matched. This is not a safety guarantee.