- Home
- Skills
- Rshankras
- Claude Code Apple Skills
- Feature Flags
feature-flags_skill
- Swift
56
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill rshankras/claude-code-apple-skills --skill feature-flags- SKILL.md10.0 KB
- templates.md29.4 KB
Overview
This skill generates a complete feature flag infrastructure for iOS/macOS apps with typed flag definitions, local defaults, optional remote configuration, SwiftUI integration, and an in-app debug menu. It scaffolds provider protocols, local and remote providers, a composite provider, an @Observable manager, and optional SwiftUI environment keys and debug views to toggle flags at runtime.
How this skill works
The generator inspects project structure and deployment target, then creates core files: a typed FeatureFlag enum, provider protocol, Local/Remote/Composite providers, a FeatureFlagManager (@Observable) and optional SwiftUI Environment key and debug view. Local defaults live in UserDefaults, remote values come from a JSON endpoint with disk caching, and the composite provider lets remote values override local defaults. The manager exposes typed accessors (bool, string, int, JSON) and runtime refresh methods.
When to use it
- Adding feature toggles or kill switches to enable/disable features without an update
- Implementing A/B tests, copy variants, or gradual rollouts
- Integrating remote configuration (Firebase Remote Config–like) with local fallbacks
- Needing a DEBUG-only in-app debug menu to toggle flags at runtime
- Injecting feature flags into SwiftUI via Environment for reactive UI changes
Best practices
- Provide sensible local defaults so the app is safe if remote fetch fails
- Prefer composite provider: local defaults with remote overrides for reliability
- Use typed flag values (bool/string/int/json) to avoid ad-hoc parsing at call sites
- Keep debug overrides gated by #if DEBUG so they never ship to production
- Remove flag cases and related code after full rollout to avoid technical debt
Example use cases
- Toggle a new onboarding flow with flags.isEnabled(.newOnboarding)
- Serve alternative copy using flags.stringValue(.welcomeMessage) for A/B testing
- Adjust numeric thresholds like retry counts via flags.intValue(.maxRetries)
- Fetch structured paywall settings with flags.jsonValue(.paywallConfig)
- Provide a debug menu in DEBUG builds to flip flags during development
FAQ
The generated manager uses @Observable, so iOS 17+ or macOS 14+ is required. Providers themselves have no special OS requirements.
Can this wrap an existing remote SDK like Firebase?
Yes. If a third-party SDK is detected or preferred, generate a wrapper provider that implements the FeatureFlagService protocol and translates SDK values into the typed API.
How are flags cached and refreshed?
Remote provider caches JSON to disk with a configurable cacheDuration (default 5 minutes). Call manager.refresh() to force a fetch. Composite provider uses remote values when available, otherwise local defaults.