appkit-interop — скилл для Codex: что делает и как установить
Помогает встроить AppKit в SwiftUI-проекты для macOS через компактные мосты. Пригодится для доступа к NSWindow, файловым панелям и меню.
npx skills add openai/plugins --skill appkit-interop -a codexЧто делает appkit-interop
Скилл помогает связать SwiftUI и AppKit, когда стандартных возможностей декларативного фреймворка на macOS не хватает. Он подсказывает, какой именно мост применить в конкретном месте: NSViewRepresentable для простых представлений или NSViewControllerRepresentable для задач с делегатами и контроллерами.
SwiftUI остаётся единым источником истины для данных и состояния. Объекты AppKit изолируются внутри обёрток или координаторов, не превращая координатор в склад разрозненной логики. Скилл также предостерегает от глобального хранения ссылок на NSWindow и NSView.
Ставьте этот скилл, если нужно закрыть системные ограничения на macOS без переписывания экрана целиком на чистый AppKit.
Какие задачи решает
- выбрать между NSViewRepresentable и NSViewControllerRepresentable
- настроить доступ к NSWindow и панелям открытия или сохранения файлов
- связать обработку responder chain и валидацию системных меню
- организовать передачу данных через bindings без дублирования состояния
Примеры запросов агенту
- Помоги обернуть NSView через NSViewRepresentable для кастомного поля ввода
- Как получить доступ к NSWindow текущего экрана для настройки стиля окна?
- Настрой валидацию пунктов меню через responder chain без переноса логики из SwiftUI
Как установить appkit-interop
1Через Skills CLI (Vercel)
npx skills add openai/plugins --skill appkit-interop -a codex2Вручную: положить файлы
.agents/skills/appkit-interop/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add openai/plugins --skill appkit-interop -a claude-code2Вручную: положить файлы
~/.claude/skills/appkit-interop/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/appkit-interop/
Вручную: положить файлы
.cursor/skills/appkit-interop/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install openai/plugins appkit-interop2Вручную: положить файлы
.github/skills/appkit-interop/SKILL.mdКомандой платформы
gemini skills install https://github.com/openai/plugins --path plugins/build-macos-apps/skills/appkit-interopВручную: положить файлы
.devin/skills/appkit-interop/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
Из того же набора199
Весь набор →Похожие
Вопросы о appkit-interop
Как установить appkit-interop в Codex?
Выполните npx skills add openai/plugins --skill appkit-interop -a codex в терминале проекта. Команда поместит файл скилла в .agents/skills/appkit-interop/SKILL.md.
Что делает скилл appkit-interop?
Он определяет точечные ограничения SwiftUI на macOS и помогает выстроить минимальный мост к AppKit. Скилл следит за границами потоков данных и жизненным циклом обёрток.
Когда нужно использовать NSViewControllerRepresentable вместо NSViewRepresentable?
Контроллер выбирают, когда требуется управление жизненным циклом контроллера, сложная делегация или координация показа экранов. Для обычных представлений достаточно NSViewRepresentable.
Исходный текст
SKILL.md · MIT
--- name: appkit-interop description: Bridge macOS SwiftUI into AppKit narrowly. Use when implementing representables, reaching NSWindow or panels, handling menus, or using the responder chain. --- # AppKit Interop ## Quick Start Use this skill when SwiftUI is close but not quite enough for native macOS behavior. Keep the bridge as small and explicit as possible. SwiftUI should usually remain the source of truth, while AppKit handles the imperative edge. ## Choose The Smallest Bridge - Use pure SwiftUI when the required behavior already exists in scenes, toolbars, commands, inspectors, or standard controls. - Use `NSViewRepresentable` when you need a specific AppKit view with lightweight lifecycle needs. - Use `NSViewControllerRepresentable` when you need controller lifecycle, delegation, or presentation coordination. - Use direct AppKit window or app hooks when you need `NSWindow`, responder-chain, menu validation, panels, or app-level behavior. ## Workflow 1. Name the capability gap precisely. - Window behavior - Text system behavior - Menu validation - Drag and drop - File open/save panels - First responder control 2. Pick the smallest boundary that solves it. - Avoid porting a whole screen to AppKit when one wrapped control or coordinator would do. 3. Keep ownership explicit. - SwiftUI owns value state, selection, and observable models. - AppKit objects stay inside the representable, coordinator, or bridge object. 4. Expose a narrow interface back to SwiftUI. - Bindings for editable state - Small callbacks for events - Focused bridge services only when necessary 5. Validate lifecycle assumptions. - SwiftUI may recreate representables. - Coordinators exist to hold delegate and target-action glue, not as a second app architecture. ## References - `references/representables.md`: choosing between view and view-controller wrappers, plus coordinator patterns. - `references/window-panels.md`: window access, utility windows, and open/save panels. - `references/responder-menus.md`: first responder, command routing, and menu validation. - `references/drag-drop-pasteboard.md`: pasteboard, file URLs, and desktop drag/drop edges. ## Guardrails - Do not duplicate the source of truth between SwiftUI and AppKit. - Do not let `Coordinator` become an unstructured dumping ground. - Do not store long-lived `NSView` or `NSWindow` instances globally without a strong ownership reason. - Prefer a tiny tested bridge over rewriting the feature in raw AppKit. - If a pattern can remain entirely in `swiftui-patterns`, keep it there. ## Output Expectations Provide: - the exact SwiftUI limitation being crossed - the smallest recommended bridge type - the data-flow boundary between SwiftUI and AppKit - the lifecycle or validation risks to watch
© OpenAI · MIT · openai/plugins