做什么
使用浏览器Engine构建替代浏览器引擎 阿标
技能库 智客分类:Agent 工作流 browserenginekit
使用浏览器EngineKit构建替代浏览器引擎. 在支持区域开发iOS/iPadOS的非WebKit浏览器引擎时使用,管理网页内容/上线/联网扩展进程,配置GPU和联网进程能力,检查替代引擎设备的资格,或审查浏览器EngineKit的应享权利和Info.plist设置.
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
使用浏览器Engine构建替代浏览器引擎 阿标
开发支持区域iOS/iPadOS的非WebKit浏览器引擎,管理网络内容/上线/联网扩展进程,配置GPU和联网进程能力,检查替代引擎设备的资格,或审查浏览器EngineKit授权人
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:BrowserEngineKit、Contents、Overview and Eligibility、Eligibility Checking、Entitlements、Browser App (Host)。
文件分析:除 SKILL.md 外,正文引用了 references/browserenginekit-patterns.md,属于带资源的技能包,这些文件按需再读。
Build alternative browser engines using BrowserEngineKit. Use when developing a non-WebKit browser engine for iOS/iPadOS in supported regions, managing web content/rendering/networking extension processes, configuring GPU and networking process capabilities, checking alternative-engine device eligibility, or reviewing BrowserEngineKit entitlements and Info.plist setup.
BrowserEngineKitContentsOverview and EligibilityEligibility CheckingEntitlementsBrowser App (Host)Extension EntitlementsOptional EntitlementsEmbedded Browser Engine (Non-Browser Apps)Japan-Specific RequirementsArchitectureBootstrap Sequence
来源分类:skills.sh agent-skill
namebrowserenginekitdescriptionreferences/browserenginekit-patterns.md以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。
具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「browserenginekit」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-7609afc810319313-%E6%B5%8F%E8%A7%88-renginekit.html 请存为 .cursor/skills/browserenginekit/SKILL.md 或 .claude/skills/browserenginekit/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。 该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/dpearson2699/swift-ios-skills 取完整目录,不要只建一个 SKILL.md。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/dpearson2699/swift-ios-skills' --list
npx skills add 'https://github.com/dpearson2699/swift-ios-skills' --skill 'browserenginekit'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
Framework for building web browsers with alternative (non-WebKit) rendering engines on iOS and iPadOS. Provides process isolation, XPC communication, capability management, and system integration for browser apps that implement their own HTML/CSS/JavaScript engine. Examples target Swift 6.3 and current Apple SDKs.
BrowserEngineKit is a specialized framework. Alternative browser engines are available only through Apple-approved entitlement profiles and supported-region device eligibility. EU support applies to eligible users on iOS 17.4+ and iPadOS 18+; Japan support starts with iOS 26.2 and adds explicit PAC/MIE security requirements for browser apps. Development and testing can occur anywhere. The companion frameworks BrowserEngineCore (low-level primitives) and BrowserKit (eligibility checks, data transfer) support the overall workflow.
Use BEAvailability from the BrowserKit framework to check whether the device
is eligible for alternative browser engines. BEAvailability is available on
iOS/iPadOS 18.4+:
import BrowserKit
do {
let eligible = try await BEAvailability.isEligible(for: .webBrowser)
guard eligible else { return /* fall back or explain */ }
// Device supports alternative browser engines
} catch {
// Handle eligibility lookup failure
}
Eligibility depends on the device region and OS version. Do not hard-code region checks; rely on the system API.
Availability anchors: process APIs are iOS/iPadOS 17.4+, BEDownloadMonitor
is iOS 18.2+, .revision2 restricted sandbox is iOS 26+, and
RenderingExtensionFeature.coreML is iOS 26.2+.
The host app requires two entitlements:
| Entitlement | Purpose |
|---|---|
| com.apple.developer.web-browser | Enables default-browser candidacy |
| com.apple.developer.web-browser-engine.host | Enables alternative engine extensions |
Both must be requested from Apple. The request process varies by region.
Each extension target requires its type-specific entitlement set to true:
| Extension Type | Entitlement |
|---|---|
| Web content | com.apple.developer.web-browser-engine.webcontent |
| Networking | com.apple.developer.web-browser-engine.networking |
| Rendering | com.apple.developer.web-browser-engine.rendering |
| Entitlement | Extension | Purpose |
|---|---|---|
| com.apple.security.cs.allow-jit | Web content | JIT compilation of scripts |
| com.apple.developer.kernel.extended-virtual-addressing | Web content | Required alongside JIT |
| com.apple.developer.memory.transfer_send | Rendering | Send memory attribution; value is host app bundle ID |
| com.apple.developer.memory.transfer_accept | Web content | Accept memory attribution; value is host app bundle ID |
| com.apple.developer.web-browser-engine.restrict.notifyd | Web content | Restrict notification daemon access |
Apps that are not browsers but embed an alternative engine for in-app browsing use different entitlements:
| Entitlement | Purpose |
|---|---|
| com.apple.developer.embedded-web-browser-engine | Enable embedded engine |
| com.apple.developer.embedded-web-browser-engine.engine-association | Declare engine ownership |
engine-association is available starting iOS/iPadOS/Mac Catalyst 26.2 and is
set to first-party when you own the engine or third-party when another
developer owns it. Embedded engines use arm64 only (not arm64e), cannot
include browser extensions, and cannot use JIT compilation.
Browser apps distributed in Japan are supported on iOS 26.2+ and must adopt the
current security mitigations Apple lists for Japan, including Pointer
Authentication Codes and Memory Integrity Enforcement for relevant allocators
and extension processes. Enable hardware memory tagging with
com.apple.security.hardened-process.checked-allocations; Apple strongly
recommends enabling it in the EU as well.
A browser built with BrowserEngineKit consists of four components running in separate processes:
Host App (UI, coordination)
|
|-- XPC --> Web Content Extension (HTML parsing, JS, DOM)
|-- XPC --> Networking Extension (URLSession, sockets)
|-- XPC --> Rendering Extension (Metal, GPU, media)
The host app launches and manages all extensions. Extensions cannot launch other extensions. Extensions communicate with each other through anonymous XPC endpoints brokered by the host app.
This architecture follows the principle of least privilege: the web content extension works with untrusted data but has no direct OS resource access.
Each extension type has a corresponding process class in the host app:
import BrowserEngineKit
// Web content (one per tab or iframe)
let contentProcess = try await WebContentProcess(
bundleIdentifier: nil,
onInterruption: {
// Handle crash or OS interruption
}
)
// Networking (typically one instance)
let networkProcess = try await NetworkingProcess(
bundleIdentifier: nil,
onInterruption: {
// Handle interruption
}
)
// Rendering / GPU (typically one instance)
let renderingProcess = try await RenderingProcess(
bundleIdentifier: nil,
onInterruption: {
// Handle interruption
}
)
Pass nil for bundleIdentifier to use the default extension target. The
interruption handler fires if the extension crashes or is terminated by the OS.
let connection = try contentProcess.makeLibXPCConnection()
// Use connection for inter-process messaging
Each process type provides makeLibXPCConnection() to create an
xpc_connection_t for communication.
contentProcess.invalidate()
After calling invalidate(), no further method calls on the process object
are valid.
Hosts the browser engine's HTML parser, CSS engine, JavaScript interpreter,
and DOM. Conform to WebContentExtension to handle incoming XPC connections:
import BrowserEngineKit
@main
struct MyWebContentExtension: WebContentExtension {
func handle(xpcConnection: xpc_connection_t) {
// Set up message handlers on the connection
}
}
Configure via WebContentExtensionConfiguration in the extension's
EXAppExtensionAttributes.
Handles all network requests using URLSession or socket APIs. One instance
serves all tabs:
import BrowserEngineKit
@main
struct MyNetworkingExtension: NetworkingExtension {
func handle(xpcConnection: xpc_connection_t) {
// Handle network request messages
}
}
Configure via NetworkingExtensionConfiguration.
Accesses the GPU via Metal for video decoding, compositing, and complex rendering. One instance typically serves the entire browser:
import BrowserEngineKit
@main
struct MyRenderingExtension: RenderingExtension {
init() {
if #available(iOS 26.2, macOS 26.2, *) {
enableFeature(.coreML)
}
}
func handle(xpcConnection: xpc_connection_t) {
// Handle rendering commands
}
}
Configure via RenderingExtensionConfiguration.
Grant capabilities to extensions so the OS schedules them appropriately:
// Grant foreground priority to an extension
let grant = try contentProcess.grantCapability(.foreground)
// ... extension does foreground work ...
// Relinquish when done
grant.invalidate()
| Capability | Use Case |
|---|---|
| .foreground | Active tab rendering, visible content |
| .background | Background tasks, prefetching |
| .suspended | Minimal activity, pending cleanup |
| .mediaPlaybackAndCapture(environment:) | Audio/video playback, camera/mic capture |
For media capabilities, create a MediaEnvironment tied to a page URL.
The environment supports AVCaptureSession for camera/mic access and is
XPC-serializable for cross-process transport:
let mediaEnv = MediaEnvironment(webPage: pageURL)
let grant = try contentProcess.grantCapability(
.mediaPlaybackAndCapture(environment: mediaEnv)
)
try mediaEnv.activate()
let captureSession = try mediaEnv.makeCaptureSession()
Attach a visibility propagation interaction to browser views so extensions
know when content is on screen. Both WebContentProcess and
RenderingProcess provide createVisibilityPropagationInteraction().
The rendering extension draws into a LayerHierarchy, whose content the
host app displays via LayerHierarchyHostingView. Handles are passed over
XPC. Use LayerHierarchyHostingTransactionCoordinator to synchronize layer
updates atomically across processes.
See references/browserenginekit-patterns.md for detailed layer hosting examples and transaction coordination.
Adopt BETextInput on custom text views to integrate with UIKit's text
system. This enables standard text selection, autocorrect, dictation, and
keyboard interactions.
Key integration points:
asyncInputDelegate for communicating text changes to the systemhandleKeyEntry(_:completionHandler:) for keyboard eventsBETextInteraction for selection gestures, edit menus, and context menusBEScrollView and BEScrollViewDelegate for custom scroll handlingSee references/browserenginekit-patterns.md for detailed text interaction implementation.
After initialization, lock down content extensions using the restricted sandbox:
// In the web content extension, after setup:
if #available(iOS 26.0, macOS 26.0, *) {
applyRestrictedSandbox(revision: .revision2)
} else {
applyRestrictedSandbox(revision: .revision1)
}
This removes access to resources the extension used during startup but no longer needs. Use the latest available revision for the strongest restrictions.
Web content extensions that JIT-compile JavaScript must transition pages with BrowserEngineKit's witnessed APIs:
import BrowserEngineCore
be_memory_inline_jit_restrict_rwx_to_rw_with_witness(...)
// write generated code
be_memory_inline_jit_restrict_rwx_to_rx_with_witness(...)
Requires the com.apple.security.cs.allow-jit and
com.apple.developer.kernel.extended-virtual-addressing entitlements on
the web content extension only. If an implementation instead uses pthread_jit_write_with_callback_np, it also needs the JIT write allowlist entitlement; do not present BE_JIT_WRITE_PROTECT_TAG alone as a complete protection strategy.
Distribution builds must satisfy the current alternative-browser entitlement profile's device architecture, PAC, and MIE requirements. Keep the host and extension configuration consistent, include the required device slices, and test the signed archive on eligible devices. Embedded engines differ: they are arm64-only and cannot use JIT. Do not force arm64e onto Simulator builds or copy a one-line ARCHS override that drops required slices.
Report download progress to the system using BEDownloadMonitor. Create an
access token, initialize the monitor with source/destination URLs and a
Progress object, then call beginMonitoring() to show the system download
UI. Use resumeMonitoring(placeholderURL:) to resume interrupted downloads.
BEDownloadMonitor is available on iOS 18.2+.
See references/browserenginekit-patterns.md for full download management examples.
// WRONG - content extension has no path to other extensions
let contentProcess = try await WebContentProcess(
bundleIdentifier: nil, onInterruption: {}
)
// Immediately start sending work without connecting to networking/rendering
// CORRECT - broker connections through the host app
let networkEndpoint = try await networkProxy.getEndpoint()
let renderEndpoint = try await renderProxy.getEndpoint()
try await contentProxy.bootstrap(
renderingExtension: renderEndpoint,
networkExtension: networkEndpoint
)
// WRONG - extensions cannot launch other extensions
// (inside a WebContentExtension)
let network = try await NetworkingProcess(...)
// CORRECT - only the host app launches extensions
// Host app creates all processes, then brokers connections
// WRONG
contentProcess.invalidate()
let conn = try contentProcess.makeLibXPCConnection() // Error
// CORRECT - create a new process if needed
let newProcess = try await WebContentProcess(
bundleIdentifier: nil, onInterruption: {}
)
JIT compilation entitlements (com.apple.security.cs.allow-jit) are valid
only on web content extensions. Adding them to the host app, rendering
extension, or networking extension causes App Store rejection.
// WRONG
if Locale.current.region?.identifier == "DE" {
useAlternativeEngine()
}
// CORRECT - use the system eligibility API
let eligible = try await BEAvailability.isEligible(for: .webBrowser)
if eligible {
useAlternativeEngine()
}
Without web-browser-engine in UIRequiredDeviceCapabilities, users on
unsupported devices can download the app and hit runtime failures.
com.apple.developer.web-browser-engine.host entitlement on host appUIRequiredDeviceCapabilities includes web-browser-enginearm64e instruction set configured for all iOS device targetsarm64e is not set for Simulator targetsiOSPackagesShouldBuildARM64e workspace settingBEAvailability used for eligibility checks instead of manual region logicBEDownloadMonitor for active downloads on iOS 18.2+Agent 工作流
创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.
Agent 工作流
使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.
Agent 工作流
管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.
Agent 工作流
Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…