core-ml
Core ML, Create ML, Vision framework, Natural Language framework, on-device ML integration. Use when user wants image classification, text analysis, object detection, sound classification, model optimization, or custom model integration. Covers Core ML vs Foundation Models decision.
What this skill does
# Core ML Skills
Combined advisory, generator, and workflow skill for integrating machine learning into Apple platform apps. Covers Core ML model integration, Vision framework image analysis, NaturalLanguage framework text processing, Create ML training, and on-device model optimization.
## When This Skill Activates
Use this skill when the user:
- Wants to add ML capabilities to their app
- Needs to integrate a Core ML model (.mlmodel) into an Xcode project
- Wants to use the Vision framework for image analysis (faces, text recognition, body pose, object detection)
- Wants to use the NaturalLanguage framework for text processing (sentiment, entities, language detection)
- Needs to train a custom model with Create ML
- Wants to optimize a model for on-device use (quantization, pruning, palettization)
- Needs to choose between Core ML and Foundation Models (Apple Intelligence)
- Asks about image classification, object detection, sound classification, or tabular data prediction
- Wants real-time camera + ML processing
## Decision Guide: Core ML vs Foundation Models
Before generating code, determine which framework is appropriate.
### Use Foundation Models (Apple Intelligence) When:
- You need general-purpose text generation, summarization, or conversational AI
- Target is iOS 26+ / macOS 26+ (Foundation Models requires Apple Silicon + latest OS)
- The task is open-ended language understanding or generation
- You want `@Generable` structured output from natural language
- See `apple-intelligence/foundation-models/` skill for implementation
### Use Core ML When:
- You need specialized ML: image classification, object detection, sound classification, custom regression/classification
- You have a trained model (.mlmodel, .mlpackage) or plan to train one
- You need broad device support (iOS 14+ / macOS 11+)
- The task requires domain-specific predictions (medical imaging, product recognition, custom NLP)
- Performance-critical inference on Neural Engine or GPU
### Use Vision Framework When (No Custom Model Needed):
- Image classification using Apple's built-in models
- Face detection and facial landmark analysis
- Text recognition (OCR) with `VNRecognizeTextRequest`
- Body and hand pose detection
- Barcode and QR code scanning
- Image similarity and saliency detection
- Horizon detection, rectangle detection
### Use NaturalLanguage Framework When (No Custom Model Needed):
- Sentiment analysis on text
- Language identification
- Tokenization (word, sentence, paragraph boundaries)
- Named entity recognition (people, places, organizations)
- Word and sentence embeddings for similarity comparison
- Lemmatization and part-of-speech tagging
## Pre-Generation Checks
### 1. Project Context Detection
- [ ] Check deployment target (Core ML requires iOS 11+ / macOS 10.13+; Vision requires iOS 11+; NaturalLanguage requires iOS 12+)
- [ ] Check for existing ML code or models
- [ ] Identify project structure and source file locations
- [ ] Determine if SwiftUI or UIKit/AppKit
### 2. Conflict Detection
Search for existing ML integration:
```
Glob: **/*Model*.swift, **/*Classifier*.swift, **/*Predictor*.swift, **/*.mlmodel, **/*.mlmodelc, **/*.mlpackage
Grep: "import CoreML" or "import Vision" or "import NaturalLanguage"
```
If found, ask user:
- Extend existing ML setup?
- Replace with new implementation?
- Add additional model/capability?
## Configuration Questions
Ask user via AskUserQuestion:
1. **What ML capability do you need?**
- Image classification (identify objects in photos)
- Object detection (locate objects with bounding boxes)
- Text analysis (sentiment, entities, language)
- Custom Core ML model integration
- Vision framework (OCR, faces, poses)
- Sound classification
- Tabular data prediction
2. **Do you have a trained model, or need to train one?**
- I have a .mlmodel / .mlpackage file
- I want to train with Create ML
- I want to use Apple's built-in models (Vision / NaturalLanguage)
3. **Performance requirements?**
- Real-time (camera feed, < 33ms per prediction)
- Interactive (user-initiated, < 500ms acceptable)
- Background processing (batch, latency not critical)
## Core ML Model Integration
### Adding a Model to Xcode
1. Drag `.mlmodel` or `.mlpackage` into Xcode project navigator
2. Xcode auto-generates a Swift class with the model name
3. The generated class provides type-safe input/output interfaces
4. Xcode compiles to `.mlmodelc` at build time (optimized for device)
### Loading Models
```swift
// Option 1: Auto-generated class (simplest)
let model = try MyImageClassifier(configuration: MLModelConfiguration())
// Option 2: Generic MLModel loading (flexible)
let url = Bundle.main.url(forResource: "MyModel", withExtension: "mlmodelc")!
let config = MLModelConfiguration()
config.computeUnits = .all // CPU + GPU + Neural Engine
let model = try MLModel(contentsOf: url, configuration: config)
// Option 3: Async loading (recommended for large models)
let model = try await MLModel.load(contentsOf: url, configuration: config)
```
### Making Predictions
```swift
// Type-safe prediction with auto-generated class
let input = MyImageClassifierInput(image: pixelBuffer)
let output = try model.prediction(input: input)
print(output.classLabel) // "cat"
print(output.classLabelProbs) // ["cat": 0.95, "dog": 0.04, ...]
// Batch predictions
let batch = MLArrayBatchProvider(array: inputs)
let results = try model.predictions(from: batch)
```
## Create ML Training Overview
### Image Classification
- **Minimum**: 10 images per category; **Recommended**: 40+ per category
- Organize images in folders named by category
- Supports JPEG, PNG, HEIC formats
- Data augmentation applied automatically (rotation, flip, crop)
- Transfer learning from Apple's base models
### Text Classification
- Training data: text samples with labels (CSV or JSON)
- Use cases: sentiment analysis, spam detection, topic classification, intent recognition
- Minimum 10 samples per class; 100+ recommended for accuracy
### Tabular Classification / Regression
- Structured data in CSV or JSON
- Automatic feature engineering
- Supports: Boosted Tree, Random Forest, Linear Regression, Decision Tree
### Sound Classification
- Audio files organized by category
- Environmental sounds, speech detection, music genre
- Minimum 10 samples per category at 15+ seconds each
### Object Detection
- Images with bounding box annotations (JSON format)
- Outputs bounding boxes + class labels + confidence
- Minimum 30 annotated images per class; 300+ recommended
### Training Approach
- **Xcode Create ML App**: Visual interface, drag-and-drop, no code required
- **CreateML Framework**: Programmatic training in Swift Playgrounds or macOS apps
- **coremltools (Python)**: Convert models from TensorFlow, PyTorch, ONNX to Core ML format
## Vision Framework Capabilities
| Capability | Request Class | Custom Model Needed? |
|---|---|---|
| Image classification | `VNClassifyImageRequest` | No (built-in) |
| Object detection | `VNDetectObjectsRequest` (custom model) | Yes |
| Face detection | `VNDetectFaceRectanglesRequest` | No |
| Face landmarks | `VNDetectFaceLandmarksRequest` | No |
| Text recognition (OCR) | `VNRecognizeTextRequest` | No |
| Body pose | `VNDetectHumanBodyPoseRequest` | No |
| Hand pose | `VNDetectHumanHandPoseRequest` | No |
| Barcode detection | `VNDetectBarcodesRequest` | No |
| Image saliency | `VNGenerateAttentionBasedSaliencyImageRequest` | No |
| Horizon detection | `VNDetectHorizonRequest` | No |
| Rectangle detection | `VNDetectRectanglesRequest` | No |
| Image similarity | `VNGenerateImageFeaturePrintRequest` | No |
### Vision Request Pipeline
```swift
// Multiple requests on the same image
let handler = VNImageRequestHandler(cgImage: cgImage, options: [:])
try handler.perform([
textRequest, // OCR
faceRequest, // Face detection
barcodeRequest // Barcode scanning
])
// Each request's results are popRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.