К основному содержанию
скилл CX Codex GP ChatGPT официальный · OpenAI

swiftui-ui-patterns — скилл для Codex: что делает и как установить

Скилл помогает собирать и рефакторить SwiftUI-интерфейсы: навигацию, состояние, компоновку и контролы. Подойдёт для новых экранов и правок существующего проекта.

Установить в Codex · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add openai/plugins --skill swiftui-ui-patterns -a codex
Открыть на GitHub

Что делает swiftui-ui-patterns

swiftui-ui-patterns задаёт рабочий процесс для SwiftUI. Он помогает определить модель взаимодействия, найти похожий экран через rg "TabView\\(", выбрать локальные соглашения и собрать интерфейс из небольших представлений. Для нового проекта скилл предлагает начать с references/app-wiring.md, где описана связка TabView, NavigationStack и sheets.

Внутри есть ссылки на рекомендации по навигации, sheets, deep links, асинхронному состоянию, preview и производительности. Скилл советует использовать @State, @Binding, @Observable и @Environment, а для iOS 16 и более ранних версий — ObservableObject с подходящими property wrappers. Для async-логики применяются .task и явные состояния загрузки и ошибки.

Ставьте его, если агенту нужно поддерживать SwiftUI-код на уровне структуры и состояния. Для проекта без SwiftUI эти рекомендации не пригодятся.

Какие задачи решает

  • собрать экран SwiftUI из небольших представлений
  • настроить TabView, NavigationStack и sheets
  • выбрать владельца состояния для нового экрана
  • добавить async-загрузку с состояниями загрузки и ошибки
  • проверить preview, маршрутизацию и идентичность списков

Примеры запросов агенту

  • Собери новый экран настроек на SwiftUI с TabView и NavigationStack.
  • Разбери состояние этого экрана и замени лишнюю модель представления на подходящий SwiftUI property wrapper.
  • Добавь загрузку данных через `.task`, состояния загрузки и ошибки, затем проверь preview.

Как установить swiftui-ui-patterns

1Через Skills CLI (Vercel)

npx skills add openai/plugins --skill swiftui-ui-patterns -a codex

2Вручную: положить файлы

.agents/skills/swiftui-ui-patterns/SKILL.md

Для всех проектов — ~/.agents/skills/

Из того же набора201

Весь набор →
supabase официальный supabase Скилл помогает настраивать базу данных, аутентификацию и RLS в Supabase без скрытых дыр в безопасности. CX Codex GP ChatGPT 8установок remotion-render официальный Remotion Экспортирует видео и отдельные кадры из проектов Remotion через консольные команды. CX Codex GP ChatGPT 3установок figma-create-new-file официальный Figma Создаёт пустые файлы Figma, FigJam или Slides в черновиках нужной команды. Скилл готовит параметры и planKey перед запуском MCP-инструментов. CX Codex GP ChatGPT 6установок swiftui-performance-audit официальный OpenAI Находит причины просадок кадров, долгого рендеринга и утечек памяти в SwiftUI. Помогает разобрать код вьюшек или подготовить замеры для профилирования. CX Codex GP ChatGPT 109установок swiftui-liquid-glass официальный OpenAI Скилл помогает создавать и проверять интерфейсы SwiftUI с Liquid Glass для iOS 26+. Он нужен при внедрении эффекта, ревью и проверке fallback-сценариев. CX Codex GP ChatGPT 121установок swiftui-view-refactor официальный OpenAI Скилл наводит порядок в коде SwiftUI: делит разросшиеся экраны на отдельные структуры View и выносит побочные эффекты из body. CX Codex GP ChatGPT 113установок ios-memgraph-leaks официальный OpenAI Скилл захватывает и разбирает утечки памяти iOS из симулятора или .memgraph. Нужен для поиска удерживающих связей и проверки исправлений. CX Codex GP ChatGPT 1 054установок status официальный Vercel Labs Проверяет состояние проекта Vercel, последние деплои, домены и настройки наблюдаемости прямо через диалог с моделью. CX Codex GP ChatGPT 348установок

Похожие

