clerk/skills

clerk-swift

Implement Clerk authentication UI in native Swift apps on iOS and macOS with ClerkKitUI prebuilt views or custom ClerkKit flows.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/clerk/skills --skill clerk-swift

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Clerk Swift (Native iOS and macOS)

This skill builds Clerk authentication UI in native Swift projects: prebuilt ClerkKitUI views or custom flows on ClerkKit. Setup (SDK, capabilities, native registration, and Clerk initialization) comes first and has its own workflow.

Activation Rules

Activate this skill when either condition is true:

  • The user explicitly asks for Swift, SwiftUI, UIKit, or native iOS or macOS Clerk implementation.
  • The project appears to be native Swift (for example .xcodeproj, .xcworkspace, Package.swift, Swift targets).

Do not activate this skill when either condition is true:

  • The project is Expo.
  • The project is React Native.

If Expo/React Native signals are present, route to the general setup skill instead of this one.

Set up Clerk first

If Clerk isn't set up yet (no clerk-ios package, no Clerk.configure call, or no Clerk application chosen), follow the iOS setup prompt before any UI work. It uses the Clerk CLI to choose a Clerk application, install the SDK, configure capabilities, register the native app, and hand off the remaining Swift integration. The CLI also supplies the publishable key, so don't ask the user to paste one.

If the CLI can't set up the project (for example, Xcode isn't available or the project isn't supported), follow the manual iOS quickstart instead.

If the user already asked for sign-in UI, such as a custom flow, continue here once setup's build check passes. Otherwise, return to this skill when the user wants sign-in UI added or changed.

What Do You Need?

TaskReference
Prebuilt AuthView / UserButton (fastest)references/prebuilt.md
Custom API-driven auth flows (full control)references/custom.md

Quick Start

StepAction
1Confirm the project is native Swift and not Expo/React Native
2If Clerk isn't set up, follow the iOS setup prompt first (see above)
3Determine the flow type (prebuilt or custom); ask if it's undecided, then load the matching reference
4Check the prerequisites the selected flow needs, such as a package product or capability, and make only the targeted changes that are missing
5Implement the flow by following the selected reference
6Build the target and report what remains unverified

Decision Tree

text
User asks for Clerk in Swift
    |
    +-- Expo/React Native project detected?
    |     |
    |     +-- YES -> Do not use this skill
    |     |
    |     +-- NO -> Continue
    |
    +-- Clerk set up in this project?
    |     |
    |     +-- NO -> Follow the iOS setup prompt (manual quickstart if the CLI can't)
    |     |
    |     +-- YES -> Continue
    |
    +-- Existing auth UI detected?
    |     |
    |     +-- Prebuilt views detected -> Load references/prebuilt.md
    |     |
    |     +-- Custom flow detected -> Load references/custom.md
    |     |
    |     +-- New implementation -> Ask developer prebuilt/custom, then load matching reference
    |
    +-- Make targeted prerequisite changes for the selected flow
    |
    +-- Implement using selected flow reference

Flow References

After flow type is known, load exactly one:

Do not blend the two references in a single implementation unless the developer explicitly asks for a hybrid approach.

Interaction Contract

Before UI implementation edits, the agent must have a flow choice: prebuilt or custom. If it's missing, ask the user and wait for the answer. Only skip asking when the user has already chosen in this conversation or the existing UI makes the choice clear.

Preserve Completed Setup

  • Keep the existing Clerk.configure call and how the app loads its publishable key, including plist, build-setting, or other custom key loading. Don't replace it with a hardcoded key.
  • Keep existing package requirements, capabilities, and entitlements. Add only what the selected flow needs and is missing.
  • To check Clerk and project setup without changing anything, run npx -y clerk@latest doctor. It reports SDK linkage, capabilities, native registration, and the Apple connection.

Source-Driven Implementation

Use the installed clerk-ios package source as the reference for UI behavior, especially for custom flows.

Use CaseSource of Truth in Installed Package
SDK products, platform support, and dependency constraintsPackage manifest and target product definitions for ClerkKit and ClerkKitUI
Auth flow sequencing and gatingClerkKitUI AuthView implementation and how it reads the injected Clerk instance's environment
Native Sign in with AppleApple sign-in behavior in the selected flow reference

Workflow

  1. Detect native Swift vs Expo/React Native.
  2. If Clerk isn't set up, follow the iOS setup prompt (or the manual quickstart when the CLI can't set up the project), then continue.
  3. If the flow type isn't known, ask for prebuilt or custom.
  4. Load the matching flow reference.
  5. Check that flow's prerequisites and make only the missing, targeted changes, preserving completed setup and custom key loading.
  6. Implement using the selected reference.
  7. Verify using the selected reference, then build the target.

Common Pitfalls

LevelIssuePrevention
CRITICALDoing setup by hand when Clerk isn't set upFollow the iOS setup prompt; it runs the Clerk CLI. Use the manual quickstart only when the CLI can't set up the project
CRITICALAsking the user to paste a publishable keyThe CLI provides it during setup; keep an existing app's own key loading
CRITICALReplacing custom key loading or existing setupKeep the existing Clerk.configure, packages, and capabilities; add only what's missing
CRITICALStarting UI implementation before the flow type is confirmedConfirm the flow first and load the matching reference
CRITICALCustom flow layout diverges from AuthView without explicit requestKeep custom screens materially close to AuthView structure and step composition by default
CRITICALCollapsing custom auth into a single all-fields screenFollow AuthView-style multi-step progression and step-specific field collection
CRITICALGuessing custom sequencing or gating when uncertainReference installed ClerkKitUI behavior and mirror it
HIGHHardcoding this instance's current settings into custom flow codeGate steps at runtime from the injected Clerk instance's environment, as AuthView does
HIGHUsing this skill for Expo/React NativeDetect and route away before implementation

See Also

  • iOS setup prompt for setting up Clerk with the Clerk CLI
  • clerk skill for top-level Clerk routing
  • clerk-setup skill for non-native or cross-framework setup
  • https://github.com/clerk/clerk-ios

Related by task

from this repository

More skills

All skills
clerk
Official

clerk-expo

Add Clerk authentication to Expo and React Native apps using @clerk/expo. Use for Expo setup, prebuilt native components (AuthView, UserButton), custom sign-in/sign-up flows (email, password, SMS/phone OTP, MFA), OAuth/SSO, native Google/Apple sign-in, Expo Router protected routes, biometrics, and push notifications. Do not use for native Swift/iOS, native Android/Kotlin, or web-only framework projects.

installs
2
GitHub stars
89
Updated
Oct 25
clerk
Official

clerk-nuxt-patterns

'Nuxt 3 auth patterns with @clerk/nuxt - middleware, composables, server API routes, SSR. Triggers on: Nuxt auth, useAuth composable, clerkMiddleware Nuxt, server API Clerk, Nuxt route protection.'

installs
2
GitHub stars
89
Updated
Oct 23
clerk
Official

clerk-custom-ui

Custom authentication flows and component appearance - hooks (useSignIn, useSignUp), themes, colors, fonts, CSS. Use for custom sign-in/sign-up flows, appearance styling, visual customization, branding.

installs
10
GitHub stars
89
Updated
Oct 23
clerk
Official

clerk-orgs

Clerk Organizations for B2B and multi-tenant apps - org switching, roles and permissions, verified domains, and enterprise SSO. Use for team workspaces, RBAC, org-scoped routing, member management. Also load this when a project treats teams, workspaces, tenants, or companies as its customers - shared accounts, inviting teammates, per-seat pricing, per-company data isolation - even when the words "organization" or "B2B" are never used.

installs
10
GitHub stars
89
Updated
Oct 23