Use this skill whenever the user mentions coreai-torch, TorchConverter, coreai-build, AIModel, AIProgram, .aimodel, or wants to export/compile/run a PyTorch model on Apple silicon (iPhone, iPad, Mac). Also triggers…
---
name: working-with-coreai
description: Use this skill whenever the user mentions coreai-torch, TorchConverter, coreai-build, AIModel, AIProgram, .aimodel, or wants to export/compile/run a PyTorch model on Apple silicon (iPhone, iPad, Mac). Also triggers for "deploy on device", "optimize for on-device performance", onboarding new models to Core AI, or choosing between iOS and macOS deployment paths.
---
# Working with Core AI
Deploy PyTorch models on Apple silicon: export with coreai-torch, compile with coreai-build, run with the Core AI runtime (Swift or Python).
**Related skills**: `Skill("coreai-skills:model-authoring")` (Neural Engine and GPU authoring patterns, use when re-structuring model architecture) | `Skill("coreai-skills:model-compression-exploration")` (quantization/palettization sweeps — use when exploring compression tradeoffs)
______________________________________________________________________
## Documentation and reference material
The Core AI toolchain has extensive documentation. Use these as reference — **do not read all pages upfront**. Instead, consult the relevant docs when you need specifics about a particular step.
| Resource | What it covers | When to consult |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [coreai-torch](https://apple.github.io/coreai-torch/index.html) | TorchConverter API, externalization, composite ops, custom lowerings, Metal kernels, debugging | Export questions, API details, custom op registration |
| [CoreAI framework](https://developer.apple.com/documentation/coreai) | AIModel, InferenceFunction, NDArray, specialization, caching | Swift runtime API, on-device integration |
| [coreai-build (AOT compilation)](https://developer.apple.com/documentation/coreai/compiling-core-ai-models-ahead-of-time) | Ahead-of-time compilation flags and options | Compilation questions |
| [coreai Python API](https://apple.github.io/coreai-torch/main/coreai-core) | Python runtime: AIModel, InferenceFunction, NDArray, state management | Python runtime questions |
| [coreai-models repo](https://github.com/apple/coreai-models) | Export recipes, Swift runtime utilities, reusable primitives | Export patterns, running models, reference implementations |
| [`guidance.md`](references/guidance.md) | Platform and general guidance: use cases, model sizing, compression strategy | Resolving decisions around platform targeting, model sizing, and compression strategy |