anti-ui-slop официальный UIZZE Скилл помогает агенту собирать интерфейсы под конкретный продукт, а не шаблонный UI. Пригодится для разработки, редизайна и проверки web- или iOS-экранов. GitHub Copilot 967установок sign-in-with-google-web официальный google Помогает настроить вход через Google Identity Services на вебе. Защищает токены и закрывает уязвимости авторизации по стандартам IETF. Claude Code Gemini CLI CX Codex 743установок react-audit-grep-patterns официальный github Набор grep-команд для проверки React-проектов перед переходом на React 18.3.1 или React 19. Помогает агентам находить устаревший синтаксис. GitHub Copilot 854установок salesforce-component-standards официальный github Задаёт стандарты разработки компонентов Salesforce для LWC, Aura и Visualforce. Помогает настроить безопасность, доступ к данным и интерфейс. GitHub Copilot 770установок react18-dep-compatibility официальный github Проверяет минимальные версии зависимостей для React 18.3.1 и React 19. Пригодится при обновлении React и разборе peer dependency конфликтов. GitHub Copilot 764установок react18-batching-patterns официальный github Находит и устраняет регрессии автоматического батчинга в классовых компонентах React 18. Помогает исправить баги после обновления с React 17. GitHub Copilot 754установок frontend-design официальный anthropics Скилл задаёт осмысленное визуальное направление для новых интерфейсов и редизайна. Подойдёт, когда стандартный шаблонный UI не устраивает. Claude Code Claude.ai 1 025 790установок design-taste-frontend Leonxlnx Скилл задаёт арт-дирекцию для публичных страниц и рабочих экранов, а затем проверяет результат в браузере по скриншотам. Нужен, когда интерфейс выглядит шаблонным или недоработанным. Claude Code CX Codex Cursor +1 673 100установок

Вопросы о swiftui-ui-patterns

Как установить swiftui-ui-patterns в Codex?

Выполните npx skills add openai/plugins --skill swiftui-ui-patterns -a codex. Файл скилла появится по пути .agents/skills/swiftui-ui-patterns/SKILL.md.

Что делает swiftui-ui-patterns?

Скилл помогает проектировать и рефакторить SwiftUI-интерфейсы: навигацию, состояние, layout, контролы и композицию экранов. Он также подсказывает, как организовать async-состояние и previews.

Какой подход к состоянию использует swiftui-ui-patterns?

Для iOS 17 и новее рекомендуются @State, @Binding, @Observable и @Environment по модели владения. Для iOS 16 и более ранних версий используется ObservableObject с @StateObject и @ObservedObject там, где это нужно.

Исходный текст

SKILL.md · MIT
---
name: swiftui-ui-patterns
description: Build and refactor SwiftUI UI with component patterns and examples. Use when shaping navigation, state, layouts, controls, or screen composition.
---

# SwiftUI UI Patterns

## Quick start

Choose a track based on your goal:

### Existing project

- Identify the feature or screen and the primary interaction model (list, detail, editor, settings, tabbed).
- Find a nearby example in the repo with `rg "TabView\("` or similar, then read the closest SwiftUI view.
- Apply local conventions: prefer SwiftUI-native state, keep state local when possible, and use environment injection for shared dependencies.
- Choose the relevant component reference from `references/components-index.md` and follow its guidance.
- If the interaction reveals secondary content by dragging or scrolling the primary content away, read `references/scroll-reveal.md` before implementing gestures manually.
- Build the view with small, focused subviews and SwiftUI-native data flow.

### New project scaffolding

- Start with `references/app-wiring.md` to wire TabView + NavigationStack + sheets.
- Add a minimal `AppTab` and `RouterPath` based on the provided skeletons.
- Choose the next component reference based on the UI you need first (TabView, NavigationStack, Sheets).
- Expand the route and sheet enums as new screens are added.

## General rules to follow

- Use modern SwiftUI state (`@State`, `@Binding`, `@Observable`, `@Environment`) and avoid unnecessary view models.
- If the deployment target includes iOS 16 or earlier and cannot use the Observation API introduced in iOS 17, fall back to `ObservableObject` with `@StateObject` for root ownership, `@ObservedObject` for injected observation, and `@EnvironmentObject` only for truly shared app-level state.
- Prefer composition; keep views small and focused.
- Use async/await with `.task` and explicit loading/error states. For restart, cancellation, and debouncing guidance, read `references/async-state.md`.
- Keep shared app services in `@Environment`, but prefer explicit initializer injection for feature-local dependencies and models. For root wiring patterns, read `references/app-wiring.md`.
- Prefer the newest SwiftUI API that fits the deployment target and call out the minimum OS whenever a pattern depends on it.
- Maintain existing legacy patterns only when editing legacy files.
- Follow the project's formatter and style guide.
- **Sheets**: Prefer `.sheet(item:)` over `.sheet(isPresented:)` when state represents a selected model. Avoid `if let` inside a sheet body. Sheets should own their actions and call `dismiss()` internally instead of forwarding `onCancel`/`onConfirm` closures.
- **Scroll-driven reveals**: Prefer deriving a normalized progress value from scroll offset and driving the visual state from that single source of truth. Avoid parallel gesture state machines unless scroll alone cannot express the interaction.

