expo-config-plugin
Skill8 starsChanged 3 months agoMITView on GitHub
Writing Expo config plugins, withInfoPlist, withAndroidManifest, withDangerousMod, mod compose, plugin testing, and registration in app.config.ts. Triggers on config plugin, with-plugin, withInfoPlist, withAndroidManifest, withDangerousMod, withEntitlementsPlist, withGradleProperties, mod, native config, expo plugin, plugin test, app.config plugin.
- Reads credentials
In this repository63 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-automationSkill
- consultingSkill
- contentSkill
- customer-successSkill
- data-analyticsSkill
- designSkill
- design-tokensSkill
- developmentSkill
- devopsSkill
- ecommerceSkill
- emailSkill
- expo-app-configSkill
- expo-dev-clientSkill
- expo-eas-buildSkill
- expo-eas-submitSkill
- expo-eas-updateSkill
- expo-modulesSkill
- expo-notificationsSkill
- expo-orchestratorSkill
- expo-prebuildSkill
- expo-routerSkill
- expo-troubleshootingSkill
- financeSkill
- frontend-tasteSkill
- marketingSkill
- market-researchSkill
- mobileSkill
- pentest-adSkill
- pentest-apiSkill
- pentest-bizlogicSkill
- pentest-bugbountySkill
- pentest-cicdSkill
- pentest-cloudSkill
- pentest-credentialsSkill
- pentest-ctfSkill
- pentest-detectionSkill
- pentest-engagementSkill
- pentest-exploit-chainSkill
- pentest-forensicsSkill
- pentest-llmSkill
- pentest-malwareSkill
- pentest-mobileSkill
- pentest-opsec-evidenceSkill
- pentest-orchestratorSkill
- pentest-privescSkill
- pentest-reconSkill
- pentest-reportSkill
- pentest-socialSkill
- pentest-stigSkill
- pentest-threat-modelSkill
- pentest-webSkill
- pentest-wirelessSkill
- productivitySkill
- productSkill
- salesSkill
- security-checkSkill
- securitySkill
- seo-crawl-budgetSkill
- seoSkill
- The first 60 shown.
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 185
Check idempotency (regex includes())
≈ “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.
Files
expo-config-plugin
A guide to writing Expo Config Plugins. Automatically modifying native files (Info.plist, AndroidManifest.xml, build.gradle, Podfile) during prebuild. Plugin compose discipline, dangerous-mod usage, and the registration/test flow. The prebuild process itself lives in expo-prebuild.
What It Does
- iOS
Info.plist,entitlements.plist,Podfile,xcodeprojmodification - Android
AndroidManifest.xml,build.gradle,MainApplication.kt,strings.xmlmodification - Plugin mod compose (
withPlugins) - File writing with
withDangerousMod(last resort) - Plugin tests (snapshot)
- Registration and parameter passing in
app.config.ts
Plugin Structure
// plugins/withMyPlugin.ts
import {
ConfigPlugin,
withInfoPlist,
withAndroidManifest,
withDangerousMod,
} from "expo/config-plugins";
type Props = { apiKey: string };
const withMyPlugin: ConfigPlugin<Props> = (config, { apiKey }) => {
// iOS
config = withInfoPlist(config, (cfg) => {
cfg.modResults.MyApiKey = apiKey;
cfg.modResults.NSCameraUsageDescription = "Camera access required";
return cfg;
});
// Android
config = withAndroidManifest(config, (cfg) => {
const app = cfg.modResults.manifest.application?.[0];
if (app) {
app["meta-data"] = app["meta-data"] || [];
app["meta-data"].push({
$: { "android:name": "com.myapp.API_KEY", "android:value": apiKey },
});
}
return cfg;
});
return config;
};
export default withMyPlugin;app.config.ts:
export default {
expo: {
name: "MyApp",
plugins: [
["./plugins/withMyPlugin", { apiKey: process.env.MY_API_KEY }],
],
},
};Mod Table
| Mod | Target | Usage |
withInfoPlist | iOS Info.plist | usage descriptions, URL schemes |
withEntitlementsPlist | iOS entitlements | push, app groups, keychain |
withAndroidManifest | AndroidManifest.xml | permissions, intent filters |
withStringsXml | values/strings.xml | localized strings, app_name |
withGradleProperties | gradle.properties | global gradle vars |
withAppBuildGradle | app/build.gradle | dependencies, packaging |
withProjectBuildGradle | build.gradle | repositories, classpath |
withPodfile | ios/Podfile | (via withDangerousMod) |
withMainApplication | MainApplication.kt | provider, lifecycle |
withAppDelegate | AppDelegate.swift | lifecycle, URL handling |
withXcodeProject | project.pbxproj | target settings, build phases |
withDangerousMod | any file | last resort; write idempotently |
withDangerousMod Example
import { withDangerousMod } from "expo/config-plugins";
import * as fs from "fs";
import * as path from "path";
const withPodfileCustom: ConfigPlugin = (config) => {
return withDangerousMod(config, [
"ios",
async (cfg) => {
const podfile = path.join(cfg.modRequest.platformProjectRoot, "Podfile");
let content = fs.readFileSync(podfile, "utf8");
const insert = `pod 'MyCustomPod', '1.0.0'`;
if (!content.includes(insert)) {
content = content.replace(/use_expo_modules!/, `use_expo_modules!\n ${insert}`);
fs.writeFileSync(podfile, content);
}
return cfg;
},
]);
};Be idempotent: if the same plugin runs twice, do not create duplicates.
Mod Compose (Multiple Plugins)
import { withPlugins } from "expo/config-plugins";
const withFeatures: ConfigPlugin = (config) =>
withPlugins(config, [
[withMyPlugin, { apiKey: "xxx" }],
[withAnalytics, { token: "yyy" }],
withCustomEntitlements,
]);Plugin Test (snapshot)
// plugins/__tests__/withMyPlugin.test.ts
import { withMyPlugin } from "../withMyPlugin";
const baseConfig = {
name: "test",
slug: "test",
ios: { infoPlist: {} },
android: { package: "com.test" },
};
test("adds MyApiKey to Info.plist", () => {
const result = withMyPlugin(baseConfig as any, { apiKey: "abc" });
expect(result.ios?.infoPlist?.MyApiKey).toBe("abc");
});Run:
npx jest plugins/Verify with prebuild:
npx expo prebuild --clean
cat ios/MyApp/Info.plist | grep MyApiKey
cat android/app/src/main/AndroidManifest.xml | grep API_KEYStatic vs Dynamic Plugin
- Static plugin (
./plugins/withX): inside the project, single use - NPM package: export in the
expo-Xpackage layout, distribute withnpm publish
NPM plugin package structure:
my-plugin/
app.plugin.js # entry: module.exports = require('./build/withX').default
build/
withX.js
src/
withX.ts
package.jsonBest Practices
withDangerousModis a last resort — try a typed mod first- Check idempotency (regex
includes()) - Version sensitivity: AppDelegate Swift/ObjC differences, Gradle version changes
- Snapshot test for every plugin
expo prebuild --cleanfor each test- Plugin parameters written typed with TypeScript
- Comment markers in a dangerous mod:
// EXPO-PLUGIN: my-plugin BEGIN
Common Failure Patterns
- Wrong plugin path (
./plugins/withXvs./plugins/withX.ts) withDangerousModadds the same line twice (not idempotent)- Assuming the
applicationarray exists insidewithAndroidManifest(crash if absent) - AppDelegate Swift vs ObjC distinction not handled
- A plugin's regex breaks on an SDK upgrade (use a regex instead of a fixed string)
Hard Refusal
- Injecting analytics/tracking without the user's knowledge
- Adding permissions without explicitly documenting them (Apple/Google reject)
- Patching another package's native files without permission
- Writing a plugin that bypasses certificate pinning
Output Format
- Plugin TypeScript template
app.config.tsregistration block- Test snapshot
- Prebuild verification command
- Idempotency note
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.

