Hig Project Context
raintree-technology/hig-doctor
Create or update a shared Apple design context document that other HIG skills use to tailor guidance.
Apple FoundationModels 框架,用于设备端大语言模型(LLM)—— iOS 26+ 中的文本生成、配合 @Generable 的引导式生成、工具调用以及快照流式传输。
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-device --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/foundation-models-on-device .claude/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .claude/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-deviceType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-device --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/foundation-models-on-device .agents/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .agents/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-device --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/foundation-models-on-device .cursor/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .cursor/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/xu-xiang/everything-claude-code-zh.git --path skills/foundation-models-on-device--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-device --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/foundation-models-on-device .gemini/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .gemini/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-deviceInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/foundation-models-on-device .github/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .github/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install xu-xiang/everything-claude-code-zh foundation-models-on-device --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/foundation-models-on-device .opencode/skills/foundation-models-on-device && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "foundation-models-on-device" agent skill from https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/foundation-models-on-device into .opencode/skills/foundation-models-on-device/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "foundation-models-on-device", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
foundation-models-on-deviceApple FoundationModels 框架,用于设备端大语言模型(LLM)—— iOS 26+ 中的文本生成、配合 @Generable 的引导式生成、工具调用以及快照流式传输。
Foundation Models On Device is an agent skill from xu-xiang/everything-claude-code-zh. Apple FoundationModels 框架,用于设备端大语言模型(LLM)—— iOS 26+ 中的文本生成、配合 @Generable 的引导式生成、工具调用以及快照流式传输。
Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Mobile. It works with iOS. The repository describes itself as: everything-claude-code 中文翻译项目:完整的 Claude Code 配置集合(agents, skills, hooks, commands, rules, MCPs)。源自 Anthropic 黑客松获胜者的实战配置,助力中文工程师高效理解与使用 Claude Code。 The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit dfbf946. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Foundation Models On Device loads about 1.4k tokens when it runs. Until then it costs about 30 tokens; SKILL.md has 173 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from xu-xiang/everything-claude-code-zh at commit dfbf946, republished under its MIT licence (© xu-xiang). 173 words, ~1,383 tokens.
.claude/skills/foundation-models-on-device/SKILL.md (or your agent's skills folder).使用 FoundationModels 框架将 Apple 的设备端语言模型集成到应用中的模式。涵盖文本生成、使用 @Generable 的结构化输出、自定义工具调用以及快照流式传输 —— 全部在设备端运行,以支持隐私保护和离线使用。
在创建会话(Session)之前,请务必检查模型的可用性:
struct GenerativeView: View {
private var model = SystemLanguageModel.default
var body: some View {
switch model.availability {
case .available:
ContentView()
case .unavailable(.deviceNotEligible):
Text("设备不符合 Apple Intelligence 的使用条件")
case .unavailable(.appleIntelligenceNotEnabled):
Text("请在设置中启用 Apple Intelligence")
case .unavailable(.modelNotReady):
Text("模型正在下载或尚未就绪")
case .unavailable(let other):
Text("模型不可用:\(other)")
}
}
}// 单轮:每次创建一个新会话
let session = LanguageModelSession()
let response = try await session.respond(to: "去巴黎旅游哪个月份比较好?")
print(response.content)
// 多轮:复用会话以保留对话上下文
let session = LanguageModelSession(instructions: """
你是一个烹饪助手。
请根据食材提供食谱建议。
建议要保持简短且实用。
""")
let first = try await session.respond(to: "我有鸡肉和米饭")
let followUp = try await session.respond(to: "那素食选择呢?")提示词指令(Instructions)的关键点:
生成结构化的 Swift 类型,而不是原始字符串:
@Generable(description: "关于猫的基本个人资料信息")
struct CatProfile {
var name: String
@Guide(description: "猫的年龄", .range(0...20))
var age: Int
@Guide(description: "关于猫性格的一句话简介")
var profile: String
}let response = try await session.respond(
to: "生成一只可爱的待领养小猫",
generating: CatProfile.self
)
// 直接访问结构化字段
print("名字: \(response.content.name)")
print("年龄: \(response.content.age)")
print("简介: \(response.content.profile)").range(0...20) —— 数字范围.count(3) —— 数组元素计数description: —— 生成的语义引导允许模型调用自定义代码以执行特定领域任务:
struct RecipeSearchTool: Tool {
let name = "recipe_search"
let description = "搜索匹配给定术语的食谱并返回结果列表。"
@Generable
struct Arguments {
var searchTerm: String
var numberOfResults: Int
}
func call(arguments: Arguments) async throws -> ToolOutput {
let recipes = await searchRecipes(
term: arguments.searchTerm,
limit: arguments.numberOfResults
)
return .string(recipes.map { "- \($0.name): \($0.description)" }.joined(separator: "\n"))
}
}let session = LanguageModelSession(tools: [RecipeSearchTool()])
let response = try await session.respond(to: "帮我找一些意面食谱")do {
let answer = try await session.respond(to: "寻找番茄汤的食谱。")
} catch let error as LanguageModelSession.ToolCallError {
print(error.tool.name)
if case .databaseIsEmpty = error.underlyingError as? RecipeSearchToolError {
// 处理特定的工具错误
}
}使用 PartiallyGenerated 类型为实时 UI 流式传输结构化响应:
@Generable
struct TripIdeas {
@Guide(description: "未来旅行的想法")
var ideas: [String]
}
let stream = session.streamResponse(
to: "有哪些令人兴奋的旅行点子?",
generating: TripIdeas.self
)
for try await partial in stream {
// partial: TripIdeas.PartiallyGenerated (所有属性均为 Optional)
print(partial)
}@State private var partialResult: TripIdeas.PartiallyGenerated?
@State private var errorMessage: String?
var body: some View {
List {
ForEach(partialResult?.ideas ?? [], id: \.self) { idea in
Text(idea)
}
}
.overlay {
if let errorMessage { Text(errorMessage).foregroundStyle(.red) }
}
.task {
do {
let stream = session.streamResponse(to: prompt, generating: TripIdeas.self)
for try await partial in stream {
partialResult = partial
}
} catch {
errorMessage = error.localizedDescription
}
}
}| 决策 | 原理 |
|---|---|
| 设备端执行 | 隐私性 —— 数据不离开设备;支持离线工作 |
| 4,096 Token 限制 | 设备端模型约束;跨会话分块处理大数据 |
| 快照流式传输(而非增量) | 对结构化输出友好;每个快照都是一个完整的局部状态 |
@Generable 宏 | 结构化生成的编译时安全性;自动生成 PartiallyGenerated 类型 |
| 每个会话单次请求 | isResponding 防止并发请求;如果需要,创建多个会话 |
response.content(而非 .output) | 正确的 API —— 始终通过 .content 属性访问结果 |
model.availability —— 处理所有不可用的情况instructions 来引导模型行为 —— 它们的优先级高于提示词(Prompts)isResponding —— 会话每次处理一个请求response.content 获取结果 —— 而非 .output@Generable 进行结构化输出 —— 比解析原始字符串具有更强的保证GenerationOptions(temperature:) 来调整创意程度(越高越有创意)model.availability 的情况下创建会话.output 而非 .content 来访问响应数据@Generable 结构化输出可行时解析原始字符串响应© xu-xiang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/foundation-models-on-device of xu-xiang/everything-claude-code-zh.
Open the folder on GitHubat commit dfbf946
Foundation Models On Device next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Foundation Models On Device this skillxu-xiang/everything-claude-code-zh | 2k | — | ~1.4k | Automated safety check: Pass | MIT | |
| Hig Project Contextraintree-technology/hig-doctor | 143 | 5 repos | ~1.2k | Automated safety check: Pass | MIT | |
| Hig Components Contentraintree-technology/hig-doctor | 143 | 5 repos | ~1.3k | Automated safety check: Pass | MIT | |
| Discover iOS KeysPoomSmart/MGKeys | 238 | — | ~1.4k | Automated safety check: Pass | MIT | |
| Argent Metro Debuggerbbplayer-app/BBPlayer | 1.2k | — | ~3.4k | Automated safety check: Pass | MIT | |
| iOS Simulator Skilln0an/VivaDicta | 130 | 1 repos | ~2.5k | Automated safety check: Pass | MIT |
raintree-technology/hig-doctor
Create or update a shared Apple design context document that other HIG skills use to tailor guidance.
raintree-technology/hig-doctor
Apple Human Interface Guidelines for content display components.
PoomSmart/MGKeys
Discover and map new MobileGestalt keys for a new iOS version in MGKeys.
bbplayer-app/BBPlayer
Debug a JS runtime via CDP using argent debugger tools. An agent skill from bbplayer-app/BBPlayer.
n0an/VivaDicta
21 production-ready scripts for iOS app testing, building, and automation.
Code-with-Beto/skills
Scaffold a unified, cross-platform color theme system into an Expo Router app.
xu-xiang/everything-claude-code-zh
Everything Claude Code 的交互式安装程序 — 引导用户选择并安装技能和规则到用户级或项目级目录,验证路径,并可选择优化已安装文件。
xu-xiang/everything-claude-code-zh
基于本能(Instinct)的学习系统,通过钩子(hooks)观察会话,创建带有置信度评分的原子本能,并将其演化为技能(Skills)、命令(Commands)或智能体(Agents)。v2.1 版本增加了项目作用域(project-scoped)的本能,以防止跨项目污染。
xu-xiang/everything-claude-code-zh
生产级 API 的 REST API 设计模式,包括资源命名、状态码、分页、过滤、错误响应、版本控制和速率限制. An agent skill from xu-xiang/everything-claude-code-zh.
xu-xiang/everything-claude-code-zh
后端架构模式、API 设计、数据库优化以及适用于 Node.js、Express 和 Next.js API 路由的服务端最佳实践。
xu-xiang/everything-claude-code-zh
后端架构模式、API 设计、数据库优化以及 Node.js、Express 和 Next.js API 路由的服务端最佳实践。
xu-xiang/everything-claude-code-zh
后端架构模式、API 设计、数据库优化以及针对 Node.js、Express 和 Next.js API 路由的服务端最佳实践。
Works with
Categories
Apple FoundationModels 框架,用于设备端大语言模型(LLM)—— iOS 26+ 中的文本生成、配合 @Generable 的引导式生成、工具调用以及快照流式传输。. Foundation Models On Device is an agent skill from xu-xiang/everything-claude-code-zh.
Foundation Models On Device fits situations like: mobile work in your project.
Run `npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a claude-code`. Or copy the skill folder (skills/foundation-models-on-device in xu-xiang/everything-claude-code-zh) into .claude/skills/foundation-models-on-device in your project. Claude Code loads it when a task matches its description.
Run `npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a codex`. Or copy the skill folder (skills/foundation-models-on-device in xu-xiang/everything-claude-code-zh) into .agents/skills/foundation-models-on-device in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add xu-xiang/everything-claude-code-zh --skill foundation-models-on-device -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/foundation-models-on-device, .gemini/skills/foundation-models-on-device, .github/skills/foundation-models-on-device and .opencode/skills/foundation-models-on-device in your project.
SKILL.md names no scripts, command-line tools or credentials: Foundation Models On Device is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Foundation Models On Device is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Foundation Models On Device: Hig Project Context (raintree-technology/hig-doctor, 143 stars), Hig Components Content (raintree-technology/hig-doctor, 143 stars), Discover iOS Keys (PoomSmart/MGKeys, 238 stars) and Argent Metro Debugger (bbplayer-app/BBPlayer, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
xu-xiang (a GitHub user) maintains it in xu-xiang/everything-claude-code-zh, which has 1,978 GitHub stars. The repository holds 78 skills in this directory. The repository was last updated on March 5, 2026.
Source: xu-xiang/everything-claude-code-zh on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.