소스 정보
- 저장소
- tomevault-io/skills-registry
- 최근 소스 활동
- 2026년 7월 3일 19:45
- 감지된 SKILL.md 언어
- 영어
- 스타
- 0
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill swift-ondevice-ai-language-model-patterns명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | swift-ondevice-ai-language-model-patterns |
| description | >- Use when this capability is needed. |
Apple's Foundation Models framework
(WWDC25) exposes the on-device LLM behind Apple Intelligence to your app. You always gate on
availability first, then run a LanguageModelSession,
get type-safe output via guided generation
(@Generable +
@Guide), stream partial results, and optionally extend the model with the
Tool protocol. This is a
hardware-gated capability, not just a UI pattern — the framework leads with availability for a
reason.
Announce on invoke: "Using swift-ondevice-ai-language-model-patterns to gate availability, run a LanguageModelSession, and generate @Generable output."
Do not reach for this for tasks needing world knowledge, long context, or guaranteed availability — the on-device model is small (4,096-token window) and absent on older hardware. For those, a server model behind your own API is the right call.
| API | Signature / form (verified) | Use |
|---|---|---|
SystemLanguageModel.default | static var default: SystemLanguageModel | The on-device model handle |
.availability | var availability: SystemLanguageModel.Availability → .available / .unavailable(UnavailableReason) | The mandatory pre-flight gate |
UnavailableReason | .appleIntelligenceNotEnabled, .deviceNotEligible, .modelNotReady | Why it's off |
LanguageModelSession | final class; init(instructions:), init(model:tools:instructions:) | A stateful generation session |
respond(to:options:) | returns LanguageModelSession.Response<String> | One-shot text response |
respond(generating:includeSchemaInPrompt:options:prompt:) | returns Response<Content> (guided) | Structured output |
streamResponse(to:generating:includeSchemaInPrompt:options:) | returns LanguageModelSession.ResponseStream<Content> | Streamed structured output |
@Generable | macro → Generable : ConvertibleFromGeneratedContent, ConvertibleToGeneratedContent | Mark a type the model can produce |
@Guide(description:…) | property macro; supports guides like .count(_:), .range(_:) | Constrain / describe a field |
Tool | protocol Tool<Arguments, Output> : Sendable; call(arguments:) | Function calling |
GenerationOptions | maximumResponseTokens, sampling, temperature | Tune the request |
SystemLanguageModel.default.availability BEFORE constructing a sessionConstructing/using a session on an unsupported device fails. Check availability and branch to a fallback. The unavailable reasons are actionable (prompt the user to enable Apple Intelligence vs. hide the feature on ineligible hardware):
switch SystemLanguageModel.default.availability {
case .available:
// proceed
case .unavailable(.appleIntelligenceNotEnabled):
// deep-link to Settings, or show "turn on Apple Intelligence"
case .unavailable(.deviceNotEligible), .unavailable(.modelNotReady):
// hide the feature / degrade gracefully
}
@Generable type with @Guided fieldsAnnotate the type with @Generable; describe properties with @Guide. The framework uses
constrained sampling so the model can't produce malformed output. Keep descriptions short — they
consume the context window.
@Generable
struct SearchSuggestions {
@Guide(description: "Suggested search terms.", .count(4))
var terms: [String]
}
ResponseStream of partial snapshots — handle progressive revealstreamResponse(...) returns a LanguageModelSession.ResponseStream<Content>; iterate it for
Snapshots where the generated content is filled in progressively (a PartiallyGenerated mirror
with optional fields). Your UI must render half-filled state, then settle. Call .collect() to await
the final value instead.
Instructions + all prompts + all outputs share one 4,096-token budget. Exceeding it throws
exceededContextWindowSize(_:). For long inputs, chunk the work and run each chunk in a new
LanguageModelSession, then combine. Tool definitions also consume the window.
Sendable; the model decides when to call themA Tool carries a name + description (the model uses them to decide invocation) and a
call(arguments:) whose Arguments are themselves @Generable. Tools run concurrently, so the
protocol requires Sendable.
@MainActor @Observable capability providerSurface availability and streamed state to the View layer through an @Observable object on the main
actor. The same provider can gate other Apple Intelligence features (Writing Tools, Image Playground)
behind one availability check.
import FoundationModels
@Generable
struct Recipe: Sendable {
@Guide(description: "The recipe title.") var title: String
@Guide(description: "Ingredients with quantities.") var ingredients: [String]
@Guide(description: "Ordered preparation steps.") var steps: [String]
}
@MainActor @Observable
final class RecipeGenerator {
enum State { case unsupported(SystemLanguageModel.Availability), idle, streaming(Recipe.PartiallyGenerated), done(Recipe) }
private(set) var state: State = .idle
func start() {
if case .unavailable = SystemLanguageModel.default.availability {
state = .unsupported(SystemLanguageModel.default.availability); return // fail soft
}
state = .idle
}
func generate(prompt: String) async {
.available .default.availability { }
session (
instructions:
)
{
stream session.streamResponse(to: prompt, generating: .)
snapshot stream {
state .streaming(snapshot.content)
}
stream.collect()
state .done(.content)
} {
}
}
}
.modelNotReady; re-check, don't cache "available" forever..deviceNotEligible
— design the fallback (hide, or route to a server) as a first-class path.global-skills/apple/swift-clean-architecture-module-scaffold/SKILL.md — the @MainActor
@Observable capability provider and Sendable Tool isolation.global-skills/apple/swift-feature-scaffold-mvvm-clean-arch/SKILL.md — wiring the streamed state
into a feature's State enum.global-skills/meta/skill-pattern-freshness-audit/SKILL.md — re-verify Foundation Models symbols
after each WWDC (the model + API surface is new and evolving).Last verified: 2026-06-03 against Apple Developer docs (live). Resolved draft open questions:
@Generable/@Guide confirmed real (Generable protocol page, sample uses .count(4)/.range(1...10));
streamResponse(to:generating:includeSchemaInPrompt:options:) returns ResponseStream<Content>; Tool
is protocol Tool<Arguments, Output> : Sendable; the on-device context window is 4,096 tokens (Apple
docs), correcting the ~2000 estimate.
Re-check after: WWDC26, or by 2026-12-01. Decay risk: medium (new framework; model size and API
surface may shift).
Found a drift? Run /skill-pattern-freshness-audit apple.
Source: esaldgut/ai-native-engineering-workspace — distributed by TomeVault.