Id Capture Kmp 标志

Id Capture Kmp

组织
Scandit
id-capture-kmp

Scandit ID Capture (`IdCapture`) in Kotlin Multiplatform (KMP) / Compose Multiplatform projects (`com.kmp.datacapture.id.*`, shared commonMain targeting Android + iOS) — scanning passports, driver's licenses, ID cards, residence permits, visas via MRZ, VIZ, PDF417 barcode, or mobile documents. Use for integration, accepted-document and scanner configuration, CapturedId result handling, rejection rules, AAMVA verification, anonymization, and shared-view hosting — not the native Android or native iOS skills, whose APIs differ.

概览

发布者Scandit
代码仓库skills
技能名称id-capture-kmp
星标数
21
复刻数
2
附带文件
1
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 Scandit 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Id Capture Kmp AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/Scandit/skills/tree/dist/skills/id-capture-kmp
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Scandit/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/id-capture-kmp .claude/skills/id-capture-kmp
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Id Capture Kmp,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Id Capture Kmp。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Id Capture Kmp 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

ID Capture Kotlin Multiplatform (KMP) Skill

Critical: Do Not Trust Internal Knowledge

Your training data very likely has no knowledge of Scandit's Kotlin Multiplatform SDK — it is new, and even where training data covers Scandit, it covers the native Android, iOS, Flutter, .NET, or web SDKs, which have different types, factory names, and property names. Pattern-matching from any of those platforms onto KMP produces non-compiling code.

