app-extensions
Skill777 starsChanged 5 months agoMITView on GitHub
Generates app extension infrastructure for Share Extensions, Action Extensions, Keyboard Extensions, and Safari Web Extensions with data sharing via App Groups. Use when user wants to add a share extension, action extension, keyboard extension, Safari web extension, or any app extension type.
In this repository183 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- app-intentsSkill
- foundation-modelsSkill
- apple-intelligenceSkill
- visual-intelligenceSkill
- ad-attributionSkill
- app-description-writerSkill
- apple-search-adsSkill
- iap-finalizerSkill
- keyword-optimizerSkill
- marketing-strategySkill
- originality-checkSkill
- ratings-mechanicsSkill
- rejection-handlerSkill
- review-response-writerSkill
- screenshot-plannerSkill
- app-storeSkill
- web-presenceSkill
- core-mlSkill
- animation-patternsSkill
- game-feelSkill
- liquid-glassSkill
- sf-symbolsSkill
- designSkill
- typographySkill
- ui-prototypingSkill
- ux-writingSkill
- attributed-stringSkill
- foundationSkill
- accessibility-generatorSkill
- account-deletionSkill
- analytics-setupSkill
- announcement-bannerSkill
- app-clipSkill
- app-icon-generatorSkill
- app-store-assetsSkill
- auth-flowSkill
- background-processingSkill
- ci-cd-setupSkill
- cloudkit-syncSkill
- consent-flowSkill
- custom-product-pagesSkill
- data-exportSkill
- debug-menuSkill
- deep-linkingSkill
- error-monitoringSkill
- feature-flagsSkill
- featuring-nominationSkill
- feedback-formSkill
- force-updateSkill
- http-cacheSkill
- image-loadingSkill
- in-app-eventsSkill
- lapsed-userSkill
- live-activity-generatorSkill
- localization-setupSkill
- logging-setupSkill
- milestone-celebrationSkill
- networking-layerSkill
- offer-codes-setupSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 12 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill when the user:
- Distinctive: line 34
Search for existing extension targets:
- Distinctive: line 40
If existing extensions found:
- Distinctive: line 41
Ask if user wants to add another or modify existing
- Distinctive: line 45
Check for existing App Groups setup:
- Distinctive: line 51
If App Groups exist, reuse the existing group identifier.
- Distinctive: line 55
Ask user via AskUserQuestion:
- Very specific: line 77
Read templates.md for production Swift code.
- Distinctive: line 100
If data sharing selected:
- Distinctive: line 166
Add the same group identifier
- Distinctive: line 169
Add shared files to both the app and extension targets
- Distinctive: line 208
Test with different content types
- Very specific: line 237
Must call completeRequest() or cancelRequest() when done
- Distinctive: line 238
No access to HealthKit, CallKit, or some restricted frameworks
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
App Extensions Generator
Generate production app extension infrastructure -- Share Extensions for receiving content from other apps, Action Extensions for manipulating content in-place, Keyboard Extensions for custom input, and Safari Web Extensions for browser integration. Includes App Group data sharing between the host app and extensions.
When This Skill Activates
Use this skill when the user:
- Asks to "add a share extension" or "share sheet extension"
- Wants to "receive content from other apps" or "accept shared content"
- Mentions "action extension" or "content manipulation extension"
- Wants to "add a custom keyboard" or "keyboard extension"
- Asks about "Safari extension" or "Safari web extension"
- Mentions "app extension" or "extension target" generically
- Wants to "share data between app and extension" or "App Groups"
Pre-Generation Checks
1. Project Context Detection
- Check deployment target (iOS 16+ / macOS 13+)
- Check Swift version (requires Swift 5.9+)
- Identify project structure (find .xcodeproj or Package.swift)
- Identify source file locations
2. Existing Extension Detection
Search for existing extension targets:
Glob: **/*Extension*/*.swift, **/*Extension*/Info.plist
Grep: "NSExtensionPointIdentifier" or "NSExtensionPrincipalClass"If existing extensions found:
- Ask if user wants to add another or modify existing
- Identify existing App Groups configuration
3. App Groups Detection
Check for existing App Groups setup:
Glob: **/*.entitlements
Grep: "com.apple.security.application-groups"If App Groups exist, reuse the existing group identifier.
Configuration Questions
Ask user via AskUserQuestion:
- What type of extension?
- Share Extension (accept content from other apps, display share UI)
- Action Extension (manipulate content in-place -- transform text, edit images)
- Keyboard Extension (custom input keyboard with KeyboardViewController)
- Safari Web Extension (inject JavaScript/CSS into web pages)
- What content types does it handle?
- Text (plain text, rich text)
- URLs (web links, deep links)
- Images (photos, screenshots)
- Files (documents, PDFs, archives)
- All (any content type)
- Does the extension need to share data with the main app?
- Yes -- needs App Groups (shared UserDefaults, shared file container, shared Keychain)
- No -- extension is self-contained
Generation Process
Step 1: Read Templates
Read templates.md for production Swift code.
Step 2: Create Extension Files
Based on extension type selected:
Share Extension:
ShareViewController.swift-- Main share extension view controller with content handlingInfo.plist-- Extension configuration with activation rules
Action Extension:
3. ActionViewController.swift -- Action extension with content manipulation
4. Info.plist -- Extension configuration
Keyboard Extension:
5. KeyboardViewController.swift -- Custom keyboard with UIInputViewController
6. Info.plist -- Keyboard extension configuration
Safari Web Extension:
7. SafariWebExtensionHandler.swift -- Native message handler
8. manifest.json -- Web extension manifest
9. content.js -- Content script template
Step 3: Create Shared Infrastructure
If data sharing selected:
10. SharedDataManager.swift -- App Group data sharing helper
Step 4: Determine File Location
Extensions are separate targets:
- Share Extension ->
ShareExtension/ - Action Extension ->
ActionExtension/ - Keyboard Extension ->
KeyboardExtension/ - Safari Web Extension ->
SafariWebExtension/ - Shared code ->
Shared/or within main app target
Output Format
After generation, provide:
Files Created
Share Extension:
ShareExtension/
├── ShareViewController.swift # Main share extension view controller
└── Info.plist # Extension activation rules & configAction Extension:
ActionExtension/
├── ActionViewController.swift # Content manipulation controller
└── Info.plist # Extension activation rules & configKeyboard Extension:
KeyboardExtension/
├── KeyboardViewController.swift # UIInputViewController subclass
└── Info.plist # Keyboard extension configSafari Web Extension:
SafariWebExtension/
├── SafariWebExtensionHandler.swift # Native message handler
└── Resources/
├── manifest.json # Web extension manifest
├── content.js # Content script
└── popup.html # Popup UI (optional)Shared (if data sharing enabled):
Shared/
└── SharedDataManager.swift # App Group data sharingIntegration Steps
1. Add Extension Target in Xcode:
- File > New > Target
- Select the extension type (Share, Action, Keyboard, Safari Web)
- Configure bundle identifier:
com.yourapp.ShareExtension - Xcode creates the target with boilerplate -- replace with generated code
2. Configure App Groups (if data sharing):
- Select main app target > Signing & Capabilities > Add "App Groups"
- Add group:
group.com.yourapp.shared - Select extension target > Signing & Capabilities > Add "App Groups"
- Add the same group identifier
3. Share code between targets:
- Add shared files to both the app and extension targets
- Or create a shared framework target
Extension Content Handling
Accept shared URLs:
if provider.hasItemConformingToTypeIdentifier(UTType.url.identifier) {
provider.loadItem(forTypeIdentifier: UTType.url.identifier) { item, error in
guard let url = item as? URL else { return }
// Process URL
}
}Accept shared images:
if provider.hasItemConformingToTypeIdentifier(UTType.image.identifier) {
provider.loadItem(forTypeIdentifier: UTType.image.identifier) { item, error in
if let imageURL = item as? URL {
let imageData = try? Data(contentsOf: imageURL)
// Process image data
}
}
}Share data to main app via App Groups:
let shared = SharedDataManager.shared
shared.saveSharedContent(url.absoluteString, forKey: "lastSharedURL")Testing
Share Extension:
- Build and run the extension scheme
- Select a host app (Safari, Photos, etc.)
- Share content and verify your extension appears
- Test with different content types
Action Extension:
- Build and run the extension scheme
- Open content in a supported app
- Tap the share/action button and select your action
Keyboard Extension:
- Build and run the keyboard extension scheme
- Go to Settings > General > Keyboard > Keyboards > Add New Keyboard
- Select your keyboard
- Open any text field and switch to your keyboard
Safari Web Extension:
- Build and run the app (which contains the extension)
- Go to Safari > Settings > Extensions
- Enable your extension
- Navigate to a web page and verify behavior
Extension Lifecycle and Limits
Memory Limits
- Share Extension: ~120 MB
- Action Extension: ~120 MB
- Keyboard Extension: ~48 MB (very constrained)
- Safari Web Extension: ~6 MB for content scripts
Execution Limits
- Extensions must complete work quickly (no long background execution)
- Must call
completeRequest()orcancelRequest()when done - No access to HealthKit, CallKit, or some restricted frameworks
- Network requests are allowed but should be brief
Extension Termination
The system can terminate extensions at any time for resource reclamation. Save state frequently and handle interruption gracefully.
Gotchas
completeRequest Must Be Called
The extension host waits for extensionContext?.completeRequest(returningItems:). If you never call it, the share sheet hangs and the user is stuck. Always call it in both success and error paths.
Keyboard Extensions Need Open Access for Network
By default keyboard extensions have no network access. The user must explicitly grant "Allow Full Access" in Settings. Without it, URLSession calls fail silently. Design your keyboard to work without network and enhance when access is granted.
App Groups Require Matching Identifiers
The App Group identifier must be identical in both the main app and extension entitlements. A typo means UserDefaults(suiteName:) returns a different (empty) container.
Safari Web Extension Content Scripts Run in Isolated World
Content scripts cannot directly access the page's JavaScript variables. Use window.postMessage or the browser messaging API to communicate between content scripts and the page.
Extension Bundle Identifier Convention
Extension bundle identifiers must be prefixed with the main app bundle identifier:
- Main app:
com.yourcompany.myapp - Share Extension:
com.yourcompany.myapp.ShareExtension
References
- templates.md -- All production Swift templates for each extension type
- App Extension Programming Guide
- Creating a Share Extension
- Custom Keyboard Guide
- Safari Web Extensions
- Related:
generators/deep-linking-- Handle URLs received via extensions - Related:
generators/push-notifications-- Notification extensions (Service/Content)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

