$npx -y skills add forcedotcom/sf-skills --skill mobile-platform-native-capabilities-integrateBuild a Salesforce LWC that uses native mobile device capabilities — barcode scanner, biometrics, location, NFC, calendar, contacts, document scanner, geofencing, AR space capture, app review, and payments. Use this skill when the user asks for an LWC that scans a barcode, captur
| 1 | # Using Mobile Native Capabilities |
| 2 | |
| 3 | The `lightning/mobileCapabilities` module exposes a set of factory functions |
| 4 | that return service objects for native device features (barcode scanning, |
| 5 | biometrics, location, etc.). Each service extends a common |
| 6 | [BaseCapability](references/base-capability.md) with an `isAvailable()` |
| 7 | method, so an LWC can degrade gracefully on surfaces where the capability is |
| 8 | not present (desktop, mobile web). |
| 9 | |
| 10 | This skill routes an agent through (1) picking the right capability, (2) |
| 11 | loading the authoritative type definitions, and (3) wiring the service into |
| 12 | an LWC with the correct availability gating, error handling, and |
| 13 | deprecation-aware API choice. |
| 14 | |
| 15 | ## When to Use This Skill |
| 16 | |
| 17 | - User asks for an LWC that uses a device capability listed in the index |
| 18 | below. |
| 19 | - User mentions `lightning/mobileCapabilities`, "mobile capability", or |
| 20 | "Nimbus" by name. |
| 21 | - User wants to know which mobile native APIs are available, or which one |
| 22 | fits their feature. |
| 23 | |
| 24 | Do NOT use this skill for: |
| 25 | |
| 26 | - Mobile-offline review of an LWC (lwc:if, inline GraphQL, Komaci-priming |
| 27 | violations) — use `mobile-platform-offline-validate`. |
| 28 | - Choosing or styling generic Lightning Base Components / SLDS blueprints — |
| 29 | use `design-systems-slds-apply`. |
| 30 | |
| 31 | ## Prerequisites |
| 32 | |
| 33 | - Knowledge that the LWC will run inside a supported mobile container |
| 34 | (Salesforce Mobile App, Field Service Mobile App). These capabilities are |
| 35 | unavailable on desktop and mobile web; gate every call behind |
| 36 | `isAvailable()`. |
| 37 | - Familiarity with the `lightning/mobileCapabilities` module declaration |
| 38 | (see [mobile-capabilities](references/mobile-capabilities.md)). |
| 39 | |
| 40 | ## Capability Index |
| 41 | |
| 42 | | Capability | Reference | One-line use | |
| 43 | | --- | --- | --- | |
| 44 | | App Review | [App Review](references/app-review.md) | Prompt the user for a native in-app review. | |
| 45 | | AR Space Capture | [AR Space Capture](references/ar-space-capture.md) | Capture a 3D scan of a physical space using AR. | |
| 46 | | Barcode Scanner | [Barcode Scanner](references/barcode-scanner.md) | Read QR / UPC / EAN / Code-128 / etc. from the camera. | |
| 47 | | Biometrics | [Biometrics](references/biometrics.md) | Authenticate via Face ID / fingerprint. | |
| 48 | | Calendar | [Calendar](references/calendar.md) | Read or create events on the device calendar. | |
| 49 | | Contacts | [Contacts](references/contacts.md) | Read or create entries in the device address book. | |
| 50 | | Document Scanner | [Document Scanner](references/document-scanner.md) | Scan paper documents using the camera with edge detection. | |
| 51 | | Geofencing | [Geofencing](references/geofencing.md) | Trigger logic when the device crosses a geographic boundary. | |
| 52 | | Location | [Location](references/location.md) | Read GPS coordinates and watch for updates. | |
| 53 | | NFC | [NFC](references/nfc.md) | Read or write NFC tags. | |
| 54 | | Payments | [Payments](references/payments.md) | Take an Apple Pay / Google Pay payment. | |
| 55 | |
| 56 | ## Workflow |
| 57 | |
| 58 | ### Step 1 — Identify the capability |
| 59 | |
| 60 | Map the user's feature ask to one row of the capability index. If the ask |
| 61 | spans multiple capabilities (e.g. "scan a barcode and store it on a |
| 62 | contact"), plan for **each** capability separately — there is one factory |
| 63 | function per capability. |
| 64 | |
| 65 | ### Step 2 — Load the shared and capability-specific references |
| 66 | |
| 67 | Read these two shared references **once** per session — they apply to every |
| 68 | capability and are not duplicated in the per-capability files: |
| 69 | |
| 70 | - [BaseCapability](references/base-capability.md) — the common interface |
| 71 | with `isAvailable()` that every service extends. |
| 72 | - [mobile-capabilities](references/mobile-capabilities.md) — the |
| 73 | `lightning/mobileCapabilities` module declaration showing every |
| 74 | re-exported service. |
| 75 | |
| 76 | Then open the capability's reference file from the table above. Each |
| 77 | per-capability reference contains the service-specific TypeScript API |
| 78 | (factory function, service interface, options types, result types, error |
| 79 | types) and assumes the two shared references above are already in context. |
| 80 | |
| 81 | Do not infer the API from memory — read it. The services evolve and some |
| 82 | methods are explicitly `@deprecated` in favor of newer alternatives. |
| 83 | |
| 84 | ### Step 3 — Wire the service into the LWC |
| 85 | |
| 86 | For |