Apple
Performs all tasks related to the Apple Intelligence SDK (iOS). The SDK is a layered on-device AI framework with composable chain…
# /apple
Performs all tasks related to the Apple Intelligence SDK (iOS). The SDK is a layered on-device AI framework with composable chains, memory, guardrails, and pipeline DSL.
## Usage
```text
/apple <request in natural language>
Examples
/apple check for new features and add them
/apple verify existing code has no issues
/apple check if iOS implementation is correct
/apple implement VoiceRecognition feature
/apple review summarize feature code
/apple add ExecuteFeatureOptionsIOS type
Instructions
When this command is executed, perform the following:
1. Analyze Request
Classify the user's request into one of:
- Add Feature: Check GraphQL schema and implement features not yet in iOS
- Add Chain: Create a new built-in Chain (in BuiltIn/) with typed result and run() method
- Validate Code: Review existing Swift code and identify issues
- Add Type: Implement GraphQL type as Swift struct/class
- Implement API: Implement GraphQL API operation as Swift async function
- Refactoring: Improve code quality
2. Check GraphQL Schema
Always check the GraphQL schema first:
# Check iOS-related schemas
- packages/gql/src/type-ios.graphql
- packages/gql/src/utils-ios.graphql
- packages/gql/src/type.graphql (shared)
- packages/gql/src/utils.graphql (shared)
3. Check Existing Implementation
# Check Swift source code (framework layers)
- packages/apple/Sources/Core/ # LocanaraModel, PromptTemplate, OutputParser, Schema
- packages/apple/Sources/Composable/ # Chain, Tool, Memory, Guardrail
- packages/apple/Sources/BuiltIn/ # SummarizeChain, ClassifyChain, etc.
- packages/apple/Sources/DSL/ # Pipeline, PipelineStep, ModelExtensions
- packages/apple/Sources/Runtime/ # Agent, Session, ChainExecutor
- packages/apple/Sources/Platform/ # FoundationLanguageModel
- packages/apple/Sources/Features/ # Legacy feature executors
4. Perform Task
4.1 When Adding Feature
- Check iOS-specific or shared feature types in GraphQL schema
- Check
packages/apple/Sources/Features/ - Find unimplemented features
- Implement Feature in Swift:
- Define struct/class types (Types.swift)
- Implement Feature executor (Features/FeatureName.swift)
- Integrate Apple Intelligence API
- Use async/await for async processing
- Handle errors
- ARC memory management
4.2 When Validating Code
Check Swift coding convention compliance:
- Naming conventions (PascalCase, camelCase)
- Correct use of async/await
- Error handling (throws)
- Access control (public, internal, private)
- Documentation comments (///)
Check alignment with GraphQL schema:
- Type names are accurate
- All fields are implemented
- Optional matches
Performance and optimization:
- Neural Engine utilization
- Low Power Mode support
- Memory management (weak, unowned)
Auto-fix when issues are found
4.3 When Adding Type
Convert GraphQL type to Swift:
// GraphQL: type DeviceInfoIOS
public struct DeviceInfoIOS: Codable {
public let modelIdentifier: String
public let osVersion: String
public let supportsAppleIntelligence: Bool
public let systemLanguages: [String]
public let hasNeuralEngine: Bool
}
4.4 When Implementing API
Implement GraphQL Mutation/Query as Swift async function:
// GraphQL: executeFeatureIOS
public func executeFeatureIOS(
_ input: ExecuteFeatureInput,
options: ExecuteFeatureOptionsIOS?
) async throws -> ExecutionResult {
// Implementation
}
5. Follow Coding Rules
Always follow Apple Intelligence SDK's SKILL.md rules:
- Swift 6.0+ coding conventions (language mode v5)
- Async processing with async/await
- Error handling with LocanaraError
- Type definition with struct/class
- Codable protocol
- Documentation comments (///)
- ARC memory management
- Neural Engine optimization
6. Reference Documents
Always reference when performing tasks:
.claude/guides/04-apple-package.md- Apple SDK guidepackages/gql/src/- GraphQL schemapackages/apple/- Existing Swift code
7. Example Project Build Verification
After all tasks, always verify example project build:
Swift package build:
cd packages/apple && swift buildExample app build (repeat until no errors):
xcodebuild -project Example/LocanaraExample.xcodeproj \ -scheme LocanaraExample \ -destination 'platform=iOS Simulator,name=iPhone 17' \ build 2>&1 | grep -E "(error:|BUILD SUCCEEDED|BUILD FAILED)"When build errors occur:
- Analyze error messages
- Auto-fix (switch exhaustive, missing cases, etc.)
- Repeat until build succeeds
8. Automatic Workflow
When user requests:
- Analyze: Understand the request
- Explore: Check GraphQL schema + existing code
- Execute:
- New feature found → Implement
- Issue found → Fix
- Type/API requested → Generate
- Validate: Check coding rule compliance
- Build Check: Verify example project has no build errors and fix
- Report: Summarize completed work
After Completion
Automatically suggest:
- If tests needed: Recommend
/testcommand - If docs update needed: Recommend
/docscommand - If same work needed for Android: Recommend
/androidcommand
Key Principles
- GraphQL is Truth: Always check and follow GraphQL schema first
- Auto-detect: Find and perform necessary work even without user specifying details
- Quality First: Correct implementation over fast implementation
- Naming Convention: Platform suffix is always last (e.g.,
OptionsIOS) - Error Handling: All public APIs must have proper error handling
Example Execution Scenarios
Scenario 1: Check and Add New Feature
User: /apple check for new features and add them
Agent:
1. Read GraphQL schema (type.graphql, typ
Maintain Apple?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Apple on getagentictools](https://getagentictools.com/loops/hyodotdev-apple?ref=badge)