Установка
SKILL.md
Using Mobile Native Capabilities
The lightning/mobileCapabilities module exposes a set of factory functions
that return service objects for native device features (barcode scanning,
biometrics, location, etc.). Each service extends a common
BaseCapability with an isAvailable()
method, so an LWC can degrade gracefully on surfaces where the capability is
not present (desktop, mobile web).
This skill routes an agent through (1) picking the right capability, (2) loading the authoritative type definitions, and (3) wiring the service into an LWC with the correct availability gating, error handling, and deprecation-aware API choice.
When to Use This Skill
- User asks for an LWC that uses a device capability listed in the index below.
- User mentions
lightning/mobileCapabilities, "mobile capability", or "Nimbus" by name. - User wants to know which mobile native APIs are available, or which one fits their feature.
Do NOT use this skill for:
- Mobile-offline review of an LWC (lwc:if, inline GraphQL, Komaci-priming
violations) — use
mobile-platform-offline-validate. - Choosing or styling generic Lightning Base Components / SLDS blueprints —
use
design-systems-slds-apply.
Prerequisites
- Knowledge that the LWC will run inside a supported mobile container
(Salesforce Mobile App, Field Service Mobile App). These capabilities are
unavailable on desktop and mobile web; gate every call behind
isAvailable(). - Familiarity with the
lightning/mobileCapabilitiesmodule declaration (see mobile-capabilities).
Capability Index
| Capability | Reference | One-line use |
|---|---|---|
| App Review | App Review | Prompt the user for a native in-app review. |
| AR Space Capture | AR Space Capture | Capture a 3D scan of a physical space using AR. |
| Barcode Scanner | Barcode Scanner | Read QR / UPC / EAN / Code-128 / etc. from the camera. |
| Biometrics | Biometrics | Authenticate via Face ID / fingerprint. |
| Calendar | Calendar | Read or create events on the device calendar. |
| Contacts | Contacts | Read or create entries in the device address book. |
| Document Scanner | Document Scanner | Scan paper documents using the camera with edge detection. |
| Geofencing | Geofencing | Trigger logic when the device crosses a geographic boundary. |
| Location | Location | Read GPS coordinates and watch for updates. |
| NFC | NFC | Read or write NFC tags. |
| Payments | Payments | Take an Apple Pay / Google Pay payment. |
Workflow
Step 1 — Identify the capability
Map the user's feature ask to one row of the capability index. If the ask spans multiple capabilities (e.g. "scan a barcode and store it on a contact"), plan for each capability separately — there is one factory function per capability.
Step 2 — Load the shared and capability-specific references
Read these two shared references once per session — they apply to every capability and are not duplicated in the per-capability files:
- BaseCapability — the common interface
with
isAvailable()that every service extends. - mobile-capabilities — the
lightning/mobileCapabilitiesmodule declaration showing every re-exported service.
Then open the capability's reference file from the table above. Each per-capability reference contains the service-specific TypeScript API (factory function, service interface, options types, result types, error types) and assumes the two shared references above are already in context.
Do not infer the API from memory — read it. The services evolve and some
methods are explicitly @deprecated in favor of newer alternatives.
Step 3 — Wire the service into the LWC
For each capability:
- Import the factory from
lightning/mobileCapabilities:<!-- -->import { getBarcodeScanner } from 'lightning/mobileCapabilities'; - Get an instance:
const scanner = getBarcodeScanner(); - Gate the call behind
isAvailable():<!-- -->if (!scanner.isAvailable()) { // graceful fallback or user message return; } - Call the non-deprecated entry point. Several services keep older
methods marked
@deprecatedalongside the recommended one — always prefer the recommended method in the reference. - Wrap the promise in
try/catchand handle the typed failure codes the service exposes (e.g.BarcodeScannerFailureCode,LocationServiceFailureCode). User-cancelled vs. permission-denied vs. service-unavailable are distinct UX states.
Step 4 — Surface failure modes to the user
Each service defines its own failure-code enum. Translate codes into
user-actionable messages: a USER_DENIED_PERMISSION should ask the user to
grant permission; a USER_DISABLED_PERMISSION must direct them to the OS
settings; a SERVICE_NOT_ENABLED should be a developer-visible error, not
shown to the user.
Step 5 — Stay inside the supported surface
Mobile capabilities are available only when the LWC runs inside a
supported Salesforce mobile app. If the same component is rendered on
desktop or mobile web, the factory will still return an object but
isAvailable() will return false. Never assume availability — gate every
call.
Examples
Example — "Scan a barcode and write it into a field"
- Map to: Barcode Scanner.
- Read Barcode Scanner.
- Use
scan(options)(not the deprecatedbeginCapture/resumeCapture/endCapturetriple). - In options, set the
barcodeTypesto the symbologies needed (default is all supported types) andenableMultiScan: falsefor a single read. - On resolve, write
result[0].valueto the bound field. On reject, inspecterror.codeagainstBarcodeScannerFailureCode.
Example — "Take an Apple Pay payment for an order total"
- Map to: Payments.
- Read Payments.
- Gate on
isAvailable(). - Build the payment request object per the reference.
- On resolve, surface the transaction id to the calling flow. On reject, handle user-cancelled and payment-failed paths separately.
Verification Checklist
- <!-- -->Every capability call is preceded by
isAvailable(). - <!-- -->The non-deprecated entry point is used (no
beginCapture/resumeCapture/endCapturefor barcode, etc.). - <!-- -->Each rejection path is mapped to the typed failure code enum.
- <!-- -->Imports come from
lightning/mobileCapabilities, not from a private path. - <!-- -->No assumption that the capability runs on desktop or mobile web.
Troubleshooting
isAvailable()returnsfalseon a real device — the device is running an unsupported app surface (not Salesforce Mobile or Field Service Mobile), or the service is gated by an org-level setting. The fix is org configuration, not code.- TypeScript can't find the import — confirm the LWC has access to
lightning/mobileCapabilities. The module is declared globally inside Salesforce mobile containers; outside that, the types must be installed separately. - Deprecated barcode methods still work — yes, but new code must use
scan()anddismiss(). Refactor any sample code the agent received before returning it. - Multiple capabilities in one component — get separate instances per capability (they are independent service objects); do not try to share state between them.
Вставить в README
Ссылка на карточку для вашего README — без картинок и счётчиков.
[DarkPlay: mobile-platform-native-capabilities-integrate](https://darkplay.ru/ai/skills/forcedotcom-sf-skills-mobile-platform-native-capabilities-integrate)
Из того же репозитория
Похожие скиллы и другие разделы каталога
Самые востребованные скиллов раздела по установкам и звёздам.
find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.Соседние разделы каталога: возможно, нужный инструмент живёт там.
eccaffaan-m · Нативный для harness операторский слой ECC: 67 агентов, 278 навыков, 94 шима устаревших…
A11y Architectaffaan-m · Архитектор доступности, специализирующийся на соответствии WCAG 2.2 для веба и нативных…
ui-ux-pro-maxnextlevelbuilder · Профессиональные знания по UI/UX-дизайну для ИИ-ассистентов программирования. Включает…
ruflo-rvfruvnet · Формат RVF для переносимой памяти агентов, сохранения сессий и кросс-платформенного…
ppt-masterhugohe3 · Генерирует нативно редактируемый PPTX из PDF / DOCX / URL / Markdown: настоящие фигуры…
agentic-bundle-aas-api-platform-buildersickn33 · Установите набор редакционных навыков «AAS API Platform Builder» для Claude Code.
agentic-bundle-aas-data-engineering-platformsickn33 · Установите набор редакционных навыков «AAS Data Engineering Platform» для Claude Code.
agentic-bundle-aas-mobile-app-buildersickn33 · Установите набор редакционных навыков "AAS Mobile App Builder" для Claude Code.
agentic-bundle-apple-platform-designsickn33 · Установите набор редакционных навыков "Apple Platform Design" для Claude Code.
agentic-bundle-expo-react-nativesickn33 · Установите набор редакционных навыков "Expo & React Native" для Claude Code.Лучшие ИИ-инструменты для программирования
Подборка нейросетей и ИИ-ассистентов для разработки и автоматизации кода. Сервисы, которые ускоряют написание, ревью и отладку, экономят часы рутины и снижают порог входа в сложные
GenAPIGenapi
Notepad++ AINotepad-plus-plus
Creatium MaxCremax
Emacs AIGnu
KiteKite
Amazon Q DeveloperAmazonЛучшие ИИ-инструменты для генерации видео
Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,
VEED.IOVeed
MootionMootion
Sora (OpenAI)OpenAI
viralpulse.appViralpulse
Viral Maker AIViral-makerЛучшие ИИ-инструменты для генерации текста и копирайтинга
Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра
NeuroscribeNeuroscribe
GoGPTGogpt
НейроТекстерNeuro-texter
ChatGPTOpenAI
Cosmo ScribeCosmoscribe
Memo HelperCopilot33
LibraChatLibrachat