vybekiit 0.7.3 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +16607 -7527
- package/dist/global-skills/aws-cdk/SKILL.md +2 -1
- package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
- package/dist/global-skills/aws-serverless/SKILL.md +45 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
- package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
- package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
- package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
- package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
- package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
- package/dist/global-skills/aws-serverless/references/production.md +78 -415
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
- package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
- package/dist/global-skills/design-my-data/SKILL.md +2 -0
- package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
- package/dist/global-skills/eas-hosting/SKILL.md +8 -0
- package/dist/global-skills/eas-observe/SKILL.md +30 -8
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/references/metrics.md +54 -3
- package/dist/global-skills/eas-observe/references/queries.md +78 -17
- package/dist/global-skills/eas-observe/references/setup.md +164 -5
- package/dist/global-skills/eas-observe/references/third-party.md +136 -0
- package/dist/global-skills/eas-simulator/SKILL.md +63 -11
- package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
- package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
- package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
- package/dist/global-skills/eas-workflows/SKILL.md +15 -10
- package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
- package/dist/global-skills/email-best-practices/README.md +63 -0
- package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
- package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
- package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
- package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
- package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
- package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
- package/dist/global-skills/email-best-practices/tests/README.md +35 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
- package/dist/global-skills/expo-animation/LICENSE +21 -0
- package/dist/global-skills/expo-animation/RECIPES.md +385 -0
- package/dist/global-skills/expo-animation/SKILL.md +267 -0
- package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
- package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
- package/dist/global-skills/expo-design-system/SKILL.md +356 -0
- package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-design-system/references/audit.md +185 -0
- package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
- package/dist/global-skills/expo-dom/SKILL.md +8 -0
- package/dist/global-skills/expo-examples/SKILL.md +8 -0
- package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
- package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
- package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
- package/dist/global-skills/expo-module/SKILL.md +11 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
- package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-router/SKILL.md +8 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
- package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
- package/dist/global-skills/expo-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
- package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
- package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
- package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
- package/dist/global-skills/firebase-basics/SKILL.md +5 -5
- package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
- package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
- package/dist/global-skills/harden/SKILL.md +2 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
- package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
- package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
- package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
- package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
- package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
- package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
- package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
- package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
- package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
- package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
- package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
- package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
- package/dist/global-skills/manifest.json +6 -1
- package/dist/global-skills/neon/SKILL.md +235 -121
- package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
- package/dist/global-skills/neon-functions/SKILL.md +242 -152
- package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
- package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
- package/dist/global-skills/neon-functions/references/mcp.md +13 -4
- package/dist/global-skills/neon-functions/references/sentry.md +165 -52
- package/dist/global-skills/neon-functions/references/sse.md +23 -6
- package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
- package/dist/global-skills/neon-postgres/SKILL.md +63 -262
- package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
- package/dist/global-skills/resend/SKILL.md +6 -6
- package/dist/global-skills/resend/references/automations.md +2 -2
- package/dist/global-skills/resend/references/broadcasts.md +11 -3
- package/dist/global-skills/resend/references/domains.md +25 -3
- package/dist/global-skills/resend/references/installation.md +7 -7
- package/dist/global-skills/setup-payments/SKILL.md +4 -5
- package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
- package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
- package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
- package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
- package/dist/global-skills/supabase/CHANGELOG.md +25 -0
- package/dist/global-skills/supabase/SKILL.md +5 -1
- package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
- package/dist/global-skills/use-railway/SKILL.md +4 -4
- package/dist/global-skills/use-railway/references/iac.md +206 -57
- package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +12 -9
- package/LICENSE.md +0 -47
- package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
- package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
- package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
|
@@ -52,3 +52,11 @@ npx create-expo-app@latest my-project --template default@sdk-55
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Pin the same Expo SDK across both the RN project and any embedded dependencies.
|
|
55
|
+
|
|
56
|
+
## Submitting Feedback
|
|
57
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
58
|
+
```bash
|
|
59
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-brownfield" "<actionable feedback>"
|
|
60
|
+
```
|
|
61
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
62
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -13,9 +13,9 @@ If a single team owns both layers, is comfortable with React Native tooling and
|
|
|
13
13
|
|
|
14
14
|
## What you produce
|
|
15
15
|
|
|
16
|
-
| Platform | Artifact
|
|
17
|
-
| -------- |
|
|
18
|
-
| Android | `{group}:{libraryName}:{version}` AAR
|
|
16
|
+
| Platform | Artifact | Default location |
|
|
17
|
+
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
18
|
+
| Android | `{group}:{libraryName}:{version}` AAR | Local Maven (`~/.m2`) by default; remote Maven also supported |
|
|
19
19
|
| iOS | Set of `.xcframework`s — see [the iOS section below](#ios) for how `ios.buildReactNativeFromSource` (default `false` on SDK 56+) controls whether you get 5 frameworks or 2 — or a single Swift Package via `--package` | `./artifacts` |
|
|
20
20
|
|
|
21
21
|
The JavaScript bundle is **embedded inside the artifact** in release builds, so the native app does not need Metro at runtime in production.
|
|
@@ -49,6 +49,15 @@ npx expo install expo-brownfield
|
|
|
49
49
|
|
|
50
50
|
The plugin self-registers in `app.json` with defaults derived from your app config.
|
|
51
51
|
|
|
52
|
+
### Check what the host app already ships
|
|
53
|
+
|
|
54
|
+
Before picking Expo modules, audit the host app's dependencies. The artifact's libraries meet the host's at build time, and version clashes surface as duplicate-class errors or forced upgrades.
|
|
55
|
+
|
|
56
|
+
- **Jetpack Compose** — `@expo/ui` re-declares recent Compose and Material3 versions, and is pulled transitively by `expo-router`. A host pinned to older Compose gets force-upgraded. Exclude it with `expo.autolinking.android.exclude` if the RN screens don't need it.
|
|
57
|
+
- **OkHttp, Kotlin stdlib, Material Components** — arrive as ordinary Maven dependencies of the artifact; Gradle resolves the highest version, which can bump the host's copies.
|
|
58
|
+
|
|
59
|
+
When a shared library must stay at the host's version, exclude the Expo module that brings it, or (with fused publishing, below) mark the group as host-provided.
|
|
60
|
+
|
|
52
61
|
### Configure the plugin (optional)
|
|
53
62
|
|
|
54
63
|
To override the auto-generated names, expand the plugin entry in `app.json`:
|
|
@@ -162,6 +171,37 @@ npx expo-brownfield build:android --task publishReleasePublicationToCompanyRepos
|
|
|
162
171
|
npx expo-brownfield tasks:android # list available publish tasks and repositories
|
|
163
172
|
```
|
|
164
173
|
|
|
174
|
+
#### Fused publishing (single fat AAR)
|
|
175
|
+
|
|
176
|
+
> **Version note:** requires minimum SDK 56. Earlier versions only support the per-module publishing above.
|
|
177
|
+
|
|
178
|
+
The default publish flow emits one Maven coordinate per autolinked Expo module. For remote distribution, `--fused` collapses everything into one fat AAR per build variant:
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
npx expo-brownfield build:android --fused --repo MavenLocal
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This publishes two coordinates — `{group}:{libraryName}-fused-release` and `{group}:{libraryName}-fused-debug`, which the host wires per build type:
|
|
185
|
+
|
|
186
|
+
```kotlin
|
|
187
|
+
dependencies {
|
|
188
|
+
releaseImplementation("com.example:mybrownfield-fused-release:1.0.0")
|
|
189
|
+
debugImplementation("com.example:mybrownfield-fused-debug:1.0.0")
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The debug AAR contains debug-compiled modules (dev menu, Metro reload); the release AAR embeds the JS bundle. Published metadata pins the matching React Native variant, so a debug host consuming only the release AAR still resolves release RN correctly.
|
|
194
|
+
|
|
195
|
+
Not everything is fused: the React Native runtime, Kotlin stdlib, host-common libraries (Material, Guava, OkHttp, Fresco), `androidx.*`, and detected KMP umbrella modules stay external and are declared as ordinary POM dependencies. Gradle properties tune the behavior for unusual dependency graphs:
|
|
196
|
+
|
|
197
|
+
| Property | Effect |
|
|
198
|
+
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
199
|
+
| `brownfield.fused.skip` | Gradle project names to leave out of the AAR (pair with `strip-packages`). |
|
|
200
|
+
| `brownfield.fused.strip-packages` | Package prefixes to remove from `ExpoModulesPackageList` — avoids `NoClassDefFoundError` for skipped modules. |
|
|
201
|
+
| `brownfield.fused.androidx-fuse` | Extra `androidx.*` groups to fuse instead of keeping external. |
|
|
202
|
+
| `brownfield.fused.exclude-transitive` | Extra groups to keep external (still declared in the POM). |
|
|
203
|
+
| `brownfield.fused.host-provided` | Groups the host already ships (e.g. Glide, Compose): excluded from the AAR **and** from the POM, so the host's version is untouched. |
|
|
204
|
+
|
|
165
205
|
### iOS
|
|
166
206
|
|
|
167
207
|
```sh
|
|
@@ -179,7 +219,10 @@ To force source builds on SDK 56+, add `expo-build-properties` to `app.json`:
|
|
|
179
219
|
{
|
|
180
220
|
"expo": {
|
|
181
221
|
"plugins": [
|
|
182
|
-
[
|
|
222
|
+
[
|
|
223
|
+
"expo-build-properties",
|
|
224
|
+
{ "ios": { "buildReactNativeFromSource": true } }
|
|
225
|
+
],
|
|
183
226
|
"expo-brownfield"
|
|
184
227
|
]
|
|
185
228
|
}
|
|
@@ -258,6 +301,12 @@ dependencyResolutionManagement {
|
|
|
258
301
|
|
|
259
302
|
If the artifact is published to a remote Maven, declare that repository in the same `dependencyResolutionManagement` block instead — credentials follow Gradle's standard `maven { url = uri(...); credentials { username = ...; password = ... } }` form.
|
|
260
303
|
|
|
304
|
+
#### Host app requirements
|
|
305
|
+
|
|
306
|
+
- **`minSdk` 24 or higher** — React Native's floor. Hosts below it fail at manifest merge with `uses-sdk:minSdkVersion XX cannot be smaller than version 24`.
|
|
307
|
+
- **Permissions merge in from the Expo modules** (e.g. storage permissions from media modules). Hosts that enforce a permission allowlist can strip unwanted entries in their manifest with `tools:node="remove"` or reconcile attribute conflicts with `tools:replace`.
|
|
308
|
+
- **Native libraries ship for every ABI enabled at publish time.** Left unfiltered, this can multiply the host APK size. Constrain ABIs when publishing (`reactNativeArchitectures=arm64-v8a` in the Expo project's `gradle.properties`) or filter in the host with `ndk.abiFilters` / APK splits.
|
|
309
|
+
|
|
261
310
|
#### Show a React Native screen
|
|
262
311
|
|
|
263
312
|
Extend `BrownfieldActivity` and call `showReactNativeFragment()`:
|
|
@@ -447,3 +447,11 @@ User: "Where should I put my API key?"
|
|
|
447
447
|
|
|
448
448
|
User: "How do I load data for a page in Expo Router?"
|
|
449
449
|
-> See references/expo-router-loaders.md for route-level loaders (web, SDK 55+). For native, use React Query or fetch.
|
|
450
|
+
|
|
451
|
+
## Submitting Feedback
|
|
452
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
453
|
+
```bash
|
|
454
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-data-fetching" "<actionable feedback>"
|
|
455
|
+
```
|
|
456
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
457
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expo-design-system
|
|
3
|
+
description: Framework (OSS). Build and maintain a design system inside an Expo app - a reusable theme of design tokens (color, spacing, typography, radius, shadow, motion), reusable component structure with variant/size/state prop conventions, and rules for when to extract a repeated view into a shared component. Use when creating or organizing theme files and design tokens (theme.ts / theme/), extending an existing theme or styling library (NativeWind, Tamagui, Restyle, Unistyles) in its own idiom, standardizing styles so screens (including AI-generated ones) look consistent and polished, building an in-app component library, or auditing an app for design-system drift (hardcoded colors, spacing, fonts). For platform styling specifics (semantic colors, HIG rules, native controls) use expo-native-ui; for Tailwind/CSS setup use expo-tailwind-setup; for folder layout of a new app use expo-project-structure.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Expo Design Systems
|
|
9
|
+
|
|
10
|
+
Make every screen in an app draw from one visual source of truth: a token theme and a small set of reusable components. This skill defines where tokens live, what they cover, how reusable components are shaped, and when a repeated view earns promotion into the system.
|
|
11
|
+
|
|
12
|
+
Sibling skills own the layers around this one:
|
|
13
|
+
|
|
14
|
+
- `expo-native-ui` - platform styling rules (HIG, semantic colors, controls, shadows syntax). Follow it for **what values look native**; follow this skill for **where values live and how they're reused**.
|
|
15
|
+
- `expo-tailwind-setup` - if the project uses Tailwind, tokens live in `global.css` as CSS variables instead of TypeScript. The scales and naming in this skill still apply; only the storage format changes.
|
|
16
|
+
- `expo-project-structure` - folder skeleton for new apps.
|
|
17
|
+
|
|
18
|
+
## References
|
|
19
|
+
|
|
20
|
+
Consult these resources as needed:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
references/
|
|
24
|
+
audit.md Audit an existing app for design-system drift: grep checks,
|
|
25
|
+
scoring rubric, incremental adoption plan, and templates for
|
|
26
|
+
documenting or extending components
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Adopt Before You Build
|
|
30
|
+
|
|
31
|
+
In an app that already has screens, the first move is detection, not construction. Before writing any token file:
|
|
32
|
+
|
|
33
|
+
1. **Look for a declared system.** Check `package.json` for a styling library - NativeWind/Tailwind (use `expo-tailwind-setup`), Tamagui, Restyle, Unistyles, styled-components. Then look for a token file: `theme.ts`, `src/theme/`, `constants/theme.ts`, or `constants/Colors.ts` (the create-expo-app default).
|
|
34
|
+
2. **If one exists, it is the source of truth.** Extend it in its own idiom - its names, its scale, its storage format. Audit drift against that system, not against the examples below.
|
|
35
|
+
3. **If only de facto values exist** - the same greys and paddings repeated across screens, no theme file - there is no system yet. Those values are the input to the scales, not the authority: derive tokens from the most frequent ones, snapped to the 4-point grid (`references/audit.md` §5).
|
|
36
|
+
4. **Never introduce a second system beside an existing one.** A fresh `src/theme/` next to a Tamagui config is design-system drift, not adoption.
|
|
37
|
+
|
|
38
|
+
Only when nothing exists do the defaults below apply as written.
|
|
39
|
+
|
|
40
|
+
## The Theme
|
|
41
|
+
|
|
42
|
+
In an app without an existing system, all design tokens live under `src/theme/`. In a project without a `src/` folder (the default `create-expo-app` template has `app/`, `components/`, and `constants/` at the root), use the equivalent top-level location - typically `theme/` or the existing `constants/` - and keep the same file layout. Start small and split by token class as it grows:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
src/theme/
|
|
46
|
+
colors.ts # see expo-native-ui "Colors" for the palette pattern
|
|
47
|
+
spacing.ts
|
|
48
|
+
typography.ts
|
|
49
|
+
radius.ts
|
|
50
|
+
shadows.ts
|
|
51
|
+
motion.ts
|
|
52
|
+
index.ts # re-exports everything: import { spacing, type } from "@/theme"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A brand-new app can begin with a single `src/theme.ts` holding all of the objects below, then promote it to the folder form once any one class needs its own file (same promotion rule as components). Either way there is exactly **one** theme entry point - never two competing token files.
|
|
56
|
+
|
|
57
|
+
Rules that make a theme worth having:
|
|
58
|
+
|
|
59
|
+
- **Every repeated visual value is a token.** A literal that appears twice belongs in the theme.
|
|
60
|
+
- **Components import tokens; screens import components.** A screen file that imports `spacing` for layout padding is fine; a screen file redefining a button color is drift.
|
|
61
|
+
- **Never hardcode** hex colors, font sizes, or spacing multiples outside `src/theme/`. One-off values that are genuinely local (an icon's 17px optical nudge) may stay inline - with a comment saying why.
|
|
62
|
+
|
|
63
|
+
### Colors
|
|
64
|
+
|
|
65
|
+
Build the palette from platform semantic colors: `Color` from `expo-router` wrapped in `Platform.select`, centralized in `theme/colors.ts`. Semantic colors resolve on-device and adapt to light/dark automatically - prefer them for backgrounds, labels, and separators. (`expo-native-ui` "Colors" covers the full palette and rationale; the minimal version is:)
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
// theme/colors.ts
|
|
69
|
+
import { Platform } from "react-native";
|
|
70
|
+
import { Color } from "expo-router";
|
|
71
|
+
|
|
72
|
+
export const colors = {
|
|
73
|
+
label: Platform.select({
|
|
74
|
+
ios: Color.ios.label,
|
|
75
|
+
android: Color.android.dynamic.onSurface,
|
|
76
|
+
default: "#000000",
|
|
77
|
+
})!,
|
|
78
|
+
secondaryLabel: Platform.select({
|
|
79
|
+
ios: Color.ios.secondaryLabel,
|
|
80
|
+
android: Color.android.dynamic.onSurfaceVariant,
|
|
81
|
+
default: "#3c3c43",
|
|
82
|
+
})!,
|
|
83
|
+
separator: Platform.select({
|
|
84
|
+
ios: Color.ios.separator,
|
|
85
|
+
android: Color.android.dynamic.outlineVariant,
|
|
86
|
+
default: "#c6c6c8",
|
|
87
|
+
})!,
|
|
88
|
+
systemBackground: Platform.select({
|
|
89
|
+
ios: Color.ios.systemBackground,
|
|
90
|
+
android: Color.android.dynamic.surface,
|
|
91
|
+
default: "#ffffff",
|
|
92
|
+
})!,
|
|
93
|
+
systemBlue: Platform.select({
|
|
94
|
+
ios: Color.ios.systemBlue,
|
|
95
|
+
android: Color.android.dynamic.primary,
|
|
96
|
+
default: "#007aff",
|
|
97
|
+
})!,
|
|
98
|
+
// Deliberately fixed: text on a tinted (accent) surface stays white in both modes.
|
|
99
|
+
onTint: "#ffffff",
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Add brand colors as explicit light/dark pairs only when the brand requires values the platform doesn't provide:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
// theme/colors.ts (brand additions)
|
|
107
|
+
import { useColorScheme } from "react-native";
|
|
108
|
+
|
|
109
|
+
const brandPalette = {
|
|
110
|
+
light: { accent: "#5B21B6", accentContrast: "#FFFFFF" },
|
|
111
|
+
dark: { accent: "#A78BFA", accentContrast: "#1E1B4B" },
|
|
112
|
+
} as const;
|
|
113
|
+
|
|
114
|
+
export function useBrandColors() {
|
|
115
|
+
const scheme = useColorScheme();
|
|
116
|
+
return brandPalette[scheme === "dark" ? "dark" : "light"];
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Keep the brand set tiny (accent, accentContrast, maybe a tint per feature). Everything else stays semantic.
|
|
121
|
+
|
|
122
|
+
**Static-safe vs hook-only.** The two patterns above have different reach - keep the boundary explicit:
|
|
123
|
+
|
|
124
|
+
- Semantic/platform colors (`colors` above) are **static-safe**: they resolve on-device, so plain token files like `theme/typography.ts` can import them at module scope.
|
|
125
|
+
- Brand light/dark pairs are **hook-only**: `useBrandColors()` reads the color scheme at render time, so brand colors can only be applied inside components. A static token file cannot call the hook.
|
|
126
|
+
- Never mix the two in one file. If a static style (a `type` ramp step, a `variants` object) needs the brand accent, either apply the brand color in the component at render time, or wrap the pair in a static dynamic color (`DynamicColorIOS` on iOS) so it becomes static-safe.
|
|
127
|
+
|
|
128
|
+
### Spacing
|
|
129
|
+
|
|
130
|
+
One scale, based on a 4-point grid. Name steps by size, not by use:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
// theme/spacing.ts
|
|
134
|
+
export const spacing = {
|
|
135
|
+
xs: 4,
|
|
136
|
+
sm: 8,
|
|
137
|
+
md: 16,
|
|
138
|
+
lg: 24,
|
|
139
|
+
xl: 32,
|
|
140
|
+
xxl: 48,
|
|
141
|
+
} as const;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Use `gap` with spacing tokens for layout rhythm (`expo-native-ui` prefers gap over margin).
|
|
145
|
+
- Screen edge padding is `spacing.md` unless the design says otherwise - pick one and keep it.
|
|
146
|
+
- If a layout needs a value between steps, use the nearest step. The grid is the point.
|
|
147
|
+
- If the same in-between multiple of 4 keeps recurring (12 and 20 are common), add it to the scale as a named step instead of scattering literals. The audit whitelist must then include it too.
|
|
148
|
+
|
|
149
|
+
### Typography
|
|
150
|
+
|
|
151
|
+
Define named text styles, not raw font sizes. Mirror the platform ramp (Apple text styles) so sizes feel native:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
// theme/typography.ts
|
|
155
|
+
import { TextStyle } from "react-native";
|
|
156
|
+
import { colors } from "./colors";
|
|
157
|
+
|
|
158
|
+
export const type = {
|
|
159
|
+
largeTitle: { fontSize: 34, fontWeight: "700", color: colors.label },
|
|
160
|
+
title: { fontSize: 22, fontWeight: "600", color: colors.label },
|
|
161
|
+
headline: { fontSize: 17, fontWeight: "600", color: colors.label },
|
|
162
|
+
body: { fontSize: 17, fontWeight: "400", color: colors.label },
|
|
163
|
+
subhead: { fontSize: 15, fontWeight: "400", color: colors.secondaryLabel },
|
|
164
|
+
caption: { fontSize: 12, fontWeight: "400", color: colors.secondaryLabel },
|
|
165
|
+
} as const satisfies Record<string, TextStyle>;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
If the project bundles static font files (one file per weight, loaded with `expo-font` or the config plugin), set weight via `fontFamily` names instead and omit `fontWeight` - otherwise iOS synthesizes the weight or falls back to the system font:
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
headline: { fontSize: 17, fontFamily: "SFProRounded-Semibold", color: colors.label },
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Expose them through one component so screens never touch `fontSize`:
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
// components/themed-text.tsx
|
|
178
|
+
import { Text, TextProps } from "react-native";
|
|
179
|
+
import { type } from "@/theme";
|
|
180
|
+
|
|
181
|
+
export function ThemedText({
|
|
182
|
+
variant = "body",
|
|
183
|
+
style,
|
|
184
|
+
...props
|
|
185
|
+
}: TextProps & { variant?: keyof typeof type }) {
|
|
186
|
+
return <Text style={[type[variant], style]} {...props} />;
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Screen titles still come from the navigation stack header (`expo-native-ui` rule), so `largeTitle` is mostly for non-stack contexts.
|
|
191
|
+
|
|
192
|
+
### Radius
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
// theme/radius.ts
|
|
196
|
+
export const radius = {
|
|
197
|
+
sm: 8,
|
|
198
|
+
md: 12,
|
|
199
|
+
lg: 16,
|
|
200
|
+
full: 9999, // capsules
|
|
201
|
+
} as const;
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Pair every non-capsule radius with `borderCurve: "continuous"` (per `expo-native-ui`).
|
|
205
|
+
|
|
206
|
+
### Shadows
|
|
207
|
+
|
|
208
|
+
Shadows are `boxShadow` strings (never legacy shadow/elevation props - see `expo-native-ui`). Two or three elevation levels are enough:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
// theme/shadows.ts
|
|
212
|
+
export const shadows = {
|
|
213
|
+
card: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
214
|
+
raised: "0 4px 12px rgba(0, 0, 0, 0.10)",
|
|
215
|
+
overlay: "0 8px 24px rgba(0, 0, 0, 0.18)",
|
|
216
|
+
} as const;
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Motion
|
|
220
|
+
|
|
221
|
+
Durations and shared spring/easing configs, so animations across the app feel related:
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
// theme/motion.ts
|
|
225
|
+
export const motion = {
|
|
226
|
+
fast: 150, // state feedback: press, toggle
|
|
227
|
+
base: 250, // element transitions: enter/exit
|
|
228
|
+
slow: 400, // large surfaces: sheets, screens
|
|
229
|
+
} as const;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Reanimated caveat: don't pass `Color`/`PlatformColor` token values into Reanimated styles - use static colors there (see `expo-native-ui`).
|
|
233
|
+
|
|
234
|
+
## Reusable Components
|
|
235
|
+
|
|
236
|
+
The theme controls values; components control structure. Shared primitives live in `src/components/` (see `expo-project-structure`).
|
|
237
|
+
|
|
238
|
+
### The component contract
|
|
239
|
+
|
|
240
|
+
Every design-system primitive defines, explicitly:
|
|
241
|
+
|
|
242
|
+
- **Variants** - visual intent: `primary`, `secondary`, `ghost`, `destructive`. Add a variant only when a real screen needs it.
|
|
243
|
+
- **Sizes** - `sm`, `md`, `lg`. Default `md`. Sizes map to spacing/typography tokens, never to fresh numbers.
|
|
244
|
+
- **States** - default, **pressed** (not hover - this is touch), disabled, loading. Handle pressed with a `Pressable` style function; never leave a tappable element without pressed feedback.
|
|
245
|
+
- **Style override** - accept a `style` prop and merge it **last**, so callers can adjust layout (margins, flex) without forking the component. Callers may override layout, not identity - a caller changing a button's colors is a signal the variant set is missing something.
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
// components/button.tsx
|
|
249
|
+
import { Pressable, ActivityIndicator, ViewStyle, StyleProp } from "react-native";
|
|
250
|
+
import { colors, spacing, radius } from "@/theme";
|
|
251
|
+
import { ThemedText } from "./themed-text";
|
|
252
|
+
|
|
253
|
+
const variants = {
|
|
254
|
+
primary: { backgroundColor: colors.systemBlue, color: colors.onTint },
|
|
255
|
+
secondary: { backgroundColor: colors.separator, color: colors.label },
|
|
256
|
+
} as const;
|
|
257
|
+
|
|
258
|
+
const sizes = {
|
|
259
|
+
sm: { paddingVertical: spacing.xs, paddingHorizontal: spacing.sm },
|
|
260
|
+
md: { paddingVertical: spacing.sm, paddingHorizontal: spacing.md },
|
|
261
|
+
} as const;
|
|
262
|
+
|
|
263
|
+
export function Button({
|
|
264
|
+
variant = "primary",
|
|
265
|
+
size = "md",
|
|
266
|
+
title,
|
|
267
|
+
loading,
|
|
268
|
+
disabled,
|
|
269
|
+
style,
|
|
270
|
+
onPress,
|
|
271
|
+
}: {
|
|
272
|
+
variant?: keyof typeof variants;
|
|
273
|
+
size?: keyof typeof sizes;
|
|
274
|
+
title: string;
|
|
275
|
+
loading?: boolean;
|
|
276
|
+
disabled?: boolean;
|
|
277
|
+
style?: StyleProp<ViewStyle>;
|
|
278
|
+
onPress?: () => void;
|
|
279
|
+
}) {
|
|
280
|
+
return (
|
|
281
|
+
<Pressable
|
|
282
|
+
accessibilityRole="button"
|
|
283
|
+
disabled={disabled || loading}
|
|
284
|
+
onPress={onPress}
|
|
285
|
+
style={({ pressed }) => [
|
|
286
|
+
{
|
|
287
|
+
backgroundColor: variants[variant].backgroundColor,
|
|
288
|
+
borderRadius: radius.md,
|
|
289
|
+
borderCurve: "continuous",
|
|
290
|
+
alignItems: "center",
|
|
291
|
+
opacity: disabled ? 0.4 : pressed ? 0.7 : 1,
|
|
292
|
+
...sizes[size],
|
|
293
|
+
},
|
|
294
|
+
style, // caller overrides merge last
|
|
295
|
+
]}
|
|
296
|
+
>
|
|
297
|
+
{loading ? (
|
|
298
|
+
<ActivityIndicator color={variants[variant].color as string} />
|
|
299
|
+
) : (
|
|
300
|
+
<ThemedText variant="headline" style={{ color: variants[variant].color }}>
|
|
301
|
+
{title}
|
|
302
|
+
</ThemedText>
|
|
303
|
+
)}
|
|
304
|
+
</Pressable>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Composition over configuration
|
|
310
|
+
|
|
311
|
+
When a component's props start describing *content* (`leftIcon`, `subtitle`, `footerText`, `badgeCount`), stop adding props and accept `children` instead. A `Card` that renders `children` with token padding outlives any `Card` with twelve content props. Reserve props for the contract above: variant, size, state, style.
|
|
312
|
+
|
|
313
|
+
### When to extract - and when not to
|
|
314
|
+
|
|
315
|
+
Promote a view into `src/components/` when **all** of these hold:
|
|
316
|
+
|
|
317
|
+
1. It appears (or is about to appear) in **two or more screens**. Until then it stays colocated in `screens/<name>/` (see `expo-project-structure`).
|
|
318
|
+
2. It has a **nameable role** ("Card", "EmptyState", "Badge") - not "the thing on the profile screen".
|
|
319
|
+
3. Its API is **smaller than its implementation**. If the props would just re-expose every internal style, it isn't a reusable component yet - it's a screen fragment.
|
|
320
|
+
|
|
321
|
+
Promotion path: inline JSX → component in `screens/<name>/` → `src/components/`. Move one step at a time, when the trigger fires - never speculatively. Wrong abstractions cost more than duplication; a second copy of a view is cheaper than a primitive with a bad API.
|
|
322
|
+
|
|
323
|
+
Do **not** wrap platform components that already carry the design language (`Switch`, `DateTimePicker`, stack headers, `@expo/ui` views) just to route them through the system. Native styling *is* the design system for those.
|
|
324
|
+
|
|
325
|
+
## Where Decisions Live
|
|
326
|
+
|
|
327
|
+
| Decision | Lives in | Example |
|
|
328
|
+
|---|---|---|
|
|
329
|
+
| A visual value used anywhere twice | `src/theme/` | brand accent, spacing step |
|
|
330
|
+
| Structure + variants of a reused element | `src/components/` | Button, Card, EmptyState |
|
|
331
|
+
| One screen's private composition | `screens/<name>/` | profile header layout |
|
|
332
|
+
| One-off local adjustment | inline, with a comment | optical nudge on an icon |
|
|
333
|
+
| Screen titles, top-level chrome | navigation stack options | header title, large title |
|
|
334
|
+
|
|
335
|
+
## Self-Critique Pass
|
|
336
|
+
|
|
337
|
+
After building or changing a screen, screenshot it and check it against these principles (from [Expo's design-principles guide](https://expo.dev/blog/how-to-apply-professional-design-principles-in-ai-app-development)). Each one maps to a system fix, not a local tweak:
|
|
338
|
+
|
|
339
|
+
- **Hierarchy / contrast** - is the most important element obviously first? Fix with `type` ramp steps, not ad-hoc font sizes.
|
|
340
|
+
- **Proximity / white space** - do related items sit closer than unrelated ones? Fix with `gap` + spacing tokens.
|
|
341
|
+
- **Repetition / unity** - do all corners, shadows, and accents match? If not, a value escaped the theme - move it in.
|
|
342
|
+
- **Alignment** - do edges share axes? Fix with consistent screen edge padding.
|
|
343
|
+
|
|
344
|
+
The pass is complete only when all four checks pass, or every failing value has moved into the theme or a component. If a screen fails the same check twice, the fix belongs in the theme or a component - not in the screen.
|
|
345
|
+
|
|
346
|
+
## Auditing an Existing App
|
|
347
|
+
|
|
348
|
+
To measure drift in an app that already has screens - hardcoded hex values, arbitrary spacing, inconsistent component APIs - follow `./references/audit.md`. It contains grep-based checks, a scoring rubric, an incremental adoption order for fixing a drifted app, and templates for documenting existing components and proposing new ones.
|
|
349
|
+
|
|
350
|
+
## Submitting Feedback
|
|
351
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
352
|
+
```bash
|
|
353
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-design-system" "<actionable feedback>"
|
|
354
|
+
```
|
|
355
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
356
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Expo Design Systems"
|
|
3
|
+
short_description: "Build a design system in an Expo app: a token theme (color, spacing, typography, radius, shadow, motion), reusable component conventions, and audits for design-system drift (hardcoded style values)"
|
|
4
|
+
default_prompt: "Use $expo-design-system to set up or maintain the app's design system: create the src/theme token files, shape reusable components with variant/size/state props, decide when a repeated view becomes a shared component, and audit screens for design-system drift (hardcoded style values)."
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Design System Audit
|
|
2
|
+
|
|
3
|
+
Measure how far an existing Expo app has drifted from a single visual source of truth, then document or extend components with a consistent template.
|
|
4
|
+
|
|
5
|
+
Run the audit **before** proposing changes. Report findings first; apply fixes only when asked.
|
|
6
|
+
|
|
7
|
+
## 0. Locate the directories first
|
|
8
|
+
|
|
9
|
+
Do **not** assume a `src/` folder. The default `create-expo-app` template puts `app/`, `components/`, and `constants/` at the repo root, and running the checks below against a nonexistent `src/` returns zero hits - a false clean bill.
|
|
10
|
+
|
|
11
|
+
Before any grep, identify and record:
|
|
12
|
+
|
|
13
|
+
- **Source directories** - every directory holding app code (`src`, or e.g. `app components constants hooks`).
|
|
14
|
+
- **Theme location** - the token directory or file (`src/theme`, `theme`, `constants`, or a single `theme.ts`). If none exists yet, note that as the first finding.
|
|
15
|
+
- **The existing system, if any** - a styling library in `package.json` (NativeWind, Tamagui, Restyle, Unistyles, styled-components) per `SKILL.md` "Adopt Before You Build". Record which one. The checks below assume this skill's defaults - plain `StyleSheet`, `boxShadow` strings, one `src/theme` entry point. An app on a styling library fails several of them while being perfectly consistent in its own idiom. Audit such an app against its own system: its token names, its scale, its config file as the single entry point. Adapt or skip a check rather than reporting a false violation.
|
|
16
|
+
|
|
17
|
+
Substitute them into the shell variables below; every check uses them.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
SRC="app components constants" # this project's source directories
|
|
21
|
+
THEME="constants" # this project's theme directory (excluded from hits)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 1. Token coverage checks
|
|
25
|
+
|
|
26
|
+
Run from the repo root. Each hit outside the theme directory is a candidate for tokenization - not automatically a violation (check for the "one-off, with a comment" exemption in `SKILL.md`).
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Hardcoded hex colors outside the theme
|
|
30
|
+
grep -rEn '#[0-9a-fA-F]{3,8}\b' $SRC --include='*.tsx' --include='*.ts' | grep -v "^$THEME/"
|
|
31
|
+
|
|
32
|
+
# Raw fontSize (should come from the type ramp / ThemedText)
|
|
33
|
+
grep -rn 'fontSize:' $SRC --include='*.tsx' | grep -v "^$THEME/"
|
|
34
|
+
|
|
35
|
+
# Spacing values outside the named steps of the scale.
|
|
36
|
+
# The whitelist is the project's actual scale (here: the example scale from
|
|
37
|
+
# SKILL.md) - substitute the project's steps before running. Multiples of 4
|
|
38
|
+
# that are not named steps (12, 20, 40, ...) are flagged on purpose: the rule
|
|
39
|
+
# is "use the nearest step". If one keeps recurring, the fix is to add it to
|
|
40
|
+
# the scale and to this whitelist, not to ignore the hits.
|
|
41
|
+
grep -rEn '(padding|margin|gap)[A-Za-z]*:\s*[0-9]+' $SRC --include='*.tsx' \
|
|
42
|
+
| grep -vE ':\s*(0|4|8|16|24|32|48)\b' | grep -v "^$THEME/"
|
|
43
|
+
|
|
44
|
+
# Raw borderRadius (should use radius tokens)
|
|
45
|
+
grep -rn 'borderRadius:' $SRC --include='*.tsx' | grep -v "^$THEME/"
|
|
46
|
+
|
|
47
|
+
# Legacy shadows (banned by expo-native-ui - must be boxShadow)
|
|
48
|
+
grep -rEn 'shadow(Color|Offset|Opacity|Radius)|elevation:' $SRC --include='*.tsx'
|
|
49
|
+
|
|
50
|
+
# Multiple theme entry points (there must be exactly one)
|
|
51
|
+
ls src/theme.ts src/theme/index.ts theme.ts theme/index.ts constants/theme.ts 2>/dev/null
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For a Tailwind project (`expo-tailwind-setup`), also check for values that bypass `global.css` variables: arbitrary-value classes like `p-[13px]` or `text-[#5B21B6]`.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
grep -rEn 'className="[^"]*\[[^"]*\]' $SRC --include='*.tsx'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 2. Scoring
|
|
61
|
+
|
|
62
|
+
Turn raw hit counts into a comparable score so runs can be tracked over time:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Source lines of code (the denominator)
|
|
66
|
+
find $SRC -name '*.tsx' -o -name '*.ts' | xargs wc -l | tail -1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For each category: **score = escapes per 100 source lines** (hits ÷ SLOC × 100, one decimal).
|
|
70
|
+
|
|
71
|
+
| Score per category | Reading |
|
|
72
|
+
|---|---|
|
|
73
|
+
| < 0.5 | Healthy - fix opportunistically |
|
|
74
|
+
| 0.5 - 2.0 | Drifting - schedule cleanup for the worst files |
|
|
75
|
+
| > 2.0 | Systemic - the token or component for this category is missing or unused; fix the system first (see §5) |
|
|
76
|
+
|
|
77
|
+
Report the per-category scores in the summary. The overall priority order falls out of the scores: the highest-scoring category is usually the first migration target.
|
|
78
|
+
|
|
79
|
+
## 3. Component completeness
|
|
80
|
+
|
|
81
|
+
For each component in the shared components directory (`src/components/`, or `components/` in a root-level layout), check it against the contract in `SKILL.md`:
|
|
82
|
+
|
|
83
|
+
| Check | Pass condition |
|
|
84
|
+
|---|---|
|
|
85
|
+
| Variants | Visual intent is a `variant` prop, not boolean soup (`isPrimary`, `isGhost`) |
|
|
86
|
+
| Sizes | Sizes map to spacing/typography tokens |
|
|
87
|
+
| Pressed state | Tappable components give pressed feedback via a `Pressable` style function |
|
|
88
|
+
| Disabled / loading | Handled, and disabled blocks `onPress` |
|
|
89
|
+
| Style override | Accepts `style`, merged last |
|
|
90
|
+
| Accessibility | `accessibilityRole` set; touch target ≥ 44pt |
|
|
91
|
+
| Tokens only | No literals that duplicate a theme value |
|
|
92
|
+
|
|
93
|
+
## 4. Report format
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
## Design System Audit
|
|
97
|
+
|
|
98
|
+
### Summary
|
|
99
|
+
Screens reviewed: [X] | Components reviewed: [X] | Issues: [X]
|
|
100
|
+
|
|
101
|
+
### Token coverage
|
|
102
|
+
| Category | Tokens defined | Escapes found | Score (per 100 SLOC) | Worst offenders |
|
|
103
|
+
|---|---|---|---|---|
|
|
104
|
+
| Colors | [X] | [X] hardcoded hex | [X.X] | [files] |
|
|
105
|
+
| Spacing | [X] | [X] non-step values | [X.X] | [files] |
|
|
106
|
+
| Typography | [X] | [X] raw fontSize | [X.X] | [files] |
|
|
107
|
+
| Radius / shadows / motion | [X] | [X] | [X.X] | [files] |
|
|
108
|
+
|
|
109
|
+
### Component completeness
|
|
110
|
+
| Component | Variants | States | Overrides | Tokens | Notes |
|
|
111
|
+
|---|---|---|---|---|---|
|
|
112
|
+
| Button | OK | missing pressed | OK | OK | ... |
|
|
113
|
+
|
|
114
|
+
### Extraction candidates
|
|
115
|
+
Views repeated across ≥2 screens that are still colocated or duplicated:
|
|
116
|
+
1. [view] - appears in [screens] - suggested name: [Component]
|
|
117
|
+
|
|
118
|
+
### Priority actions
|
|
119
|
+
1. [Highest-leverage fix - usually the most-duplicated escaped value]
|
|
120
|
+
2. ...
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 5. Adopting incrementally
|
|
124
|
+
|
|
125
|
+
An app with dozens of escapes is migrated in order, never big-bang. A big-bang conversion produces one huge unreviewable diff and usually stalls half-done.
|
|
126
|
+
|
|
127
|
+
1. **Create the tokens first.** Derive the scales from the values the audit found most often, snapped to the grid. A theme built from the app's real values gets adopted; an aspirational one gets bypassed.
|
|
128
|
+
2. **Typography before spacing.** Convert raw `fontSize` to the `type` ramp + `ThemedText` first: it is the highest-visibility win and touches the fewest layout decisions. Then spacing, then colors, then radius/shadows.
|
|
129
|
+
3. **Convert one worst-offender file completely** and use it as the reference pattern for the rest of the migration.
|
|
130
|
+
4. **Then convert per-screen**, one screen per commit, using the audit greps scoped to that screen to verify it comes out clean.
|
|
131
|
+
5. **Re-run the audit after each phase** and record the scores from §2 - they should fall monotonically.
|
|
132
|
+
|
|
133
|
+
## 6. Documenting an existing component
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
## Component: [Name]
|
|
137
|
+
|
|
138
|
+
[What it is and when to use it - one paragraph.]
|
|
139
|
+
|
|
140
|
+
### Variants
|
|
141
|
+
| Variant | Use when |
|
|
142
|
+
|---|---|
|
|
143
|
+
| primary | The screen's single main action |
|
|
144
|
+
|
|
145
|
+
### Props
|
|
146
|
+
| Prop | Type | Default | Notes |
|
|
147
|
+
|---|---|---|---|
|
|
148
|
+
|
|
149
|
+
### States
|
|
150
|
+
default / pressed / disabled / loading - visual + behavior for each.
|
|
151
|
+
|
|
152
|
+
### Accessibility
|
|
153
|
+
Role, touch target, screen reader label.
|
|
154
|
+
|
|
155
|
+
### Do / Don't
|
|
156
|
+
| Do | Don't |
|
|
157
|
+
|---|---|
|
|
158
|
+
| [best practice] | [anti-pattern seen in this repo] |
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 7. Proposing a new component
|
|
162
|
+
|
|
163
|
+
Before designing a new primitive, prove the existing set can't cover it:
|
|
164
|
+
|
|
165
|
+
```markdown
|
|
166
|
+
## Proposed: [Name]
|
|
167
|
+
|
|
168
|
+
### Problem
|
|
169
|
+
[The repeated need, and the ≥2 screens that have it.]
|
|
170
|
+
|
|
171
|
+
### Why existing components aren't enough
|
|
172
|
+
| Closest component | What's shared | What's missing |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
|
|
175
|
+
### API
|
|
176
|
+
Props table (variant / size / state / style only - content via children).
|
|
177
|
+
|
|
178
|
+
### Tokens used
|
|
179
|
+
Colors: [...] Spacing: [...] Typography: [...] Radius: [...]
|
|
180
|
+
|
|
181
|
+
### Open questions
|
|
182
|
+
[Decisions that need a human, e.g. does this need a destructive variant?]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If the "what's missing" column is empty for any row, extend that component's variants instead of adding a new one.
|