## State ownership summary

Use the narrowest state tool that matches the ownership model:

| Scenario | Preferred pattern |
| --- | --- |
| Local UI state owned by one view | `@State` |
| Child mutates parent-owned value state | `@Binding` |
| Root-owned reference model on iOS 17+ | `@State` with an `@Observable` type |
| Child reads or mutates an injected `@Observable` model on iOS 17+ | Pass it explicitly as a stored property |
| Shared app service or configuration | `@Environment(Type.self)` |
| Legacy reference model on iOS 16 and earlier | `@StateObject` at the root, `@ObservedObject` when injected |

Choose the ownership location first, then pick the wrapper. Do not introduce a reference model when plain value state is enough.

## Cross-cutting references

- In addition to the references below, use web search to consult current Apple Developer documentation when SwiftUI APIs, availability, or platform guidance may have changed.
- `references/navigationstack.md`: navigation ownership, per-tab history, and enum routing.
- `references/sheets.md`: centralized modal presentation and enum-driven sheets.
- `references/deeplinks.md`: URL handling and routing external links into app destinations.
- `references/app-wiring.md`: root dependency graph, environment usage, and app shell wiring.
- `references/async-state.md`: `.task`, `.task(id:)`, cancellation, debouncing, and async UI state.
- `references/previews.md`: `#Preview`, fixtures, mock environments, and isolated preview setup.
- `references/performance.md`: stable identity, observation scope, lazy containers, and render-cost guardrails.

## Anti-patterns

- Giant views that mix layout, business logic, networking, routing, and formatting in one file.
- Multiple boolean flags for mutually exclusive sheets, alerts, or navigation destinations.
- Live service calls directly inside `body`-driven code paths instead of view lifecycle hooks or injected models/services.
- Reaching for `AnyView` to work around type mismatches that should be solved with better composition.
- Defaulting every shared dependency to `@EnvironmentObject` or a global router without a clear ownership reason.

## Workflow for a new SwiftUI view

1. Define the view's state, ownership location, and minimum OS assumptions before writing UI code.
2. Identify which dependencies belong in `@Environment` and which should stay as explicit initializer inputs.
3. Sketch the view hierarchy, routing model, and presentation points; extract repeated parts into subviews. For complex navigation, read `references/navigationstack.md`, `references/sheets.md`, or `references/deeplinks.md`. **Build and verify no compiler errors before proceeding.**
4. Implement async loading with `.task` or `.task(id:)`, plus explicit loading and error states when needed. Read `references/async-state.md` when the work depends on changing inputs or cancellation.
5. Add previews for the primary and secondary states, then add accessibility labels or identifiers when the UI is interactive. Read `references/previews.md` when the view needs fixtures or injected mock dependencies.
6. Validate with a build: confirm no compiler errors, check that previews render without crashing, ensure state changes propagate correctly, and sanity-check that list identity and observation scope will not cause avoidable re-renders. Read `references/performance.md` if the screen is large, scroll-heavy, or frequently updated. For common SwiftUI compilation errors — missing `@State` annotations, ambiguous `ViewBuilder` closures, or mismatched generic types — resolve them before updating callsites. **If the build fails:** read the error message carefully, fix the identified issue, then rebuild before proceeding to the next step. If a preview crashes, isolate the offending subview, confirm its state initialisation is valid, and re-run the preview before continuing.

## Component references

Use `references/components-index.md` as the entry point. Each component reference should include:
- Intent and best-fit scenarios.
- Minimal usage pattern with local conventions.
- Pitfalls and performance notes.
- Paths to existing examples in the current repo.

## Adding a new component reference

- Create `references/<component>.md`.
- Keep it short and actionable; link to concrete files in the current repo.
- Update `references/components-index.md` with the new entry.

© OpenAI · MIT · openai/plugins

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой