Feature flag system

From aj-geddes/useful-ai-prompts · View interactive version

Feature flag system is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. 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.

How to use this skill

Skill file

Feature Flag System

Table of Contents

Overview

Implement feature flags to decouple deployment from release, enable gradual rollouts, A/B testing, and provide emergency kill switches.

When to Use

Quick Start

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)

Reference Guides

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 |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.