swiftui-preview
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "swiftui-preview" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e11104f3a0fe158906e745fdad3552544f1b330f4c6ad37dc8bd178f5abab7f9. Verify the upstream source and version against https://github.com/xenodium/emacs-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
SwiftUI preview skill: when the user invokes “/swiftui-preview”, use this skill to render SwiftUI code from the current context into a PNG image and output the path to the generated image.
Introduction source: third_party · xenodium · 0.0.1 Reference
SkillPi interpretation
- Tasks
- 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.
- Testing
- Not tested
Browse files
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.
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决 iOS/macOS 开发者高频的 SwiftUI 预览需求
- 支持多种输入形式(代码、描述、ASCII 图等)提升易用性
Highlights
- 触发词 "/swiftui-preview" 明确且边界清晰
- description 位置正确,内容完整
Highlights
- 执行步骤分阶段清晰,包含完整端到端示例
- frontmatter 完整,文档结构规范
Areas to improve
-
依赖外部 elisp 文件路径未做存在性校验 Reported severity: Minor
执行流程依赖 skills/swiftui-preview/agent-skill-swiftui.el 文件存在,但未在文档中说明该文件必须存在或提供 fallback 方案
Recommendation: 建议在文档中添加对 agent-skill-swiftui.el 文件存在性的说明,或提供文件缺失时的错误处理指引
Highlights
- 使用 base64 编码传递 Swift 源码,避免 shell quoting 问题
- 明确处理渲染失败场景并返回源码供调试
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.