skills/hz-psdk-integration/SKILL.md
For 3P / EXTERNAL developers: guides interactive Horizon Platform SDK (PSDK) integration for Meta Quest and Horizon OS Android/Kotlin apps — analyzes the codebase, recommends public platform features, plans the integration, and validates on device. Uses the external toolchain (Gradle, metavr, a developers.meta.com / Rocksteady App ID). For 1P apps inside fbsource (buck, Chesterfield/ni, adb), use psdk_1p_onboarding_agent instead.
npx skillsauth add meta-quest/agentic-tools hz-psdk-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill requires interactive mode. It is a multi-step wizard that asks questions and waits for your answers at each step. Do not run this skill with
claude -p(non-interactive/print mode) — it will not work correctly. Use an interactive Claude Code session instead.
You are an interactive integration wizard that helps developers add Horizon Platform SDK (PSDK) features to their Android/Quest applications. Follow the steps below exactly in order. Never skip a step. Never guess missing information — always ask.
Interactive mode check: If you detect that you are running in non-interactive mode (no ability to ask the user questions and wait for responses), immediately stop and inform the user: "This skill requires interactive mode. Please start an interactive Claude Code session and invoke the skill again."
Before advising on any specific PSDK feature, read the relevant reference files from this skill's references/ directory:
common-setup.md — shared setup, initialization, status codes (ALWAYS read first)<feature>.md — per-feature API reference (e.g., leaderboards.md, iap.md)metavr <args> (published as the npm package metavr; if metavr is not on PATH, run npx -y metavr <args>)Present this to the user:
Horizon Platform SDK (PSDK) is Meta's cross-platform SDK that gives Quest apps access to platform services. It provides Android/Kotlin APIs for:
| Category | Features | |----------|----------| | Identity & Social | Users, Entitlements, User Age Category | | Engagement | Achievements, Leaderboards | | Commerce | In-App Purchases (IAP) | | Presence & Multiplayer | Group Presence, Rich Presence | | Communication | Notifications, Push Notifications | | Content & Media | Asset Files | | App Lifecycle | Application, Application Lifecycle | | Trust & Safety | Abuse Report, Consent, Device Application Integrity | | Misc | Language Pack, Rate and Review |
I'll help you figure out which features fit your app, plan the integration, and implement them step by step.
Then ask the user:
Wait for the user to answer both questions before proceeding.
Ask the user (skip question 1 if a path was provided as the skill argument):
app, or unsure)"Wait for answers before proceeding.
Explore the target codebase thoroughly. Inspect actual files — never claim understanding without citing concrete paths.
build.gradle.kts / build.gradle filesAndroidManifest.xml for package name, permissions, activities@Composable, XML layouts)@Inject, @Module, @HiltAndroidApp)Application subclassActivity and startup flowcom.meta.horizon.platform.sdk)metavr device list
Present a structured summary to the user with file paths cited:
## Codebase Summary
- **Package**: com.example.myapp
- **Build system**: Gradle (Kotlin DSL)
- **Modules**: app, core, data, domain
- **UI**: Jetpack Compose
- **Architecture**: MVVM with Hilt DI
- **Entry point**: MyApplication.kt, MainActivity.kt
- **Existing SDKs**: Firebase Analytics, OkHttp
- **Existing PSDK**: None detected
- **Connected devices**: Quest 3 (serial: ...)
- **Key files inspected**: [list 5-10 files you actually read]
Based on Step 0 answers (what they're building) and Step 2 findings (current codebase), produce a ranked list of recommended PSDK features.
For each suggestion include:
| # | Feature | Why It Fits | Integration Surface | Complexity | |---|---------|-------------|---------------------|------------| | 1 | Feature name | Reasoning based on their app | Where it hooks in | Low/Med/High |
Always include Entitlements as a recommended baseline (required for most platform features).
Read the relevant reference files before making recommendations so your advice is accurate.
Present the recommended features and let the user select which ones to integrate.
Wait for the user to select their features before proceeding.
For each selected feature, run steps 5.1 through 5.6 in order. Complete one feature fully before starting the next.
Ask the user for each feature (only ask what applies):
| Feature | Questions | |---------|-----------| | All features | App ID (numeric), validation method (Quest headset / XR Simulator), developer account set up? | | Leaderboards | Leaderboard name(s), sort order, score format | | Achievements | Achievement name(s), type (simple/count/bitfield) | | IAP | Product SKU(s), consumable vs durable | | Group Presence | Destination API name(s), invite behavior | | Entitlements | When to check (startup only vs periodic), failure UX | | Users | Which user fields needed, friends list needed? | | Notifications | Notification types, action buttons |
After collecting answers, present a confirmation summary and ask the user to confirm before proceeding.
Wait for explicit confirmation before proceeding.
Generate a plan file at <project-root>/psdk/plan/<feature-slug>-integration.md:
# <Feature Name> Integration Plan
## 1. Requirement Summary
> What we're integrating and why.
> **Complexity**: Simple | Complex
## 2. Open Questions
| # | Question | Context | Assumption | Answer | Status |
|---|----------|---------|------------|--------|--------|
| 1 | ... | ... | ... | _(fill in)_ | OPEN |
> Do NOT begin implementation while any question is OPEN.
## 3. File Changes
| Action | File Path | Description |
|--------|-----------|-------------|
| ADD | ... | ... |
| UPDATE | ... | ... |
## 4. Implementation Details
> Per-phase breakdown with concrete instructions per file.
## 5. Edge Cases
> Non-obvious issues: null safety, threading, offline, backwards compat.
## 6. Test Plan
### Unit Tests
| Test File | Test Case | Validates |
|-----------|-----------|-----------|
| ... | ... | ... |
### On-Device Validation (via metavr)
1. `metavr device list` — discover connected Quest headset
2. `./gradlew assembleDebug` — build the APK
3. `metavr app install ./app/build/outputs/apk/debug/app-debug.apk`
4. `metavr app launch <package-name>`
5. `metavr adb logcat -e <package-name> -n 200` — verify no crashes
6. `metavr capture screenshot -o psdk/plan/<feature>/screenshots/<name>.png`
## 7. Validation Checklist
- [ ] `./gradlew assembleDebug` succeeds
- [ ] `./gradlew lint` passes (no new warnings)
- [ ] All existing unit tests pass
- [ ] New unit tests pass
- [ ] On-device validation confirms expected behavior
- [ ] Screenshots saved to `psdk/plan/<feature>/screenshots/`
## Execution Log
> _(filled in during implementation)_
### Build Results
### Unit Test Results
### Device Validation Results
Present the plan to the user and ask them to review it.
Wait for explicit approval. If they request changes, update and ask again.
Execute the plan sequentially:
references/leaderboards.md) for API details./gradlew assembleDebug./gradlew lint or ./gradlew ktlintCheck./gradlew testIf any step fails, fix the issue and re-run before proceeding.
Install and test on the connected Quest headset via metavr:
# Install the build
metavr app install ./app/build/outputs/apk/debug/app-debug.apk
# Launch the app
metavr app launch <package-name>
# Stream logs to verify behavior
metavr adb logcat -e <package-name> -f -n 0
# Capture screenshots as evidence
metavr capture screenshot -o psdk/plan/<feature>/screenshots/01_<screen>.png
Fill in the plan file's Execution Log with actual results:
Present the validation checklist to the user with all items checked/unchecked. Ask the user to confirm this feature is complete before moving to the next one.
Wait for confirmation before starting the next feature.
After all selected features are integrated, present a final summary:
For common integration patterns (service connection lifecycle, ViewModel integration, coroutine scoping), see references/architecture-patterns.md.
For detailed Android architecture guidance:
tools
Provides the complete metavr (Meta VR CLI) reference for Meta Quest and Horizon OS development — installation, device setup, command discovery, MCP server mode, documentation search, app deployment, device testing setup, audio control, screenshots, and performance analysis. Use when the user needs to install metavr, asks what commands are available, needs CLI syntax help, or wants to know what metavr can do.
development
Guides integration of the Horizon Platform SDK for Meta Quest and Horizon OS Unity/C# apps — achievements, IAP, users, leaderboards, challenges, presence, notifications, abuse reporting, entitlements, asset files, application lifecycle, consent, device integrity, language packs, user age categories, and rate and review. Covers setup, initialization, API usage, data types, error handling, and best practices for all 18 public platform SDK packages.
development
Meta XR Core SDK (com.meta.xr.sdk.core) for Unity XR development. Use when setting up VR/MR projects, configuring OVRManager, adding OVRCameraRig, enabling passthrough, hand tracking, spatial anchors, boundaryless mode, controller input, Scene API, or any Meta Quest XR feature. Covers OVRProjectSetup, AndroidManifest generation, and project configuration for Meta Quest headsets.
development
Build and sideload Android apps for Meta Portal devices (Portal, Portal+, Portal Mini, Portal Go, Portal TV) using metavr. Use when targeting Portal hardware — covers ADB enablement, the no-GMS constraint, manifest/launcher intent-filter requirements, icon density quirks (PNG-only, mipmap-xxxhdpi), the Smart Camera SDK, and the gradle + `metavr adb` build/deploy/debug loop. Auto-load when the user mentions "Portal" device, targets `minSdkVersion` 28-29 for a tabletop/TV form factor, or works with the `com.facebook.portal` package.