ddg-add-feature-flag
Skill275 starsChanged 4 days agoApache-2.0View on GitHub
Use when adding, removing or changing a feature flag or an A/B/N experiment on iOS or macOS.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .maestro/AGENTS.mdAGENTS.md
- ddg-add-pixelSkill
- ddg-apple-feedback-reviewSkill
- ddg-design-systemSkill
- ddg-diagnose-ci-failureSkill
- ddg-drk-add-iconSkill
- ddg-macos-add-promoSkill
- ddg-sentry-reportSkill
- ddg-xcode-add-fileSkill
- verify-iosSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Keep supportsLocalOverriding at its default true unless the flag must not be toggled from the debug menu.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add or change a feature flag
Flags live in FeatureFlag.swift in iOS/LocalPackages/FeatureFlags-iOS/Sources/FeatureFlags/ and
macOS/LocalPackages/FeatureFlags-macOS/Sources/FeatureFlags/. Copy the shape of the neighbouring
cases; the steps below cover what the neighbours don't show.
- Get the flag's Asana task URL from the user. The flag case carries it as a
///doc comment, and so does its subfeature. - Add the subfeature the remote config controls:
- iOS only:
iOSBrowserConfigSubfeature.swift, next toFeatureFlag.swift. - macOS only:
MacOSBrowserConfigSubfeatureinSharedPackages/BrowserServicesKit/Sources/PrivacyConfig/Features/PrivacyFeature.swift. - A feature with its own parent, such as
AIChatSubfeature: that parent's enum in the samePrivacyFeature.swift.
- iOS only:
- Add the flag case and its
Config(...)entry in theconfigswitch.sourceis.remoteReleasable(<Subfeature>.case), or.disabledto switch the flag off everywhere.defaultValueapplies only while the remote config doesn't list the subfeature. Once the config lists it, the config decides for everyone, internal users included..internalOnlyis the usual starting point.- Keep
supportsLocalOverridingat its defaulttrueunless the flag must not be toggled from the debug menu. macOS UI tests crash at launch when they set a flag that doesn't allow it. - macOS: pass
category:(FeatureFlagCategory.swift) to group the flag in the debug menu.
- Gate the code with
featureFlagger.isFeatureOn(.flag)on an injectedFeatureFlagger. On iOS, pass the existing flagger from the owner or caller. Do not addAppDependencyProvideraccess or use it in default arguments. During launch, place gated work where the existing flagger is available instead of initializing the dependency provider earlier. When the flag picks between two UI implementations that bind at launch, read it once at startup instead, asFireModeCapability.resolve(using:)does inMainCoordinator, so a mid-session toggle can't leave the UI half-switched. - Experiment (A/B/N):
- Nest a
<Name>Cohort: String, FeatureFlagCohortDescribingenum inFeatureFlagand pass it ascohortType:. featureFlagger.resolveCohort(for: .flag)enrolls the device, so call it only where the user meets the difference. Anywhere else, read withassignedCohort(for:), which never enrolls.- Fire metrics with
PixelKit.fireExperimentPixel(PixelExperimentKit), and declare them under the experiment in{iOS,macOS}/PixelDefinitions/pixels/native_experiments.json5.
- Nest a
- Test both states with the platform's mock: on iOS,
MockFeatureFlagger(enabledFeatureFlags: [.flag])fromiOS/SharedTestUtils; on macOS and in SharedPackages, the PrivacyConfigMockFeatureFlaggerwithfeaturesStub[flag.rawValue]set. - Tell the user that the rollout happens in the
duckduckgo/privacy-configurationrepository, under the subfeature name from step 2. The embedded config files in this repository are generated copies, so editing them turns nothing on.
Done when the flag compiles on every platform it targets, both of its states are tested, and the user has the subfeature name to add to privacy-configuration.
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.