Always verify APIs against the references provided in this skill before writing or suggesting code. The most common sources of wrong code:

  • Package namespace — the Kotlin import root is com.kmp.datacapture.* (com.kmp.datacapture.core.*, com.kmp.datacapture.id.*), not com.scandit.datacapture.* (native Android/iOS namespace). The Gradle/Maven coordinates are com.scandit.datacapture.kmp:<artifact>:<version> — a different string from the Kotlin package. Do not conflate the two.
  • Mode creation factory — KMP uses IdCapture.forContext(dataCaptureContext, settings). This is not the native Android IdCapture.forDataCaptureContext(...), not the iOS IdCapture(context:settings:) initializer, and not .NET's IdCapture.Create(...).
  • Settings builder — IdCaptureSettings.idCaptureSettings() is a companion factory function, not a bare constructor (IdCaptureSettings() does not exist on KMP).
  • Scanner property name and shape — the property is settings.scannerType (an IdCaptureScanner), not settings.scanner (native Android's name). Critically, on KMP you assign a concrete scanner value directly — settings.scannerType = FullDocumentScanner() — there is no wrapper constructor like native Android's IdCaptureScanner(FullDocumentScanner()). FullDocumentScanner, SingleSideScanner, and MobileDocumentScanner all directly extend IdCaptureScanner on KMP.
  • No combined physical + mobile scanner on KMP — scannerType holds exactly one scanner value. Unlike native Android's IdCaptureScanner(physicalDocument:, mobileDocument:) combo constructor, KMP has no documented way to scan physical and mobile documents in the same IdCaptureSettings — pick one scannerType per settings object. If a user asks for both simultaneously, say this is not available on KMP rather than inventing a combined constructor.
  • SingleSideScanner has a 4th parameter on KMP — SingleSideScanner(barcode: Boolean, machineReadableZone: Boolean, visualInspectionZone: Boolean, freeFormText: Boolean = false). The freeFormText parameter is KMP-specific.
  • Result property naming drift from native Android — capturedId.sexType (a Sex enum: FEMALE / MALE / UNSPECIFIED), not capturedId.sex. Zone results are capturedId.mrz / .viz / .barcode / .mobileDocument / .mobileDocumentOcr — never mrzResult/vizResult/barcodeResult.
  • Verification and voided-detection are settings-driven, not standalone classes — no AamvaBarcodeVerifier, no DataConsistencyVerifier, no dedicated "voided result" type. Set settings.rejectForgedAamvaBarcodes / rejectInconsistentData / rejectVoidedIds and read capturedId.verificationResult (for AAMVA/consistency) or the RejectionReason.DOCUMENT_VOIDED case (for voided detection).
  • Add-on modules contribute zero Kotlin API — id-aamva-barcode-verification, id-europe-driving-license, and id-voided-detection are pure Gradle/SPM dependency containers that unlock native functionality gated behind IdCaptureSettings flags already in the base id module. Do not invent imports like com.kmp.datacapture.idAamvaBarcodeVerification.SomeClass — there is nothing to import from them.
  • Overlay factories — IdCaptureOverlay.withIdCapture(idCapture) / IdCaptureOverlay.withIdCaptureForView(idCapture, view). Not .newInstance(...) (native Android) and not a constructor.
  • Enum casing — UPPER_SNAKE_CASE throughout: IdCaptureRegion.ANY, RejectionReason.DOCUMENT_EXPIRED, IdAnonymizationMode.FIELDS_AND_IMAGES, IdLayoutStyle.ROUNDED — never Swift-style .any / .documentExpired.
  • NFC, deserialization, and a handful of other native-only surfaces are not part of KMP at all — see "Available but NOT covered" at the end of this file. Don't suggest them; they don't exist on this SDK.

Forbidden APIs (commonly hallucinated — do NOT emit these)

Do NOT writeUse instead
IdCapture.forDataCaptureContext(context, settings) (native Android) / IdCapture(context:settings:) (iOS) / IdCapture.Create(...) (.NET)IdCapture.forContext(dataCaptureContext, settings)
IdCaptureSettings() (bare constructor)IdCaptureSettings.idCaptureSettings()
settings.scanner = IdCaptureScanner(FullDocumentScanner()) (native Android wrapper style)settings.scannerType = FullDocumentScanner()
settings.scanner = IdCaptureScanner(physicalDocument = ..., mobileDocument = ...) (combined scanner)Not available on KMP — pick one scannerType value
IdCaptureOverlay.newInstance(idCapture, dataCaptureView) (native Android)IdCaptureOverlay.withIdCaptureForView(idCapture, dataCaptureView) or IdCaptureOverlay.withIdCapture(idCapture)
capturedId.sexcapturedId.sexType (a Sex enum)
capturedId.mrzResult / .vizResult / .barcodeResultcapturedId.mrz / .viz / .barcode
AamvaBarcodeVerifier(...) / DataConsistencyVerifier(...)settings.rejectForgedAamvaBarcodes / settings.rejectInconsistentData, then read capturedId.verificationResult
import com.kmp.datacapture.idAamvaBarcodeVerification.* or similarly named add-on importsNothing to import — add the Gradle/SPM dependency only, then use the base-module IdCaptureSettings flags
IdCaptureRegion.Any / .us / RejectionReason.documentExpired (camelCase)IdCaptureRegion.ANY / IdCaptureRegion.US / RejectionReason.DOCUMENT_EXPIRED
DataCaptureContext.forLicenseKey(key) as the primary patternDataCaptureContext.initialize("...") (the pattern used by the official KMP samples; forLicenseKey also exists but is not the canonical sample form)
com.scandit.datacapture.id.* importscom.kmp.datacapture.id.* (Kotlin package differs from the Maven group)

Product Guidance

  • This is a shared-code SDK — most logic belongs in commonMain. DataCaptureContext, IdCaptureSettings, IdCapture, IdCaptureListener, and the DataCaptureView setup all live in a shared ScreenModel/view-model class in commonMain. Only the thin hosting code (embedding the native view, driving lifecycle events) differs between androidApp and iosApp.
  • Accept only the documents you actually need. Ask which document types and regions. Documents not in acceptedDocuments are rejected with RejectionReason.NOT_ACCEPTED_DOCUMENT_TYPE.
  • Pick the scanner that matches the data you need. FullDocumentScanner() for both sides/all zones, SingleSideScanner(...) for a specific zone, MobileDocumentScanner(...) for mDL/ISO 18013-5. See references/integration.md.
  • Handle onIdRejected, not just onIdCaptured. Give the user a distinct message per RejectionReason.
  • Both listener callbacks may run off the main thread on the native side — dispatch UI-affecting state changes through the shared StateFlow/ScreenModel pattern shown in references/integration.md, the same way the official samples do, rather than mutating UI state directly from the callback.
  • AAMVA verification, EU driving-license back-decoding, and voided-document detection each require an extra Gradle/SPM dependency in addition to the base id artifact — the add-on module exists purely to link the native detection library; the Kotlin API is entirely on the base IdCaptureSettings/CapturedId. Forgetting the add-on dependency means the settings flag has no effect at runtime.
  • iOS ships as a single umbrella SPM package (Scandit/datacapture-kmp-spm) — pick one variant that includes id (and any add-ons you use); an app can only link one Scandit KMP Kotlin framework.
  • Hand off to a different skill for non-ID-Capture questions. If the user asks about Barcode Capture, SparkScan, MatrixScan, or Label Capture on KMP, or about native Android/iOS ID Capture, defer to the appropriate skill.

Intent Routing

Based on the user's request, load references/integration.md and follow it. It covers:

  • Prerequisites (Gradle/SPM dependencies, license key, camera permissions)
  • Minimal integration (shared DataCaptureContext → IdCaptureSettings → IdCapture → DataCaptureView/IdCaptureOverlay → Android/iOS hosting)
  • Scanner types and accepted/rejected documents
  • Handling results (CapturedId) and rejection (RejectionReason)
  • Feedback and overlay customization
  • AAMVA/USDL verification and data-consistency checks (the id-aamva-barcode-verification add-on)
  • EU driving-license back decoding (the id-europe-driving-license add-on)
  • Voided-document detection (the id-voided-detection add-on)
  • The Compose Multiplatform IdCaptureView composable (the id-compose module)
  • Lifecycle and teardown
  • Pitfalls specific to this platform

This is an integration-only skill — there is no separate migration guide because the KMP SDK has no prior major version to migrate from.

API Usage Policy

Only use APIs that are explicitly documented in the Scandit references below or verified in references/integration.md. Do not invent or guess method signatures, parameters, or property names. If unsure whether an API exists or how to call it — or if a compile error occurs — fetch the relevant documentation page before responding. Do not tell the user to check the docs themselves. After answering, always include the relevant link so the user can explore further.

Never construct or guess documentation URLs. When you need a specific class or property's API page:

  1. First check whether the page you already fetched contains a direct hyperlink to it.
  2. If no direct link was found, fetch the Get Started / Advanced page (see the References table below), extract the actual link, and follow that.

URL structures vary and guessing will lead to 404s.

Licence key

Scanning needs a Scandit licence key. For this skill the licence product is native and the licence platforms are ios and android.

Work through these in order — never block the user on MCP:

  1. The Scandit MCP server is connected — call ensure_scanner_setup with product native and platforms ios and android, app_identifier (the app's bundle or application id; for web, its production domain, never localhost) and env_var SCANDIT_LICENSE_KEY. Do not run the command it returns. Then call get_license_key with the key's id, from that result or from list_license_keys; if list_license_keys shows the key is not a trial, ask the user before fetching it. Show at most a masked preview in chat; never print a full key.

  2. It is not connected — tell the user once that they can connect the remote Scandit MCP server, https://ssl.scandit.com/mcp, in their MCP client, then continue from step 1. Do not edit MCP client configuration yourself.

    Authentication is browser-based, so it is not supported headless or in CI. The server provisions trial keys only; it never creates, revokes, or modifies production licences.

  3. The user declines, or has no MCP client — they generate a key themselves at https://ssl.scandit.com (no account yet: https://ssl.scandit.com/dashboard/sign-up?p=test) and paste it in.

Then put the key into the code: write it into the licence-key call in place of the placeholder — the key get_license_key returned, or the one the user pastes or gives you — still showing only a masked preview in chat. Do not search the project, its files or the environment for a key.

References

TopicResource
ID Capture overview (KMP)Intro
Get Started (KMP)Get Started
Full integration guidereferences/integration.md
Advanced (scanner modes, verification, Compose)Advanced Configurations
Supported documentsSupported Documents
Core concepts (context, camera, views, Compose)Core Concepts

API surface this skill covers

Covers the KMP ID Capture surface as of 8.6, the release it shipped in (all classes below are annotated kmp=8.6 in the SDK docs). Later versions add to this surface rather than replacing it — check the linked reference pages for anything not listed here.

  • IdCapture — IdCapture.forContext(dataCaptureContext: DataCaptureContext?, settings: IdCaptureSettings): IdCapture; isEnabled: Boolean; dataCaptureContext: DataCaptureContext? (read-only); feedback: IdCaptureFeedback; externalTransactionId: String?; addListener(listener) / removeListener(listener); applySettings(settings); reset(); static createRecommendedCameraSettings(): CameraSettings.
  • IdCaptureSettings — factory IdCaptureSettings.idCaptureSettings(); properties scannerType: IdCaptureScanner, acceptedDocuments / rejectedDocuments: List<IdCaptureDocument>, rejectExpiredIds, rejectIdsExpiringIn: Duration?, rejectVoidedIds, rejectHolderBelowAge: Int?, rejectionTimeoutSeconds: Int, rejectNotRealIdCompliant, rejectForgedAamvaBarcodes, rejectInconsistentData, decodeBackOfEuropeanDrivingLicense, anonymizationMode: IdAnonymizationMode, anonymizeDefaultFields; methods setShouldPassImageTypeToResult(type, value) / getShouldPassImageTypeToResult(type), addAnonymizedField(document, fieldType) / removeAnonymizedField(...) / clearAnonymizedFields().
  • IdCaptureScanner — base type of the three scanner classes. FullDocumentScanner() — no parameters, both sides/all zones. SingleSideScanner(barcode: Boolean = true, machineReadableZone: Boolean = true, visualInspectionZone: Boolean = true, freeFormText: Boolean = false). MobileDocumentScanner(iso180135: Boolean = false, ocr: Boolean = false, elementsToRetain: Set<MobileDocumentDataElement> = emptySet()) (or MobileDocumentScanner.mobileDocumentScanner()).
  • Document types (IdCaptureDocument, each takes a single region: IdCaptureRegion): IdCard, DriverLicense, Passport, VisaIcao, VisaLetter, ResidencePermit, HealthInsuranceCard; RegionSpecific(subtype: RegionSpecificSubtype).
  • IdCaptureRegion enum — ANY, EU_AND_SCHENGEN, and ~250 region values (US, UK, UAE, …), all UPPER_SNAKE_CASE.
  • IdCaptureListener — onIdCaptured(mode: IdCapture, id: CapturedId), onIdRejected(mode: IdCapture, id: CapturedId?, reason: RejectionReason).
  • CapturedId — fullName / firstName / lastName (String?), sexType (Sex), dateOfBirth / dateOfExpiry / dateOfIssue (DateResult?), nationality, address, age (Int?), isExpired: Boolean?, document (IdCaptureDocument?), issuingCountry (IdCaptureRegion), documentNumber / documentAdditionalNumber, usRealIdStatus, isCitizenPassport, viz / mrz / barcode / mobileDocument / mobileDocumentOcr, images (IdImages), verificationResult (VerificationResult?), anonymizedFields (Set<IdFieldType>) / isAnonymized(field), plus isIdCard() / isDriverLicense() / isPassport() / isVisaIcao() / isVisaLetter() / isResidencePermit() / isHealthInsuranceCard() / isRegionSpecific(subtype).
  • DateResult — day: Int?, month: Int?, year: Int.
  • IdImages — face: CapturedImage? (property), frame: CapturedImage? (property, side-agnostic) and frame(side: IdSide): CapturedImage? (function, per-side), croppedDocument(side: IdSide): CapturedImage?.
  • VerificationResult — dataConsistency: DataConsistencyResult?, aamvaBarcodeVerification: AamvaBarcodeVerificationResult?.
  • DataConsistencyResult — allChecksPassed: Boolean, passedChecks / skippedChecks / failedChecks: Set<DataConsistencyCheck>, frontReviewImage: CapturedImage?.
  • AamvaBarcodeVerificationResult — allChecksPassed: Boolean, status: AamvaBarcodeVerificationStatus (AUTHENTIC / LIKELY_FORGED / FORGED).
  • IdCaptureOverlay — IdCaptureOverlay.withIdCapture(idCapture) / .withIdCaptureForView(idCapture, view); idLayoutStyle (IdLayoutStyle: ROUNDED default / SQUARE), idLayoutLineStyle (IdLayoutLineStyle: LIGHT default / BOLD), textHintPosition (TextHintPosition: ABOVE_VIEWFINDER / BELOW_VIEWFINDER), showTextHints, setFrontSideTextHint(text) / setBackSideTextHint(text), capturedBrush / localizedBrush / rejectedBrush (Brush).
  • IdCaptureFeedback — IdCaptureFeedback(); idCaptured / idRejected (Feedback); static defaultFeedback().
  • DataCaptureContext — DataCaptureContext.initialize(licenseKey, ...) (also forLicenseKey(...) and related overloads); setFrameSource(frameSource); addMode(mode) / removeMode(mode) / removeCurrentMode() / removeAllModes(); static sharedInstance.
  • Camera — Camera.getDefaultCamera(settings: CameraSettings): Camera? (nullable — no camera on some devices); switchToDesiredState(FrameSourceState.ON / OFF, callback).
  • DataCaptureView — hosted per-platform; expose it to the UI layer via the toAndroidView() / toUIView() extension functions shown in references/integration.md; addOverlay(overlay); logoStyle (LogoStyle).
  • RejectionReason enum — NOT_ACCEPTED_DOCUMENT_TYPE, INVALID_FORMAT, DOCUMENT_VOIDED, TIMEOUT, SINGLE_IMAGE_NOT_RECOGNIZED, DOCUMENT_EXPIRED, DOCUMENT_EXPIRES_SOON, NOT_REAL_ID_COMPLIANT, HOLDER_UNDERAGE, FORGED_AAMVA_BARCODE, INCONSISTENT_DATA, BLUETOOTH_COMMUNICATION_ERROR, BLUETOOTH_UNAVAILABLE, CLOUD_REQUEST_FAILED.
  • IdAnonymizationMode enum — NONE, FIELDS_ONLY (default), IMAGES_ONLY, FIELDS_AND_IMAGES.
  • IdImageType enum — FACE, CROPPED_DOCUMENT, FRAME. IdSide enum — FRONT, BACK. Sex enum — FEMALE, MALE, UNSPECIFIED.
  • Compose Multiplatform (id-compose module) — @Composable IdCaptureView(settings, modifier, overlayStyle, onCapture, onReject, ...). See references/integration.md for details.

Available on the KMP SDK but NOT covered by this skill

  • NFC chip reading — not part of the KMP SDK (nfc/nfc-scanner.rst and nfc/nfc-result.rst do not include kmp in their platform list).
  • IdCaptureException, LocalizedOnlyId, PhysicalDocumentScanner (the standalone base-class page, distinct from the concrete scanners covered above), and the deserialization API (IdCaptureDeserializer / IdCaptureDeserializerListener) — none apply to KMP per the SDK documentation's platform filters.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Id Capture Kmp AI 技能有什么作用?

Scandit ID Capture (`IdCapture`) in Kotlin Multiplatform (KMP) / Compose Multiplatform projects (`com.kmp.datacapture.id.*`, shared commonMain targeting Android + iOS) — scanning passports, driver's licenses, ID cards, residence permits, visas via MRZ, VIZ, PDF417 barcode, or mobile documents. Use for integration, accepted-document and scanner configuration, CapturedId result handling, rejection rules, AAMVA verification, anonymization, and shared-view hosting — not the native Android or native iOS skills, whose APIs differ.

为什么在 TypingMind 中使用 Id Capture Kmp?

因为您只需安装一次,就能搭配任何模型使用。Id Capture Kmp 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Id Capture Kmp?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/Scandit/skills/tree/dist/skills/id-capture-kmp。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Id Capture Kmp?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Id Capture Kmp 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Id Capture Kmp 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Id Capture Kmp AI 技能免费吗?

是的。Scandit 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