All skills
clerk avatar

/clerk-swift

@dbc2e14 official
by clerkclerk/skills83 stars
5

Implement Clerk authentication for native Swift and iOS apps using ClerkKit and ClerkKitUI source-guided patterns. Use for prebuilt AuthView or custom native flows. Do not use for Expo or React Native projects.

Use this Skill: https://skilld.dev/gh/clerk/skills/clerk-swift

This session only. Nothing lands on disk.

referencescustom.md

≈1.9k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Custom Flow Reference (ClerkKit)

Use this file only when flow type is custom.

Purpose

Implement native iOS auth with ClerkKit primitives while keeping flow and layout very close to ClerkKitUI AuthView by default.

Source-Driven Requirements

Use installed package source from Xcode DerivedData:

  • ~/Library/Developer/Xcode/DerivedData/.../SourcePackages/checkouts/clerk-ios

Source priority rules for custom flow:

  • Primary source: installed ClerkKitUI source for auth UI behavior and gating parity.
  • Secondary source: installed ClerkKit source for core auth/network/config behavior.
  • Fallback only: example apps (local or GitHub) when behavior is unclear from library source.

For custom flows, treat ClerkKitUI AuthView as a strict parity target for:

  • step progression/sequencing
  • field visibility and hidden-state rules per step
  • branching between factors/strategies
  • screen structure and layout composition per step
  • view hierarchy and section ordering per step

Required Patterns

  1. Package products
  • If clerk-ios is not installed, add it using the latest available release with an up-to-next-major package requirement.
  • Do not pin an exact package version unless the developer explicitly requests version pinning.
  • Add ClerkKit by default.
  • Add ClerkKitUI only if the developer explicitly asks for mixed prebuilt/custom composition.
  1. Quickstart prerequisite audit
  • Find the iOS quickstart URL in the installed clerk-ios package README, append .md, then visit and read that markdown URL.
  • Build a checklist from the visited markdown quickstart and verify the current project completed all required setup.
  • If required setup is missing, add it before finishing custom auth implementation.
  • Always add any missing Associated Domains entries and any other capabilities required by the quickstart.
  • Explicitly apply quickstart step Add associated domain capability (https://clerk.com/docs/ios/getting-started/quickstart#add-associated-domain-capability); ensure webcredentials:{YOUR_FRONTEND_API_URL} exists when missing.
  1. Environment inspection + normalization
  • Inspect installed ClerkKitUI source first to identify which Environment fields and semantics drive flow behavior.
  • Build an agent-internal Environment field map from that source inspection.
  • Make a direct HTTP call to /v1/environment only after the Environment field map is defined.
  • Derive from the response using that ClerkKitUI-aligned field map (agent-internal only):
    • normalized ClerkKitUI-style capability matrix
    • required-field matrix
  • Drive custom-flow implementation decisions from these matrices.
  • Do not serialize or add these matrices as source artifacts in the app codebase.
  1. Combined-entry default
  • Keep a combined sign-in-or-sign-up entry by default.
  • Do not add a local sign-in/sign-up mode switcher unless explicitly requested.
  1. AuthView progression parity
  • Follow ClerkKitUI AuthView progression logic for advancing/regressing steps.
  • Show/hide inputs exactly according to the active step requirements instead of static form layouts.
  • Keep factor/strategy branching aligned with how AuthView gates transitions.
  • Keep screen layout and component structure very close to AuthView defaults unless the developer explicitly requests a different UX.
  • Keep view hierarchy and section ordering close to AuthView on each step; do not redesign the information architecture unless explicitly requested.
  • Break the custom flow into multiple step screens/states similar to AuthView; do not try to gather all signup/signin requirements in one view.
  • If proposed custom layout materially deviates from AuthView, stop and ask for explicit developer approval before implementing.
  1. Multi-file organization and separation of concerns
  • Break custom auth flow into focused files/modules instead of one large screen file.
  • Separate UI step views, flow/state orchestration, and Clerk/network integration responsibilities.
  • Keep per-file responsibilities narrow and composable so new factors/steps can be added without rewriting a monolithic view.
  1. Capability-matrix-driven implementation
  • Drive custom flow behavior from normalized ClerkKitUI-style capability mapping.
  • Do not rely on one-off raw environment checks.
  • Apply matrix outcomes to runtime flow logic only; do not add matrix models/constants/files to the project.
  • Ensure custom logic uses the same environment-field gates and interpretations that ClerkKitUI uses.
  1. Required-field coverage
  • Implement all required fields from required-field matrix.
  • Do not ship flow with missing required fields.
  1. Apple sign-in policy
  • Implement Apple via native Clerk Apple path.
  • If Apple capability is required for this app and missing, add it.
  • Do not implement Apple through generic social-provider OAuth handling.
  1. Source parity
  • Follow installed ClerkKitUI and ClerkKit source patterns for sequencing, factor handling, and verification steps.
  • When unsure about custom-flow implementation details, sequencing, gating, or Environment usage/semantics, stop guessing and reference installed ClerkKitUI implementation behavior.
  • Resolve ambiguity by mirroring ClerkKitUI behavior unless the developer explicitly asks for a different approach.

Verification Checklist

  1. Quickstart prerequisites are complete
  • Quickstart link was sourced from installed clerk-ios package README, .md was appended, and the markdown page was visited/read.
  • Required project setup from quickstart is present.
  • Any missing quickstart-required Associated Domains/capabilities were added, not just reported.
  • Quickstart Add associated domain capability step was applied, including webcredentials:{YOUR_FRONTEND_API_URL}.
  1. No unrequested mode switcher
  • No local toggle/segmented control/tabs for sign-in vs sign-up unless explicitly requested.
  1. Environment call completed
  • Installed ClerkKitUI Environment field usage was inspected before calling /v1/environment.
  • Direct /v1/environment call succeeded after field-map inspection.
  1. AuthView flow parity
  • Step transitions follow AuthView progression rules.
  • Inputs shown at each step match AuthView step-level visibility behavior.
  • Step layouts and component grouping are materially close to AuthView; do not introduce major layout redesign unless explicitly requested.
  • View hierarchy/section ordering remain close to AuthView across steps unless explicitly requested otherwise.
  • Flow is split across multiple steps like AuthView; required data is not collected in one monolithic screen.
  • When implementation ambiguity appears, final behavior matches installed ClerkKitUI rather than an inferred/custom interpretation.
  1. Flow organization quality
  • Custom flow code is split into multiple focused files/modules (not a single monolithic auth view file).
  • UI, state/flow orchestration, and integration logic are separated with clear boundaries.
  1. Matrices created and used
  • Capability matrix and required-field matrix exist and drive the implementation.
  • Matrix artifacts are not written into project source files.
  • Environment fields used for gating/requirements match the set and semantics used by installed ClerkKitUI.
  1. Required fields covered
  • Required-field matrix has full coverage in custom UI.
  1. Capability-map parity
  • Feature availability and branching use normalized capability map.
  1. Apple path correctness
  • Apple flow uses native path, not generic provider OAuth path.
  1. No unrequested prebuilt dependency
  • ClerkKitUI is not added unless explicitly needed.

Source: SKILL.md on GitHub

2 warnings16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill facilitates the integration of Clerk authentication into Swift and iOS projects. It contains instructions that discourage the use of secret management for public keys and implements a workflow that fetches and follows instructions from remote documentation to modify project settings and entitlements.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: MEDIUM · 2 issues

  • Runlayer7mo

    3/4 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at dbc2e14. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 6 months ago
What it can do
Network
metadata
{
  "author": "clerk",
  "version": "1.2.0"
}
compatibility
Requires Xcode and ClerkKit Swift package
All 1 allowed tools
WebFetch
  • swift
  • ios
  • swiftui
  • uikit
  • clerk
  • authentication
  • native
  • clerkkit

README badge

README badge for clerk/skills/clerk-swift

Implements Clerk authentication in native Swift and iOS apps using ClerkKit and ClerkKitUI, with support for prebuilt AuthView or custom native flows. Does not support Expo or React Native projects.

Generated from the current SKILL.md.

Does this skill work with Expo or React Native?
No. This skill is for native Swift and iOS projects only. Do not activate it for Expo or React Native; route to the general setup skill instead.
Do I need to provide a Clerk publishable key before implementation?
Yes. The skill will not proceed with file edits until you provide a valid publishable key. The key is wired directly into the Clerk.configure call without indirection.
Can I choose between prebuilt views and a custom auth flow?
Yes. The skill supports both prebuilt AuthView (fastest) and custom API-driven flows (full control). You must declare which one you want before implementation begins.
Will this skill handle associated domain setup for Sign in with Apple?
Yes. The skill reads the quickstart from the installed clerk-ios package, audits your project against all required steps, and applies missing setup including the associated domain capability with the correct webcredentials format.
Does this skill inspect my installed ClerkKit package?
Yes. It inspects the installed ClerkKit and ClerkKitUI source to map Environment field usage, determine required capabilities, and call the /v1/environment endpoint before implementation.

Generated from the current SKILL.md. These answers refresh after source changes.