swiftui-patterns
БесплатноБез исполняемых скриптовНе проверенBuild macOS SwiftUI scenes and components with desktop patterns. Use when shaping windows, commands, toolbars, settings, split views, or inspectors.
от openai★ 8 494 звезды на GitHubОб этом скилле
SwiftUI Patterns
Quick Start
Choose a track based on your goal:
Existing project
- Identify the feature or scene and the primary interaction model: document, editor, sidebar-detail, utility window, settings, or menu bar extra.
- Read the nearest existing scene or root view before inventing a new desktop structure.
- Choose the relevant reference from
references/components-index.md. - If SwiftUI cannot express the required platform behavior cleanly, use the
appkit-interopskill rather than forcing a shaky workaround.
New app scaffolding
- Choose the scene model first:
WindowGroup,Window,Settings,MenuBarExtra, orDocumentGroup. - If the app combines a normal main window and a
MenuBarExtra, useWindowGroup(..., id:)for the primary window when it should appear at launch. TreatWindow(...)as a better fit for auxiliary/on-demand singleton windows; in menu-bar-heavy apps, aWindow(...)scene may not present the main window automatically at launch. - Before creating the scaffold, check whether the workspace is already inside a git repo with
git rev-parse --is-inside-work-tree. If not, rungit initat the project root so Codex app git-backed features are available from the start. Do not initialize a nested repo inside an existing parent checkout. - For a new app scaffold, also create one project-local
script/build_and_run.shand.codex/environments/environment.tomlso the Codex app Run button works immediately. Use the exact bootstrap contract frombuild-run-debugand itsreferences/run-button-bootstrap.mdfile rather than inventing a second variant here. - Decide which state is app-wide, scene-scoped, or window-scoped before writing views.
- Sketch file and module boundaries before writing the full UI. For any non-trivial app, create the folder structure first and split files by responsibility from the start.
- Use a single Swift file only for tiny throwaway examples or snippets: roughly under 50 lines, one screen, no persistence, no networking/process client, and no reusable models. Anything beyond that should be multi-file immediately.
- Use system-adaptive colors and materials by default (
Color.primary,Color.secondary, semantic foreground styles,.regularMaterial, etc.) so the app follows Light/Dark mode automatically. Do not hardcode white or light backgrounds unless the user explicitly asks for a fixed theme, and do not reach for opaquewindowBackgroundColorfills for root panes by default. - Pick the references for the first feature surface you need: windowing, commands, split layouts, or settings.
New App File Structure
For any non-trivial macOS app, start with this shape instead of putting the app, all views, models, stores, services, and helpers in one Swift file:
App/<AppName>App.swift: the@mainapp type andAppDelegateonly.Views/ContentView.swift: root layout and high-level composition only.Views/SidebarView.swift,Views/DetailView.swift,Views/ComposerView.swift, etc.: feature views named after their primary type.Models/*.swift: value models, identifiers, and selection enums.Stores/*.swift: persistence and state stores.Services/*.swift: app-server, network, process, or platform clients.Support/*.swift: small formatters, resolvers, extensions, and glue helpers.
Keep files small and named after the primary type they contain. If a file starts collecting unrelated views, models, stores, networking clients, and helper extensions, split it before adding more behavior.
Pre-Edit Checklist For New App Scaffolds
Before writing the full UI:
- Choose the scene model.
- Choose state ownership: app-wide, scene-scoped, window-scoped, or view-local.
- Sketch file and module boundaries.
- Create the folder structure before filling in the UI.
- Keep
script/build_and_run.shand.codex/environments/environment.tomlseparate from app source.
General Rules To Follow
- Design for pointer, keyboard, menus, and multiple windows.
- Keep scenes explicit. A separate settings window, utility window, or menu bar extra should be modeled as its own scene, not hidden inside one monolithic
ContentView. - Prefer system desktop affordances:
commands, toolbars, sidebars, inspectors, contextual menus, andsearchable. - For menu bar apps, keep
MenuBarExtraitem titles and action labels short and scannable. Cap visible menu item text at 30 characters; if source content is longer, truncate or summarize it before rendering and open the full content in a dedicated window or detail surface. - If a
MenuBarExtraapp should still behave like a regular Dock app with a visible main window/process, install anNSApplicationDelegatevia@NSApplicationDelegateAdaptor, callNSApp.setActivationPolicy(.regular)during launch, and activate the app withNSApp.activate(ignoringOtherApps: true). If the app is intentionally menu-bar-only, document that.accessory/ no-Dock behavior is a deliberate product ch
Установить swiftui-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swiftui-patterns?
Build macOS SwiftUI scenes and components with desktop patterns. Use when shaping windows, commands, toolbars, settings, split views, or inspectors.
Как установить скилл swiftui-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swiftui-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic