Universal Links with AI agents
Use universal links so one HTTPS URL opens your app when it is installed, and the website when it is not. Add the Associated Domains capability, host apple-app-site-association at /.well-known/ over HTTPS with no redirects, and handle NSUserActivity. Validate every URL parameter. Look up Apple's Associated Domains docs first.
Last updated:
Apple facts are from "Supporting associated domains", "Allowing apps and websites to link to your content", "Supporting universal links in your app" and "Associated Domains Entitlement" on developer.apple.com. Tool facts are from each README. Stars as of 13 Nov 2026.
What Apple documents
Universal links let users open content deep inside your app. They are standard HTTP or HTTPS links, so one URL works for both your website and your app. If the person has not installed your app, the system opens the URL in their default web browser.
When someone installs your app, the system checks a file stored on your web server to verify that your website allows your app to open URLs on its behalf. Only you can store this file on your server.
Associated domains establish a secure association between domains and your app. Shared web credentials, universal links, Handoff and App Clips all use associated domains. Sign in with Apple is a separate flow (Sign in with Apple with AI agents). Passkeys use the
webcredentialsservice (Passkeys with AI agents). Associated domains underpin universal links, so an app can present content in place of all or part of its website.Add the associated domain file to your website by creating a file named
apple-app-site-association(without an extension). Place it in the site’s.well-knowndirectory so the file’s URL ishttps://<fully qualified domain>/.well-known/apple-app-site-association. Host it usinghttps://with a valid certificate and with no redirects. If the site uses multiple subdomains, each needs its own entry and its own file.For universal links, list the app identifiers for your domain in the
applinksservice, using the format<Application Identifier Prefix>.<Bundle Identifier>. App Clips use theappclipsservice and a separate App Clip target (App Clips with AI agents); this page coversapplinksonly.In Xcode, open the target’s Signing & Capabilities tab and add the Associated Domains capability. Each domain uses the format
<service>:<fully qualified domain>— for universal links, that service isapplinks. Include only the desired subdomain and the top-level domain; do not include path, query, or a trailing slash. For services other thanappclips, you can prefix a domain with*.to match all of its subdomains. For watchOS apps with a separate WatchKit extension, add the capability to the WatchKit Extension target.Starting with macOS 11 and iOS 14, apps request
apple-app-site-associationfiles from an Apple-managed CDN for associated domains, not directly from your web server. Apple’s CDN requests the file for your domain within 24 hours. Devices check for updates approximately once per week after app installation. While developing against a private server unreachable from the public internet, you can add a?mode=query string on the entitlement to bypass the CDN.When a user activates a universal link, the system launches your app and delivers an
NSUserActivity. The activity type isNSUserActivityTypeBrowsingWeb, andwebpageURLholds the HTTP or HTTPS URL. Handle it in the scene delegate (scene(_:continue:)/scene(_:willConnectTo:options:)) or the matching app-delegate entry points. Validate all URL parameters and discard any malformed URLs. Limit the available actions; do not allow a universal link to directly delete content or access sensitive information about the user.When a user browses your website in Safari and taps a universal link in the same domain, the system opens that link in Safari. If the user taps a universal link in a different domain, the system opens the link in your app.
Rules for AGENTS.md
Code
- Use universal links (Associated Domains, applinks) for HTTP or HTTPS links into this app. Do not add a custom URL scheme as a substitute unless I ask.
- Host apple-app-site-association at https://<domain>/.well-known/apple-app-site-association over HTTPS with a valid certificate and no redirects.
- Add the Associated Domains capability and an applinks:<domain> entry. Do not put a path, query or trailing slash in the entitlement.
- Handle incoming links through NSUserActivity (NSUserActivityTypeBrowsingWeb / webpageURL). Validate every URL parameter and reject malformed URLs. Do not let a link delete content or read sensitive user data.
- Look up Associated Domains and “Supporting universal links in your app” on developer.apple.com before writing the entitlement or the handler.Step 1: ground the agent in Associated Domains docs
Install Apple Docs MCP or Sosumi and ask it to open “Supporting associated domains” and “Supporting universal links in your app”.
Step 2: associate the site and the app
Have the agent add the Associated Domains capability with an applinks: entry for your domain, and draft apple-app-site-association for the .well-known path. Host the file over HTTPS with no redirects. Remember the Apple CDN delay after you first publish or change the file.
Step 3: handle the incoming activity
Implement the scene (or app delegate) continue-user-activity path. Read webpageURL, parse it with URLComponents, validate parameters, and route to the matching screen. Do not take destructive or sensitive actions from the URL alone.
Step 4: review the SwiftUI around the destination
Run swiftui-pro on the screen the link opens, so navigation and accessibility around that destination stay current.
Tools compared (4)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
| Apple Docs MCP (kimsungwhee) | Look up Associated Domains, applinks and NSUserActivity APIs | Claude Code, Cursor, VS Code, Windsurf | claude mcp add apple-docs -- npx -y @kimsungwhee/apple-docs-mcp@latest | MIT | 1385 | 17 Mar 2026 ⚠ |
| sosumi.ai (NSHipster) | Pull Apple Associated Domains and universal-link docs as Markdown | any MCP host | npx -y mcp-remote https://sosumi.ai/mcp | MIT | 490 | 11 Nov 2026 |
| ApKI (Gucky) | Route the agent to official Apple developer resources | Codex, Claude Code | npx skills add https://github.com/Gucky/ApKI --skill apki | MIT | 2 | 3 Nov 2026 |
| swiftui-pro (twostraws) | Modern SwiftUI around the screen a universal link opens | Claude Code, Cursor, Codex, Gemini | npx skills add https://github.com/twostraws/SwiftUI-Agent-Skill --skill swiftui-pro | MIT | 6539 | 26 Oct 2026 |
⚠ = no push in the last 4 weeks.
Which one to pick
Official API lookup → Apple Docs MCP or Sosumi.
A short route into Apple's current developer resources → ApKI.
SwiftUI around the destination screen → swiftui-pro.
A prompt that keeps the agent honest
Code
Add universal links so https://example.com/buy/* opens the matching product screen in this app. Use Associated Domains with an applinks entry only. Draft apple-app-site-association for the /.well-known/ path, hosted over HTTPS with no redirects. Handle NSUserActivityTypeBrowsingWeb and webpageURL in the scene delegate. Validate every URL parameter and reject malformed URLs. Do not add a custom URL scheme. Do not let a link delete content or read sensitive user data. Look up Associated Domains and “Supporting universal links in your app” in Apple's docs before you write the entitlement or the handler.FAQ
- Do I need a custom URL scheme instead of universal links?
- No. Apple documents universal links as standard HTTP or HTTPS links, so one URL works for both your website and your app. If the person has not installed your app, the system opens the URL in their default web browser. Use Associated Domains (`applinks`) rather than inventing a custom scheme as a substitute.
- Where does the apple-app-site-association file go?
- Create a file named `apple-app-site-association` (without an extension) and place it in the site’s `.well-known` directory so the URL is `https://<fully qualified domain>/.well-known/apple-app-site-association`. Host it using HTTPS with a valid certificate and with no redirects. List your app identifiers under the `applinks` service.
- Why does a link open in Safari instead of my app?
- When a user browses your website in Safari and taps a universal link in the same domain, the system opens that link in Safari, respecting the intent to stay in the browser. If the user taps a universal link in a different domain, the system opens the link in your app. Also confirm the association file is on the public HTTPS path with no redirects; starting in iOS 14 and macOS 11, devices fetch it through Apple’s associated-domains CDN.
- How should the app handle an incoming universal link?
- The system delivers an `NSUserActivity` whose activity type is `NSUserActivityTypeBrowsingWeb` and whose `webpageURL` is the HTTP or HTTPS URL. Handle it in the scene or app delegate, extract the URL components, validate all parameters, and discard malformed URLs. Do not allow a universal link to directly delete content or access sensitive information about the user.
- Which tool should I install first?
- Apple Docs MCP or Sosumi, so the agent opens “Supporting associated domains” and “Supporting universal links in your app” instead of inventing entitlements or handlers. Add swiftui-pro for the SwiftUI around the destination screen.