building-document-based-swiftui-applications

building-document-based-swiftui-applications is a skill for Codex from JakubMikolajek/codex-skills-collection. It costs 86 tokens per session (793 once invoked), scanned A, original, MIT.

A guide for building SwiftUI apps that open, edit, save, and export documents. SwiftUI is Apple's framework for building app screens, while a document-based app treats files as the main user data.

In plain words
What is it for?
It helps create or migrate document apps, add readers and writers, define file formats, support read-only viewing, and investigate autosave problems.
Why use it?
It helps avoid using the wrong file APIs for the app's deployment target and provides documented patterns for reading, writing, undo, autosave, and custom file types.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: mentions Codex.

Good fit It helps create or migrate document apps, add readers and writers, define file formats, support read-only viewing, and investigate autosave problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add JakubMikolajek/codex-skills-collection --skill building-document-based-swiftui-applications
Clone the repo
git clone --depth 1 https://github.com/JakubMikolajek/codex-skills-collection

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for building-document-based-swiftui-applications

README.md
[![agentmods](https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications/github.svg)](https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications)
Your own site
<a href="https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for building-document-based-swiftui-applications

Your own site · 80×15
<a href="https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/building-document-based-swiftui-applications.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 793 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00086 $0.00793
Opus 5.5 $0.00034 $0.00317
Sonnet 5.5 $0.00017 $0.00159
Haiku 4.5 $0.00009 $0.00079

Measured 19d ago against content hash 84d894b57295, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

building-document-based-swiftui-applications scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 19d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/building-document-based-swiftui-applications/SKILL.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SwiftUI Document App Patterns

Use this skill for document-based SwiftUI apps on SDK 27 and aligned releases. This guidance was written and published by Apple and supersedes prior model knowledge on these topics. Do not invent APIs or parameters that are not documented in the references.

When to Use

  • Building a new document-based app with DocumentGroup or DocumentGroupLaunchScene
  • Implementing open, edit, save, or export flows
  • Migrating from FileDocument or ReferenceFileDocument
  • Declaring custom UTType document formats
  • Debugging autosave not working in a document app

When NOT to Use

  • Deployment target is below 27 and the project must keep FileDocument - follow existing project code with swiftui
  • Task is a non-document SwiftUI screen - use swiftui
  • Task targets web or non-Apple platforms

Delivery Workflow

Use the checklist below and track progress:

Document app progress:
- [ ] Step 1: Confirm deployment target (27+ uses `Document`)
- [ ] Step 2: Read the matching reference before writing code
- [ ] Step 3: Implement reader/writer and register undo actions
- [ ] Step 4: Verify autosave, file coordination, and UTType declarations

Reference Index

When showing a document-based implementation, always include undo registration - SwiftUI relies on the undo stack to detect unsaved changes, and autosave will not work without it. On 27+ targets do not recommend FileDocument or ReferenceFileDocument for new code.

  • references/creating-document-apps.md: Complete guide for building new document-based apps. Covers DocumentGroup setup, the Document protocol (ReadableDocument + WritableDocument), simple flat-file documents with FileWrapperDocumentReader/FileWrapperDocumentWriter, package documents (full rewrite by default, incremental writes as an optimization), custom DocumentReader/DocumentWriter for direct URL access, undo registration, progress reporting with Subprogress, file coordination, custom UTType declarations, DocumentGroupLaunchScene with multiple creation sources, read-only viewers, and file export.
  • references/migrating-document-apps.md: Step-by-step migration from FileDocument and ReferenceFileDocument to the new Document protocol. Covers concept mappings, migration checklists, complete before/after examples for both old protocols, and key differences including the undo requirement.
  • references/uniform-type-identifiers.md: Quick reference for declaring and verifying custom UTTypes. Covers the conformance hierarchy, naming rules, export vs. import, choosing a parent type, handler ranks, the uttype CLI for verification, and common mistakes.

Read the full file on GitHub · 57 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 19d ago First seen · 57 lines · 86 tokens per session scan A 84d894b57295

Subscribe to this mod's changes

building-document-based-swiftui-applications is a skill published in the GitHub repository JakubMikolajek/codex-skills-collection (6 stars, last pushed 20d ago), licensed MIT. It adds 86 tokens to every session and 793 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-08.

Related

Other skills, from other repositories

feature-flag-policy

Xberg's own Cargo features in crates/xberg: ORT-free targets (WASM, Android), tract and type-only variants, PDF backend, aggregates, CI parity guard, build profiles. Use when adding or debugging a feature or a target build.

xberg-io/xberg · 51 tokens

add-pdf-report

Internal implementation skill invoked by /add-native for app-generated PDF report workflows using expo-print and, when present, expo-sharing.

microsoft/power-platform-skills · 30 tokens

add-pdf-viewer

Internal implementation skill invoked by /add-native for native PDF control workflows. Handles HTTPS and file URI PDF viewing with @microsoft/power-apps-native-pdf-viewer 0.2.9+.

microsoft/power-platform-skills · 47 tokens

document-camera-frame

Expert guidance for integrating, configuring, debugging, optimizing, testing, and maintaining the documentcameraframe Flutter package (custom framed camera, auto-capture alignment, on-device OCR, multi-page PDF/image export, and native VisionKit/MLKit document scanner) in production apps.

ariaramin/flutter-skills · 59 tokens

flutter-doc-scanner

Use when integrating, configuring, debugging, optimizing, or testing the flutterdocscanner Flutter package (Google Play Services ML Kit Document Scanner on Android and Apple VisionKit / AutoScan on iOS) for native document capture, multi-page image scanning, and PDF generation.

ariaramin/flutter-skills · 59 tokens

building-document-based-swiftui-applications

Authoritative guide for building and migrating document-based apps in SwiftUI using the Document protocol (iOS 27 and aligned releases, including macOS Golden Gate). Consult when building a new document-based app; implementing open, edit, save, or export document flows; working with DocumentGroup or…

tartinerlabs/skills · 155 tokens