openclix-init
npx skills add https://github.com/openclix/openclix --skill openclix-init
Agent 安装分布
Skill 文档
OpenClix Init
Purpose
This skill adds OpenClix functionality by copying client code into the user project, not by installing an SDK package.
Use a local-source integration model (shadcn-style): copy, adapt, wire, verify.
Core Rules
- Detect the real platform first using project files.
- Prioritize minimal edits to existing user code.
- Keep all OpenClix files in a dedicated namespace/directory.
- Reuse existing dependencies whenever possible.
- Do not add or update dependencies without explicit user approval.
- Run a build after integration and fix only integration-caused issues.
- Do not use in-memory fallback in production integration paths.
Platform Detection
Use file evidence in this order:
| Priority | Platform | Required Evidence |
|---|---|---|
| 1 | Expo | app.json or app.config.* with expo |
| 2 | React Native | package.json with react-native and typical ios/ + android/ structure |
| 3 | Flutter | pubspec.yaml with Flutter SDK |
| 4 | iOS native | *.xcodeproj or *.xcworkspace or Package.swift |
| 5 | Android native | build.gradle or build.gradle.kts |
If signals conflict, trust concrete file evidence and report the mismatch.
Template Selection
- Expo / React Native:
templates/react-native/ - Flutter:
templates/flutter/ - iOS:
templates/ios/ - Android:
templates/android/(package namespaceai.openclix.*)
templates/react-native/ is the canonical reference when platform ports need alignment.
Integration Workflow
- Identify platform and current startup/event/lifecycle entry points.
- Copy the selected template into a dedicated OpenClix area in the user project.
- Wire only required touchpoints:
- initialization at app startup
- event tracking call path
- foreground/app lifecycle trigger
- Keep existing architecture and code style intact; avoid broad refactors.
- Validate against
references/openclix.schema.jsonwhen config/schema changes are involved.
Adapter Selection Rules
Select adapters using existing dependencies only:
- Choose concrete adapters at integration time; avoid runtime dependency auto-detection.
- If the project already has a supported persistent storage dependency, wire that implementation.
- If notification libraries already exist, wire the matching scheduler adapter.
- If no compatible dependency exists, fail fast with a clear integration error.
- Keep degraded in-memory paths out of production template defaults.
React Native / Expo storage selection:
- AsyncStorage project: use
AsyncStorageCampaignStateRepository. - MMKV project: use
MmkvCampaignStateRepository. - If both exist, prefer the project standard and copy only one storage adapter into the app.
- Inject
campaignStateRepositoryexplicitly when callingClix.initialize(...).
React Native / Expo scheduler selection:
- Notifee project: create
new NotifeeScheduler(notifee). - Expo notifications project: create
new ExpoNotificationScheduler(ExpoNotifications). - Inject
messageSchedulerexplicitly when callingClix.initialize(...).
Platform expectations:
- React Native / Expo:
- Do not use runtime adapter auto-detection in
Clixcore. - Select storage/scheduler implementations during integration and inject dependencies explicitly.
- If compatible implementations are unavailable, initialization must fail with clear instructions.
- Do not use runtime adapter auto-detection in
- Flutter:
- Use callback-based scheduler adapter for existing notification plugin
- Require an explicit scheduler and state repository dependency at initialization
- iOS / Android native:
- Use platform-native implementations by default
- Do not introduce in-memory/no-op fallback as the default runtime behavior
Directory and Namespace Policy
OpenClix files must stay grouped in a dedicated location:
- React Native / Expo:
src/openclix/ - Flutter:
lib/openclix/ - iOS:
OpenClix/orSources/OpenClix/ - Android:
app/src/main/kotlin/ai/openclix/withai.openclix.*packages
Dependency Policy
Before changing dependencies:
- Check what the selected template expects.
- Check what the user project already has.
- Prefer existing project libraries or platform APIs.
- If replacement is possible, adapt template code instead of adding dependencies.
- If no safe replacement exists, ask for approval before any dependency add/update.
Never run package-manager install/update commands without approval.
Build Verification
After wiring, run platform-appropriate build/analysis commands based on detected project structure. Prefer project-native commands first (existing scripts, Gradle tasks, Xcode scheme, Flutter workflow).
If unclear, use common fallback commands:
- React Native / Expo:
npx tsc --noEmit - Android:
./gradlew assembleDebug - iOS:
xcodebuild -scheme <scheme> buildorswift build - Flutter:
flutter analyze
If build fails, apply minimal targeted fixes and retry. Stop only on hard blockers.
Completion Checklist
- OpenClix code added under dedicated namespace/directory.
- Existing app code changes are minimal and localized.
- No unapproved dependency additions or upgrades.
- Adapter wiring prefers existing dependencies and fails fast when unavailable.
- Build verification executed.
- Any remaining blockers clearly reported.