integration-swift — скилл для Claude Code: что делает и как установить
Скилл integration-swift помогает настроить аналитику PostHog в приложениях на Swift под iOS и macOS по готовой четырёхшаговой схеме.
MIT 108 установок ★ 80 обновлён 2026-10-24
npx skills add PostHog/skills --skill integration-swift -a claude-codeЧто делает integration-swift
Скилл инструктирует ассистента, как встроить SDK PostHog в Swift-проекты под iOS и macOS без изменения существующей кодовой базы. Процесс разбит на четыре стадии: старт интеграции, правки, проверка и финализация. Инструкции требуют брать токен и хост строго из переменных окружения POSTHOG_PROJECT_TOKEN и POSTHOG_HOST через перечисление PostHogEnv.
При правке файла project.pbxproj для добавления пакета Swift Package Manager агент формирует три объекта с собственными UUID: PBXBuildFile, XCSwiftPackageProductDependency и XCRemoteSwiftPackageReference. Версию posthog-ios берёт из свежих релизов, а не прописывает старую вручную. Если в проекте macOS включён App Sandbox, скилл требует включить параметр ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES, сохраняя сам sandbox активным.
Какие задачи решает
- подключить PostHog SDK в проект на Swift через SPM
- настроить идентификацию пользователей при авторизации и регистрации
- добавить сквозные заголовки
X-POSTHOG-DISTINCT-IDиX-POSTHOG-SESSION-IDв API-запросы - отслеживать ошибки в критических пользовательских сценариях
Примеры запросов агенту
- Интегрируй аналитику PostHog в моё приложение для iOS
- Добавь идентификацию пользователей через PostHog при входе в систему
- Настрой отправку ошибок в PostHog на границах сетевых вызовов
Как установить integration-swift
1Через Skills CLI (Vercel)
npx skills add PostHog/skills --skill integration-swift -a claude-code2Вручную: положить файлы
~/.claude/skills/integration-swift/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/integration-swift/
1Через Skills CLI (Vercel)
npx skills add PostHog/skills --skill integration-swift -a codex2Вручную: положить файлы
.agents/skills/integration-swift/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add PostHog/skills --skill integration-swift -a cursor2Вручную: положить файлы
.cursor/skills/integration-swift/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install PostHog/skills skills/posthog/all/skills/integration-swift2Вручную: положить файлы
.github/skills/integration-swift/SKILL.md1Через Skills CLI (Vercel)
npx skills add PostHog/skills --skill integration-swift -a gemini-cli2Командой платформы
gemini skills install https://github.com/PostHog/skills --path skills/posthog/all/skills/integration-swiftВручную: положить файлы
.devin/skills/integration-swift/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add PostHog/skills --skill integration-swift -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об integration-swift
Как установить integration-swift в Claude Code?
Выполните команду npx skills add PostHog/skills --skill integration-swift -a claude-code.
Что делает скилл integration-swift?
Он даёт пошаговые инструкции по встраиванию PostHog в Swift-приложения под iOS и macOS с сохранением App Sandbox и конфигурацией через переменные схемы Xcode.
Как передаются ключи PostHog в проекте?
Ключи не зашиваются в исходный код. Скилл создаёт PostHogEnv и читает POSTHOG_PROJECT_TOKEN и POSTHOG_HOST из настроек схемы запуска Xcode.
Исходный текст
SKILL.md · MIT
--- name: integration-swift description: PostHog integration for Swift iOS and macOS applications metadata: author: PostHog version: 1.9.4 --- # PostHog integration for Swift (iOS/macOS) This skill helps you add PostHog analytics to Swift (iOS/macOS) applications. ## Workflow Follow these steps in order to complete the integration: 1. `basic-integration-1.0-begin.md` - PostHog Setup - Begin ← **Start here** 2. `basic-integration-1.1-edit.md` - PostHog Setup - Edit 3. `basic-integration-1.2-revise.md` - PostHog Setup - Revise 4. `basic-integration-1.3-conclude.md` - PostHog Setup - Conclusion ## Reference files - `references/EXAMPLE.md` - Swift (iOS/macOS) example project code - `references/ios.md` - Ios - docs - `references/identify-users.md` - Identify users - docs - `references/basic-integration-1.0-begin.md` - PostHog setup - begin - `references/basic-integration-1.1-edit.md` - PostHog setup - edit - `references/basic-integration-1.2-revise.md` - PostHog setup - revise - `references/basic-integration-1.3-conclude.md` - PostHog setup - conclusion The example project shows the target implementation pattern. Consult the documentation for API details. ## Key principles - **Environment variables**: Always use environment variables for PostHog keys. Never hardcode them. - **Minimal changes**: Add PostHog code alongside existing integrations. Don't replace or restructure existing code. - **Match the example**: Your implementation should follow the example project's patterns as closely as possible. ## Framework guidelines - Read configuration from environment variables via a `PostHogEnv` enum with a `value` computed property that calls `ProcessInfo.processInfo.environment[rawValue]` and `fatalError`s if missing — cases should be `projectToken = "POSTHOG_PROJECT_TOKEN"` and `host = "POSTHOG_HOST"`, set in the Xcode scheme's Run environment variables - When adding SPM dependencies to project.pbxproj, create three distinct objects with unique UUIDs — a `PBXBuildFile` (with `productRef`), an `XCSwiftPackageProductDependency` (with `package` and `productName`), and an `XCRemoteSwiftPackageReference` (with `repositoryURL` and `requirement`). The build file goes in the Frameworks phase `files`, the product dependency goes in the target's `packageProductDependencies`, and the package reference goes in the project's `packageReferences`. - Check the latest release version of posthog-ios at `https://github.com/PostHog/posthog-ios/releases` before setting the `minimumVersion` in the SPM package reference — do not hardcode a stale version - If the project uses App Sandbox (macOS), add `ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES` to the target's build settings so PostHog can reach its servers — do NOT disable the sandbox entirely ## Identifying users Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. If both frontend and backend code exist, pass the client-side session and distinct ID using `X-POSTHOG-DISTINCT-ID` and `X-POSTHOG-SESSION-ID` headers to maintain correlation. ## Error tracking Add PostHog error tracking to relevant files, particularly around critical user flows and API boundaries.
© PostHog · MIT · PostHog/skills