feature-flags
Skill777 starsChanged 5 months agoMITView on GitHub
Generate feature flag infrastructure with local defaults, remote configuration, SwiftUI integration, and debug menu. Use when adding feature flags or A/B testing to iOS/macOS apps.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- marcus/sidecartheir own version, first seen Oct 4, 2026
- growthbook/skillstheir own version, first seen Sep 30, 2026
- Cure-Consulting-Group/ProductEngineeringSkillstheir own version, first seen Sep 28, 2026
- irahardianto/awesome-agvtheir own version, first seen Aug 21, 2026
- 2867203296/hermes-agenttheir own version, first seen Aug 19, 2026
- shinzoxD/knackboxtheir own version, first seen Jul 10, 2026
Used with
Projects with it also use data-visualization and git-workflow.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkilldata-visualization
Create effective data visualizations with Python (matplotlib, seaborn, plotly). Use when building charts, choosing the right chart type for a dataset, creating publication-quality figures, or applying design principles like accessibility and color theory.
Also in 3 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- getsentry/sentry★ 45ksame name
- marcus/sidecar★ 1.1ksame name
- irahardianto/awesome-agv★ 157same name
- wshaddix/dotnet-skills★ 79same name
- ahmed3elshaer/everything-claude-code-mobile★ 66same name
- growthbook/skills★ 23same name
- roanbrasil/engineer-grade-agent-skills★ 8same name
- YepAPI/skills★ 8same name
- Cure-Consulting-Group/ProductEngineeringSkills★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository183 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- app-intentsSkill
- foundation-modelsSkill
- apple-intelligenceSkill
- visual-intelligenceSkill
- ad-attributionSkill
- app-description-writerSkill
- apple-search-adsSkill
- iap-finalizerSkill
- keyword-optimizerSkill
- marketing-strategySkill
- originality-checkSkill
- ratings-mechanicsSkill
- rejection-handlerSkill
- review-response-writerSkill
- screenshot-plannerSkill
- app-storeSkill
- web-presenceSkill
- core-mlSkill
- animation-patternsSkill
- game-feelSkill
- liquid-glassSkill
- sf-symbolsSkill
- designSkill
- typographySkill
- ui-prototypingSkill
- ux-writingSkill
- attributed-stringSkill
- foundationSkill
- accessibility-generatorSkill
- account-deletionSkill
- analytics-setupSkill
- announcement-bannerSkill
- app-clipSkill
- app-extensionsSkill
- app-icon-generatorSkill
- app-store-assetsSkill
- auth-flowSkill
- background-processingSkill
- ci-cd-setupSkill
- cloudkit-syncSkill
- consent-flowSkill
- custom-product-pagesSkill
- data-exportSkill
- debug-menuSkill
- deep-linkingSkill
- error-monitoringSkill
- featuring-nominationSkill
- feedback-formSkill
- force-updateSkill
- http-cacheSkill
- image-loadingSkill
- in-app-eventsSkill
- lapsed-userSkill
- live-activity-generatorSkill
- localization-setupSkill
- logging-setupSkill
- milestone-celebrationSkill
- networking-layerSkill
- offer-codes-setupSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 0 are common, 16 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill when the user:
- Distinctive: line 35
Search for existing feature flag code:
- Distinctive: line 41
If existing feature flag code is found:
- Distinctive: line 42
Ask whether to replace or extend the existing implementation
- Distinctive: line 43
Check for flag names or enum cases that could conflict
- Distinctive: line 45
If a third-party SDK (Firebase, LaunchDarkly, etc.) is detected:
- Distinctive: line 46
Ask if the user wants a standalone implementation or a wrapper around the SDK
- Distinctive: line 53
No special Info.plist entries needed
- Distinctive: line 57
Ask user via AskUserQuestion:
- Very specific: line 87
If Sources/ exists --> Sources/FeatureFlags/
- Distinctive: line 106
Use the templates in templates.md and customize based on user answers:
- Distinctive: line 218
Debug menu: Run in DEBUG builds, navigate to the debug menu, and toggle flags to verify behavior.
- Distinctive: line 219
Remote provider: Use a local JSON file served via a test server or mock URLProtocol to test remote fetching.
- Distinctive: line 233
Use string values to serve different text or configuration strings remotely.
- Distinctive: line 277
Stale flags: Always provide sensible local defaults.
- Distinctive: line 278
Flag cleanup: After a feature is fully rolled out, remove the flag enum case, delete related conditional code, and clean up remote …
- Distinctive: line 280
Testing both paths: When a flag controls a UI branch, write tests (or at least manual test plans) for both the enabled and disabled paths.
- Very specific: line 283
UserDefaults key collisions: All flag keys are prefixed with ff_ to avoid collisions with other UserDefaults entries in the app.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Feature Flags Generator
Generate a complete feature flag infrastructure with typed flag definitions, protocol-based providers (local, remote, composite), SwiftUI environment integration, an @Observable manager, and a debug menu for toggling flags at runtime.
When This Skill Activates
Use this skill when the user:
- Asks to "add feature flags" or "add feature toggles"
- Mentions A/B testing or gradual rollouts
- Asks about Firebase Remote Config or similar remote configuration
- Wants to disable features without shipping an app update
- Mentions "kill switches" or "feature gates"
- Wants to control features remotely for a subset of users
- Asks for a debug menu to toggle features during development
Pre-Generation Checks
1. Project Context Detection
- Check for existing feature flag implementations
- Check for Firebase Remote Config or third-party flag SDKs
- Identify source file locations (Sources/, App/, or root)
- Verify minimum deployment target (iOS 17+ / macOS 14+ for @Observable)
2. Conflict Detection
Search for existing feature flag code:
Glob: **/*FeatureFlag*.swift, **/*FeatureToggle*.swift, **/*RemoteConfig*.swift
Grep: "FeatureFlag" or "FeatureToggle" or "RemoteConfig" or "isFeatureEnabled"If existing feature flag code is found:
- Ask whether to replace or extend the existing implementation
- Check for flag names or enum cases that could conflict
If a third-party SDK (Firebase, LaunchDarkly, etc.) is detected:
- Ask if the user wants a standalone implementation or a wrapper around the SDK
3. Required Capabilities
Feature flags require:
- iOS 17+ / macOS 14+ deployment target (for @Observable manager)
- Network access entitlement if using remote flags
- No special Info.plist entries needed
Configuration Questions
Ask user via AskUserQuestion:
- What features do you want to flag? (freeform)
- Examples: new onboarding, premium paywall, experimental UI, dark mode v2
- This determines the flag enum cases and their default values
- What flag value types do you need?
- Boolean only (feature on/off)
- Boolean + String (on/off plus string configuration)
- Boolean + String + Integer (full typed support)
- Boolean + String + Integer + JSON (for complex configurations)
- What provider architecture?
- Local only -- UserDefaults-based with compile-time defaults
- Remote only -- JSON endpoint with local caching
- Composite (recommended) -- Local defaults with remote override; remote wins when available
- Include debug menu?
- Yes -- SwiftUI view for toggling flags at runtime (DEBUG builds only)
- No -- Skip the debug view
- Include SwiftUI environment integration?
- Yes (recommended) -- Inject the flag manager via SwiftUI Environment
- No -- Use the manager directly
Generation Process
Step 1: Determine File Locations
Check project structure:
- If
Sources/exists -->Sources/FeatureFlags/ - If
App/exists -->App/FeatureFlags/ - Otherwise -->
FeatureFlags/
Step 2: Create Core Files
Generate these files based on configuration answers:
FeatureFlag.swift-- Flag enum with typed default valuesFeatureFlagService.swift-- Protocol defining provider interfaceLocalFeatureFlagProvider.swift-- UserDefaults-based provider with debug overridesRemoteFeatureFlagProvider.swift-- URL-based provider with disk caching (if remote or composite)CompositeFeatureFlagProvider.swift-- Combines local + remote; remote overrides local (if composite)FeatureFlagManager.swift-- @Observable manager for SwiftUIFeatureFlagEnvironmentKey.swift-- SwiftUI Environment integration (if requested)FeatureFlagDebugView.swift-- Debug toggle view (if requested)
Step 3: Generate Code from Templates
Use the templates in templates.md and customize based on user answers:
- Replace placeholder flag cases with real feature names
- Set appropriate default values per flag
- Include or exclude remote/composite providers based on architecture choice
- Include or exclude typed value methods (string, int, JSON) based on type selection
- Include or exclude environment key and debug view
Output Format
After generation, provide:
Files Created
Sources/FeatureFlags/
├── FeatureFlag.swift # Flag enum with typed defaults
├── FeatureFlagService.swift # Provider protocol
├── LocalFeatureFlagProvider.swift # UserDefaults-based provider
├── RemoteFeatureFlagProvider.swift # URL-based provider (if remote/composite)
├── CompositeFeatureFlagProvider.swift # Local + remote combiner (if composite)
├── FeatureFlagManager.swift # @Observable manager for SwiftUI
├── FeatureFlagEnvironmentKey.swift # SwiftUI Environment key (if requested)
└── FeatureFlagDebugView.swift # Debug toggle menu (if requested)Integration Steps
1. Initialize the manager in your App struct or entry point:
import SwiftUI
@main
struct MyApp: App {
@State private var featureFlagManager: FeatureFlagManager
init() {
// Local only
let provider = LocalFeatureFlagProvider()
// Or composite (remote overrides local)
// let provider = CompositeFeatureFlagProvider(
// local: LocalFeatureFlagProvider(),
// remote: RemoteFeatureFlagProvider(
// endpoint: URL(string: "https://api.example.com/flags")!
// )
// )
_featureFlagManager = State(initialValue: FeatureFlagManager(provider: provider))
}
var body: some Scene {
WindowGroup {
ContentView()
.environment(featureFlagManager)
}
}
}2. Use flags in your views:
struct ContentView: View {
@Environment(FeatureFlagManager.self) private var flags
var body: some View {
VStack {
if flags.isEnabled(.newOnboarding) {
NewOnboardingView()
} else {
LegacyOnboardingView()
}
}
}
}3. Refresh remote flags (if using remote or composite):
// Refresh on app launch or periodically
Task {
try await featureFlagManager.refresh()
}4. Add debug menu (if generated, DEBUG builds only):
#if DEBUG
NavigationLink("Feature Flags") {
FeatureFlagDebugView()
.environment(featureFlagManager)
}
#endifTesting Instructions
- Unit test providers independently: Each provider conforms to
FeatureFlagServiceand can be tested in isolation. - Mock provider for previews and tests:
final class MockFeatureFlagProvider: FeatureFlagService { var overrides: [FeatureFlag: Bool] = [:] func isEnabled(_ flag: FeatureFlag) -> Bool { overrides[flag] ?? flag.defaultValue } // ... implement remaining protocol methods } - Debug menu: Run in DEBUG builds, navigate to the debug menu, and toggle flags to verify behavior.
- Remote provider: Use a local JSON file served via a test server or mock URLProtocol to test remote fetching.
Common Patterns
Boolean Flags (Kill Switches)
The most common pattern. Enable or disable a feature entirely.
if flags.isEnabled(.premiumPaywall) {
PremiumPaywallView()
}String Flags (Copy Variants / A/B Testing)
Use string values to serve different text or configuration strings remotely.
let welcomeMessage = flags.stringValue(.welcomeMessage) ?? "Welcome!"
Text(welcomeMessage)Integer Flags (Thresholds / Limits)
Control numeric parameters like retry counts, page sizes, or rate limits.
let maxRetries = flags.intValue(.maxRetries) ?? 3JSON Flags (Complex Configuration)
For structured configuration that changes server-side.
struct PaywallConfig: Codable {
let title: String
let trialDays: Int
let showTestimonials: Bool
}
if let config: PaywallConfig = flags.jsonValue(.paywallConfig) {
PaywallView(config: config)
}Gradual Rollout
Combine feature flags with user segmentation.
// Server returns different flag values per user segment
// The flag is simply on/off from the client perspective
if flags.isEnabled(.newCheckoutFlow) {
NewCheckoutView()
} else {
LegacyCheckoutView()
}Gotchas
- Stale flags: Always provide sensible local defaults. If the remote fetch fails, the app must still function correctly with local values.
- Flag cleanup: After a feature is fully rolled out, remove the flag enum case, delete related conditional code, and clean up remote configuration. Stale flags accumulate technical debt.
- Thread safety: The generated
FeatureFlagManageris@MainActor-isolated. Access it on the main thread or via@Environmentin SwiftUI views. The providers useSendable-conforming storage. - Testing both paths: When a flag controls a UI branch, write tests (or at least manual test plans) for both the enabled and disabled paths. It is easy to forget the disabled path once a flag has been on for weeks.
- Debug overrides in production: The debug override mechanism uses
#if DEBUGguards. Double-check that debug toggles never leak into release builds. - Cache invalidation: The remote provider caches to disk. Set an appropriate
cacheDuration(default 5 minutes). For time-sensitive flags, callrefresh()explicitly. - UserDefaults key collisions: All flag keys are prefixed with
ff_to avoid collisions with other UserDefaults entries in the app.
References
- templates.md -- Production-ready Swift templates for all generated files
- Feature Toggles (Martin Fowler)
- Firebase Remote Config
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

