swiftui-preview
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "swiftui-preview":https://skillpi.com/zh/skills/deepskill-e11104f3a0fe158906e745fdad3552544f1b330f4c6ad37dc8bd178f5abab7f9。安装前核对上游来源和版本:https://github.com/xenodium/emacs-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
SwiftUI 预览技能:当用户调用“/swiftui-preview”时,使用此技能将当前上下文中的 SwiftUI 代码渲染为 PNG 图像,并输出生成图像的路径。
介绍来源: third_party · xenodium · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: swiftui-preview
description: 'This skill should be used when the user invokes "/swiftui-preview" to render SwiftUI code from the current context to a PNG and output the resulting image path.'
tools: Bash
disable-model-invocation: trueRender a SwiftUI preview
Generate SwiftUI code from the most recent interaction context, render it to a PNG using ImageRenderer, and output it as a markdown image so it renders inline.
The "context" can take any form: a prose description ("show a profile card with a photo on the left and name above bio on the right"), an attached screenshot or mockup image, an ASCII layout diagram, or actual Swift code. Translate whichever the user provided into a single ContentView.
For example, this ASCII diagram:
+------------------+--------------------------------------+
| | Name |
| +--------------------------------------+
| Photo | |
| | Biography |
| | |
+------------------+--------------------------------------+
should become an HStack with the photo on the left and a VStack { Name; Biography } on the right, sized so the photo spans the full height. Match proportions and stacking direction faithfully; choose reasonable placeholder content (e.g. Image(systemName: "person.crop.square.fill"), sample text) when the input doesn't specify.
How to render
- Derive SwiftUI view code from the current context — prose, image, ASCII diagram, or existing Swift. The root view must be named
ContentView. Helper views may be defined alongside. - Locate
agent-skill-swiftui.elwhich lives alongside this skill file atskills/swiftui-preview/agent-skill-swiftui.elin the emacs-skills plugin directory. - Invoke the elisp function in a single Bash call. To avoid shell+elisp quoting issues with arbitrary Swift code, pipe the source through
base64and decode it on the elisp side:emacsclient --eval "(progn (load \"/path/to/skills/swiftui-preview/agent-skill-swiftui.el\" nil t) (agent-skill-swiftui-render :swift-source (base64-decode-string \"$(base64 <<'SWIFT' | tr -d '\n' struct ContentView: View { var body: some View { Text("Hello, SwiftUI!") .font(.largeTitle) .padding(40) } } SWIFT )\")))"The
'SWIFT'heredoc delimiter is single-quoted so the source passes through verbatim — no shell escaping needed inside. - The function returns the PNG path as a quoted elisp string (e.g.
"/var/folders/.../agent-swiftui-XXXX.png") on success, ornilon failure. - On success, output the result as a markdown image on its own line:

SwiftUI source template
Do NOT include import SwiftUI — the wrapper imports it. Provide only the view structs:
struct ContentView: View {
var body: some View {
VStack(spacing: 20) {
Text("Hello, SwiftUI!")
.font(.largeTitle)
RoundedRectangle(cornerRadius: 12)
.fill(Color.orange)
.frame(width: 200, height: 100)
}
.padding(40)
}
}
If the source contains no struct or class definitions, it is wrapped automatically as the body of a generated ContentView. Otherwise it must define ContentView itself.
Rules
- The root view must be named
ContentViewwhen the source contains struct/class definitions. - Do not include
import SwiftUIin the source — the wrapper adds it. - Use one Bash call. Pass the source via the
base64 | tr -d '\n'pipe inside the single-quoted'SWIFT'heredoc — do not write a temp.swiftfile as an intermediate step. - Locate
agent-skill-swiftui.elrelative to this skill file's directory. - Run the
emacsclient --evalcommand via the Bash tool. emacsclientprints the return value as an elisp literal — strip the surrounding"quotes from the path before emitting the markdown image link.- On success, output a markdown image (
) on its own line. - On
nilreturn, inform the user that the SwiftUI render failed and show the source so they can debug.
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 解决 iOS/macOS 开发者高频的 SwiftUI 预览需求
- 支持多种输入形式(代码、描述、ASCII 图等)提升易用性
亮点
- 触发词 "/swiftui-preview" 明确且边界清晰
- description 位置正确,内容完整
亮点
- 执行步骤分阶段清晰,包含完整端到端示例
- frontmatter 完整,文档结构规范
待提升项
-
依赖外部 elisp 文件路径未做存在性校验 原报告严重程度:轻微
执行流程依赖 skills/swiftui-preview/agent-skill-swiftui.el 文件存在,但未在文档中说明该文件必须存在或提供 fallback 方案
改进建议:建议在文档中添加对 agent-skill-swiftui.el 文件存在性的说明,或提供文件缺失时的错误处理指引
亮点
- 使用 base64 编码传递 Swift 源码,避免 shell quoting 问题
- 明确处理渲染失败场景并返回源码供调试
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。