agentleFS
mikezamayiasmikezamayias/agent-skills/skills/ios-distribution-feature-flags/SKILL.md

ios-distribution-feature-flags

Skill1 starsChanged 27 days agoBSD-3-ClauseView on GitHub

Makes a SwiftUI or mixed iOS app behave differently in Debug, TestFlight and App Store builds at compile time. Use to hide unfinished features, turn the paywall off for testers or support trunk-based development. It covers distribution flags, not remote kill switches.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Does not replace Swift architecture or SwiftUI skills.

    line 13
  2. Very specific:

    Leave Debug at the Xcode template value DEBUG $(inherited).

    line 19
  3. Very specific:

    If the target sets the condition list for those configurations without $(inherited), the project flags are hidden and Distribution.current …

    line 24
  4. Very specific:

    Do not ship TestFlight values (requirePaywall = false) in the App Store config.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

iOS distribution feature flags

Compile-time flags per distribution. This is not Firebase Remote Config. Use Remote Config later for runtime rollout — don't grow this enum into a server.

Does not replace Swift architecture or SwiftUI skills.

Xcode

  1. Duplicate the Release configuration to AppStore and TestFlight. Point schemes at them.
  2. Set SWIFT_ACTIVE_COMPILATION_CONDITIONS to APPSTORE $(inherited) / TESTFLIGHT $(inherited) for those configurations, at project or target level. Leave Debug at the Xcode template value DEBUG $(inherited). Neither flag is set there, so the #else branch below resolves Debug to .debug. Plain Release also sets neither flag and resolves to .debug, so archive only with AppStore or TestFlight.

Target-level values override project-level values. If the target sets the condition list for those configurations without $(inherited), the project flags are hidden and Distribution.current is always .debug.

Code

public enum Distribution: Sendable {
  case debug, appstore, testflight
  static var current: Self {
    #if APPSTORE
    .appstore
    #elseif TESTFLIGHT
    .testflight
    #else
    .debug
    #endif
  }
}

public struct FeatureFlags: Sendable {
  public let requirePaywall: Bool
  public let featureX: Bool
  public init(distribution: Distribution) {
    switch distribution {
    case .debug:      requirePaywall = true;  featureX = true
    case .testflight: requirePaywall = false; featureX = true
    case .appstore:   requirePaywall = true;  featureX = false
    }
  }
}

Declare the environment value and inject once at the root:

extension EnvironmentValues {
  @Entry var featureFlags = FeatureFlags(distribution: .current)
}

RootView()
  .environment(\.featureFlags, FeatureFlags(distribution: .current))

Views read featureFlags.requirePaywall. Incomplete work stays on main behind a flag. Delete the flag when the feature is proven in App Store.

Do not ship TestFlight values (requirePaywall = false) in the App Store config. Flags that live forever become a second product matrix.

Sources

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.