agentleFS
fatihkanfatihkan/badi/.claude/skills-vault/expo-app-config/SKILL.md

expo-app-config

Skill8 starsChanged 3 months agoMITView on GitHub

Choosing between app.json vs app.config.ts vs app.config.js, environment variables, variants, extra fields, plugin chain, and slug/scheme/bundle/version discipline. Triggers on app.json, app.config.ts, app.config.js, expo config, environment variable, .env, eas secret, variant, extra field, slug, scheme, bundle identifier, package name, version, build number, version code.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are 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.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    extra.eas.projectId: NEVER delete by hand

    line 229
  2. Very specific:

    After a .env change the Metro cache → needs --clear

    line 239

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

expo-app-config

Choosing among app.json, app.config.ts, app.config.js, plus environment variables, variants (dev/staging/prod), and identifier discipline. The plugin chain lives in expo-config-plugin.

What It Does

  • app.json vs app.config.ts vs app.config.js decision
  • Environment variables (.env, EXPO_PUBLIC_*, EAS Secrets)
  • Multi-variant (dev/staging/production) configuration
  • extra field discipline and runtime access
  • Slug, scheme, bundleIdentifier, package, version, buildNumber management
  • Plugin chain order

Which Format?

FormatAdvantageLimitWhen?
app.jsonStatic, simpleNo JS, no envSingle variant, simple
app.config.jsDynamic, envNo TypeScriptOlder choice
app.config.tsDynamic + typedCompile stepRecommended

Use app.config.ts in most projects. Keep app.json as a static fallback or drop it entirely.

app.config.ts Template

import { ExpoConfig, ConfigContext } from "expo/config";

export default ({ config }: ConfigContext): ExpoConfig => {
  const variant = process.env.APP_VARIANT ?? "development";
  const isProduction = variant === "production";

  return {
    ...config,
    name: variantName(variant),
    slug: "myapp",
    scheme: "myapp",
    version: "1.2.0",
    orientation: "portrait",
    icon: `./assets/icon-${variant}.png`,
    userInterfaceStyle: "automatic",
    splash: {
      image: "./assets/splash.png",
      resizeMode: "contain",
      backgroundColor: "#ffffff",
    },
    ios: {
      bundleIdentifier: bundleId(variant),
      buildNumber: "1",
      supportsTablet: true,
      infoPlist: {
        NSCameraUsageDescription: "Camera access required",
      },
    },
    android: {
      package: bundleId(variant),
      versionCode: 1,
      adaptiveIcon: {
        foregroundImage: `./assets/icon-fg-${variant}.png`,
        backgroundColor: "#ffffff",
      },
    },
    plugins: [
      "expo-router",
      "expo-dev-client",
      ["expo-notifications", { icon: "./assets/notif-icon.png" }],
    ],
    extra: {
      apiUrl: process.env.EXPO_PUBLIC_API_URL,
      sentryDsn: process.env.SENTRY_DSN,
      eas: { projectId: "your-eas-project-id" },
      variant,
    },
    runtimeVersion: { policy: "fingerprint" },
    updates: {
      url: "https://u.expo.dev/your-project-id",
    },
  };
};

function variantName(v: string): string {
  switch (v) {
    case "production": return "MyApp";
    case "staging": return "MyApp (Staging)";
    default: return "MyApp (Dev)";
  }
}

function bundleId(v: string): string {
  const base = "com.example.myapp";
  if (v === "production") return base;
  return `${base}.${v}`;
}

Running a Variant

APP_VARIANT=development npx expo start
APP_VARIANT=staging eas build --profile preview
APP_VARIANT=production eas build --profile production

eas.json:

{
  "build": {
    "development": { "env": { "APP_VARIANT": "development" } },
    "preview":     { "env": { "APP_VARIANT": "staging" } },
    "production":  { "env": { "APP_VARIANT": "production" } }
  }
}

Environment Variables

TypeAccessBuild-timeRuntime
EXPO_PUBLIC_* (.env)JS: process.env.EXPO_PUBLIC_XYesYes (embedded)
process.env.X (app.config.ts)Only in configYesNo
EAS SecretDuring EAS buildYesNo (not embedded)
extra fieldConstants.expoConfig.extra.XYesYes

CRITICAL: NEVER prefix API keys with EXPO_PUBLIC_* — they get embedded in the client and everyone can read them. Real secrets stay on the backend.

.env Files

# .env (default)
EXPO_PUBLIC_API_URL=https://api.dev.example.com

# .env.production
EXPO_PUBLIC_API_URL=https://api.example.com

.gitignore:

.env.local
.env.*.local

Is .env committed? EXPO_PUBLIC_* is already public, so it's fine. Secret values live in .env.local and are never committed.

extra Field Runtime Access

import Constants from "expo-constants";

const apiUrl = Constants.expoConfig?.extra?.apiUrl;
const variant = Constants.expoConfig?.extra?.variant;

Typed wrapper:

// src/config.ts
import Constants from "expo-constants";

type AppExtra = {
  apiUrl: string;
  sentryDsn: string;
  variant: "development" | "staging" | "production";
};

export const appConfig = Constants.expoConfig?.extra as AppExtra;

Identifier Discipline

FieldFormatIf it changes
slugkebab-caseEAS project ID changes
schemekebab-case or a single wordDeep link breaks
ios.bundleIdentifiercom.org.appNew app, certificate invalid
android.packagecom.org.appNew app, keystore invalid
version1.2.3 (SemVer)New release
ios.buildNumberstringIncrement on every build
android.versionCodeintegerIncrement on every build

If bundleIdentifier and package change, the app becomes a new app. Existing installs are lost.

Bundle ID Strategy for Variants

com.example.myapp           # production
com.example.myapp.staging   # staging
com.example.myapp.dev       # development

Advantage: 3 separate apps side by side on the same device. Does not put the production device at risk.

Plugin Chain

plugins: [
  "expo-router",                                    // Routing first
  "expo-dev-client",                                // Dev tools
  ["expo-build-properties", {                       // Native build properties
    ios: { deploymentTarget: "15.1" },
    android: { compileSdkVersion: 34 }
  }],
  ["expo-notifications", { icon: "..." }],          // Native modules
  "./plugins/withCustomConfig",                     // Custom plugins
]

Order: routing → dev tools → build props → native modules → custom.

Best Practices

  • Choose app.config.ts — typed + dynamic
  • Variant bundle-ID discipline for 3 parallel apps
  • EAS Secrets for real secrets (never .env or EXPO_PUBLIC_)
  • expo-build-properties plugin for native version control
  • runtimeVersion: fingerprint for OTA discipline
  • extra.eas.projectId NEVER delete by hand
  • SemVer: major (breaking), minor (feature), patch (fix)

Common Failure Patterns

  • Both app.json + app.config.ts present → app.config.ts wins, causes confusion
  • EXPO_PUBLIC_API_SECRET → secret leaks to the client
  • extra.eas.projectId deleted → EAS tries to create a new project
  • bundleIdentifier changed → you must renew the certificate/keystore
  • versionCode not incremented → Play Store rejects
  • After a .env change the Metro cache → needs --clear
  • extra field untyped → undefined blow-up at runtime

Hard Refusal

  • Impersonating (hijacking) another app's bundle ID
  • Embedding an API secret with the EXPO_PUBLIC_ prefix
  • Putting credit card data/PII inside the extra field
  • Connecting production data to the staging app without variant-ID discipline

Output Format

  1. Format choice (app.config.ts rationale)
  2. Variant and bundle-ID strategy
  3. .env vs EAS Secret separation
  4. Plugin chain order
  5. Identifier-discipline summary
  6. Next step: expo-config-plugin or expo-eas-build

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.