Community编程与开发github.com

Apify集成开发技能

为公司的产品设计和构建官方Apify集成,包括工作流自动化应用、AI代理插件、AI框架包或直接应用客户端。在规划、创建或审查集成时使用,该集成将Apify Actors、运行、数据集或键值存储暴露到其他产品中。

Apify集成开发技能 是什么?

此技能指导开发人员从头开始设计并发布面向产品的Apify官方集成。它全面覆盖了Apify支持的每一种集成形态——从工作流自动化平台(如Zapier、n8n),到AI代理插件(面向Cursor、Claude Code等编码代理的轻量级技能+MCP包,以及面向OpenClaw/Hermes等运行时的自定义工具注册表插件),再到AI框架包(如LangChain、LlamaIndex)和直接应用客户端(如后端服务或计划任务)。核心设计规则对所有形态通用,如异步运行轮询、成本控制、归因头、认证方式、错误处理和Webhook使用。开发者只需选择一个集成形态,并阅读对应的参考文件即可获得详细信息。技能还包含一个MCP工具集,用于在规划阶段快速查询Actor详情和文档。

兼容平台✓Claude Code✓Codex CLI✓Cursor
npx skills add https://github.com/nehakanjamala/personal_website/tree/HEAD/.agents/skills/apify-integration-development

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Apify集成开发

为公司产品设计和构建官方Apify集成,仅需Apify的少量协助。此技能覆盖了Apify支持的所有集成形态——工作流自动化应用、AI代理插件(编码代理和运行时)、AI框架包以及直接应用客户端——帮助合作团队从头到尾交付一流的Apify集成。以下跨领域规则适用于所有形态,每个分类有独立的参考文件提供其余细节。

正在构建官方集成? 发布后,请通过 [email protected] 联系Apify团队,他们将审查、测试并验证您的集成,确保其在上线前达到标准。Apify团队会检查能力覆盖、成本控制、错误处理和归因头,并协助您解决任何问题。

第0步 - 先学习Apify模型(必需)

在设计任何内容之前,请获取并阅读 https://apify.com/agents.md。它是面向AI代理的权威快速入门指南,也是词汇、运行流程和成本规则的唯一真实来源。如果获取失败,以下迷你词汇表足以让此技能正常使用。

Apify词汇表(平台上始终以大写字母A开头书写):

  • Actor - 一个无服务器云程序,接收JSON输入,执行任务并产生结构化输出。不是AI代理。
  • Actor Run - Actor的一次执行。每次运行都有其自己的数据集、键值存储和请求队列,并以最终状态(SUCCEEDED、FAILED、TIMED-OUT、ABORTED)结束。
  • Dataset - 用于存储运行结果的追加式结构化存储。Actor调用返回数据集ID,而非其内容。
  • Key-Value Store - 非结构化/文件存储(截图、HTML、OUTPUT)。
  • Actor Task - 用于运行Actor的已保存参数化配置。
  • Apify Store - 位于 https://apify.com/store.md 的 actor 市场。
  • Apify Console - 位于 https://console.apify.com 的 Web 界面。
  • Compute Unit (CU) - 计费单位:内存 (MB) x 时长 (小时)。
  • Server Actor - 一种始终就绪的 HTTP 服务器类 Actor,拥有自己的稳定 URL(在API和文档中可能仍称为 Standby)。您发送请求并立即在响应中获得结果 - 无需启动运行,也无需读取数据集。

更多术语(build、request queue、proxy、定价模型):请查看 https://docs.apify.com/llms.txt。

规划时使用 Apify MCP 获取实时上下文

Apify MCP 服务器是在集成设计期间研究 Actor、schema、定价和文档的最快方式。请参阅 https://docs.apify.com/integrations/mcp(附加 .md 以获取 Markdown 版本)。

如果此环境中已提供 Apify MCP 工具,请使用以下功能:

  • search-actors - 按平台/产品关键词搜索 Actor(按产品名称搜索,而非最终目标)。
  • fetch-actor-details - 在将 Actor 的形状编码到集成中之前,读取其输入 schema、输出格式、README 和定价。
  • search-apify-docs / fetch-apify-docs - 获取相关上下文文档页面。

匿名发现子集(search-actors、fetch-actor-details、search-apify-docs、fetch-apify-docs)无需账户即可工作,因此您甚至可以在开发者连接令牌之前进行研究。

选择您的集成形态

根据您要集成的产品,只读取一个参考文件。每个参考文件包含特定分类的 UX 设计、规范的能力矩阵以及完成定义检查清单。

产品形态示例阅读文件
工作流自动化平台Zapier, n8n, Make, Pipedream, Activepiecesreferences/workflow-automation.md
AI 代理插件(编码代理或运行时)Cursor, Claude Code, Codex, GitHub Copilot(编码代理);OpenClaw 风格运行时,Hermes 风格运行时(运行时)references/ai-harness-plugin.md
AI 框架包(面向 LLM 框架的 PyPI/npm 包)LangChain, LlamaIndex, Haystack, Vercel AI SDKreferences/ai-framework-package.md
应用集成(直接客户端)通过 apify-client 或 REST 调用 Actor 的后端服务、计划任务、产品功能references/sdk-integration.md

路径相对于此技能文件夹。如果您的产品跨越两种形态(例如,基于框架包构建的 AI 运行时),请同时阅读两者——规则是可组合的。AI 代理插件参考涵盖了两种具有不同权衡的方法:针对感知技能/MCP 的编码代理的轻量级技能 + MCP 包,以及针对 OpenClaw/Hermes 风格运行时的自定义工具注册表插件。

跨领域设计规则(适用于所有集成类型)

这些不变式是从所有现有 Apify 集成中提取的。无论形态如何,都应应用它们。

词汇镜像

在集成中,将资源建模为 Apify 领域的对应物(Actor / Run / Dataset / KV Store / Task)。来自 Apify Console 的用户应该能在相同的名称下找到相同的概念。

带有限制轮询的异步运行流程

Actor 可以运行几秒到几小时。请使用异步流程,切勿对短任务以外的任何任务使用 300 秒同步端点:

POST /v2/actors/{actorId}/runs            -> 启动,返回 runId
GET  /v2/actor-runs/{runId}               -> 轮询直到最终状态
GET  /v2/datasets/{datasetId}/items       -> 在 SUCCEEDED 时获取结果

轮询必须是有限制的:使用运行自身的 timeoutSecs 加上一个宽限缓冲区,并附带一个绝对上限作为后备。永远不要使用 while (true)。对于非最终状态,返回 run ID,以便用户/代理可以再次轮询或检查失败原因。

成本是头等要素

每个启动运行的路径都必须暴露成本控制。标准的控制是 maxTotalChargeUsd(在大多数定价模型上限制运行的总费用)和 maxItems(在按结果付费的 Actor 上限制计费项数)。将它们作为选项 / 查询参数发送,切勿作为 Actor 输入——在输入内部,它们要么是 Actor 声明的字段,要么是无效的。0 / 空 / null 表示无限制。对于面向 LLM 的集成,上限是开发者控制的;LLM 不能放宽它们。像下面的 Web Fetch 这样的 Server Actor 请求不会启动运行,也不接受这些选项。

归因头

在每个出站请求上添加一个集成头,以便 Apify 可以归因流量:x-apify-integration-platform: <your-platform>。当请求由 AI 工具驱动(而非 UI 中的人类)时,还需发送 x-apify-integration-ai-tool: true。如果此集成是使用此技能构建的,请添加 x-apify-integration-origin: apify-integration-development-skill,以便 Apify 可以区分技能生成的集成和自定义集成。一行代码,带来巨大的遥测回报。

认证

  • 浏览器 / 面向消费者(人类完成登录):使用 PKCE 的 OAuth2。不要索要原始令牌。
  • 无头 / 服务器 / CI(无人类在场):API 令牌作为 Authorization: Bearer <APIFY_TOKEN>,存储在环境变量或秘密管理器中,切勿硬编码或记录。

两种方式都是真实的——根据认证时的在场者选择,而非根据哪个更容易。

集中化的 HTTP 层

一个基础 URL 常量,在凭证和 HTTP 层之间共享。Server Actor 拥有自己的主机(https://web-fetch.apify.actor)——通过同一层路由它,以便仍然应用认证和归因头。在 429 和 5xx 错误时,使用指数退避进行重试。切勿在网络错误时重试非幂等的 POST /runs——重复的 Actor 运行是一个真实的、已计费、有副作用的操作。这是 HTTP 层中最重要的正确性不变式。

错误分类

将 Apify 错误映射到宿主平台的错误类别(可重试 vs 认证 vs 永久)。公开 API 的实际错误文本,而非通用的 HTTP 消息。对于权限审批失败(需要显式审批的全权限 Actor),在验证其为绝对 http(s) URL 后,包含审批 URL。对于 LLM 消费者,将错误作为数据(JSON 错误对象)返回,切勿作为引发的异常——模型需要读取和推理的内容。

运行完成事件的 Webhook 优先于轮询

当宿主支持入站 Webhook 时,注册一个作用域为 actorId 或 actorTaskId 的 Apify Webhook,并包含用户选择的最终状态。确保注册是幂等的(重新激活的工作流不应创建重复的 Webhook),持久化 Webhook ID 以便停用时可以清理它,并始终提供示例/后备数据,以便用户无需等待真实运行即可测试触发器。

在宿主允许的情况下,从 OpenAPI 生成

如果宿主平台可以从 OpenAPI 规范生成 UI 字段,请使用 Apify 的规范(https://apify.com/openapi.json)和标签允许列表。仅手写规范无法表达的内容:便利包装器、账单上限字段、精简的 AI 工具输出契约。

高级便利操作与通用运行并存

通用“运行 Actor”服务于高级用户。为常见情况添加几个有主见的、高级别的操作,以便非高级用户获得一个双字段表单,而不是完整的 Actor 配置。标准的操作是 Web Fetch:输入一个 URL,输出页面内容,基于 apify/web-fetch Server Actor——POST https://web-fetch.apify.actor/ 并以 {"url": "...", "formats": ["markdown"]} 作为请求体,在响应中返回内容。不会启动运行,因此上述运行规则(异步流程、轮询、maxTotalChargeUsd)不适用;成本是每个成功请求产生一次 fetch 事件。需要做对三件事:始终发送 formats,检查 fetch.httpStatusCode(HTTP 200 仅意味着 Web Fetch 本身成功),并处理两种错误形态——来自 Actor 的扁平 {code, error} 和来自平台的嵌套 {error: {message}}——而无需自动重试其中的 502/504。完整契约:https://apify.com/apify/web-fetch.md。不要将其构建在 maxCrawlDepth: 0 的爬虫运行上——那是传统的“抓取单个 URL”模式。

测试和发布

保留两种测试模式:模拟(封闭,无需凭证)和实时端到端(真实 API,CI 门控)。通过宿主平台的 CI 在 Git 标签 / GitHub 版本上自动化发布。如果发布工作流管理版本和变更日志,切勿手动编辑。

审查时应拒绝的顶级反模式

  1. 在网络错误时重试 POST /runs——会重复计费运行。
  2. 无限制的 while (true) 轮询——占用宿主资源且无上限。
  3. 将 maxTotalChargeUsd / maxItems 放入 Actor 输入而非选项——静默无效,不是限制。
  4. 将完整数据集转储到 LLM 上下文,而未设置大小限制或不受信任的内容隔离——提示注入和上下文爆炸。
  5. 为 LLM 代理提供一个单一的整体工具列表——超过约 8 个工具后路由精度下降;请策划子集。
  6. 返回原始 HTTP 状态/消息而非 Apify 的实际错误文本——用户无法对“400”采取行动。

每个集成所需的最小 API 面

目的方法 + 路径
启动 Actor 运行POST /v2/actors/{actorId}/runs
启动 Task 运行POST /v2/actor-tasks/{taskId}/runs
轮询运行GET /v2/actor-runs/{runId}
列出运行GET /v2/actor-runs
数据集项GET /v2/datasets/{datasetId}/items
KV 记录GET /v2/key-value-stores/{storeId}/records/{key}
设置 KV 记录PUT /v2/key-value-stores/{storeId}/records/{key}
Store 搜索GET /v2/store
Webhook CRUDPOST/GET/DELETE /v2/webhooks
验证令牌 / 当前用户GET /v2/users/me
获取一个 URL(Web Fetch,Server Actor)POST https://web-fetch.apify.actor/

REST 参考:https://docs.apify.com/api/v2。OpenAPI 规范:https://apify.com/openapi.json。

工作流程

  1. 获取 https://apify.com/agents.md 并内化模型。
  2. 选择上面的集成形态并阅读相应的参考文件。
  3. 使用 Apify MCP(如果可用)研究集成将暴露的具体 Actor、schema 和定价。
  4. 起草所选分类的能力矩阵(每个参考文件中有一个)和 UX 规范(资源 -> 操作 -> 字段 -> 错误)。
  5. 按照参考文件中的分类特定规则搭建集成。
  6. 根据该参考文件末尾的完成定义检查清单进行验证。

可供研究的参考实现

每个分类的真实公共集成 - 如有疑问,请阅读其源代码:

  • 工作流自动化:@apify/n8n-nodes-apify(npm),Apify Zapier 应用。
  • AI 代理插件(编码代理):为 Cursor、Claude Code、Copilot 等工具发布的 Apify 插件包(MCP 服务器 + 技能 + 路由器 + 斜杠命令)。
  • AI 代理插件(运行时):apify-hermes-agent-plugin(PyPI),@apify/apify-openclaw-plugin。
  • AI 框架包:langchain-apify(PyPI)。
  • 应用集成:请参阅 references/sdk-integration.md 了解 JS/TS、Python 和 REST 中的标准 apify-client 用法。

集成问题支持:[email protected]。在您构建时联系我们寻求设计指导,发布后联系我们进行审查/测试——我们在集成上线前验证能力覆盖、成本控制、错误处理和归因头。

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

nehakanjamala/personal_website

This skill should be used when the user asks to "fix janky CSS animation", "make animation 60fps", "stop layout thrashing", "animate width/height/top/left smoothly", "convert animation to transform", "animate box-shadow performantly", "animate height auto", "FLIP animation", or "why is my scroll/hover animation choppy".

nehakanjamala/personal_website

This skill should be used when the user asks to "respect prefers-reduced-motion", "honor reduced motion", "make my animations accessible", "fix vestibular / motion-sickness issues", "add a useReducedMotion hook", "gate GSAP / Framer Motion / Lenis for reduced motion", or "meet WCAG 2.3.3 / C39". Provides tiered (not all-or-nothing) reduced-motion patterns in CSS and JS.

nehakanjamala/personal_website

Create, modify, debug, and deploy Apify Actors, and write their input and output schemas. Use when building an Actor from scratch, changing or troubleshooting Actor code, generating or updating .actor schema files, or pushing an Actor to the Apify platform. To wrap an existing non-Actor project, use apify-actorization instead.

nehakanjamala/personal_website

Convert existing projects into Apify Actors - serverless cloud programs. Actorize JavaScript/TypeScript (SDK with Actor.init/exit), Python (async context manager), or any language (CLI wrapper). Use when migrating code to Apify, wrapping CLI tools as Actors, or adding Actor SDK to existing projects.

nehakanjamala/personal_website

Deprecated. Output schema generation moved to the apify-actor-development skill; prefer that skill whenever it is available.

nehakanjamala/personal_website

Universal AI-powered web scraper for any platform. Scrape data from Instagram, Facebook, TikTok, YouTube, LinkedIn, X/Twitter, Google Maps, Google Search, Google Trends, Reddit, Airbnb, Yelp, and 15+ more platforms. Use for lead generation, brand monitoring, competitor analysis, influencer discovery, trend research, content analytics, audience analysis, review analysis, SEO intelligence, recruitment, or any data extraction task.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a glassmorphism effect", "frosted glass UI", "Apple liquid glass style", "frosted blur card", "translucent glass panel animation", "make a frosted nav bar", "build a glass modal/dialog", "animate a glass card on hover", or "add a refracting liquid-glass hero". Covers frosted translucent panels with backdrop-filter blur, edge/specular highlights, SVG liquid-glass refraction, motion on hover/scroll/enter, and accessible reduced-transparency fallbacks.

nehakanjamala/personal_website

This skill should be used when the user asks to "build a scroll animation", "add ScrollTrigger", "pin a section while scrolling", "scrub an animation to scroll", "create a hero timeline", "do a horizontal scroll section", "split text and animate words", "animate a layout change with GSAP Flip", "sync ScrollTrigger with Lenis", "Lenis smooth scroll jittery", "ScrollTrigger markers drift", "ScrollTrigger pins break with Lenis/Locomotive", or "set up smooth scroll with GSAP pinning". Covers GSAP timelines, ScrollTrigger, SplitText, Flip, and Lenis/Locomotive smooth-scroll sync for code-driven web motion.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a Lottie animation", "play a .lottie or .json animation", "integrate a Bodymovin/After Effects animation on web or mobile", "control Lottie playback / segments", "make a scroll-driven Lottie", "recolor a Lottie at runtime", or "export an AE animation to Lottie". Covers dotLottie/lottie-web integration, playback control, interactivity, theming, and the AE export checklist.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a hover/press effect", "animate a toggle or switch", "build an animated like button", "make a toast/snackbar slide in", "animate a drawer or modal", "animate list reordering or add/remove", "do a shared-element layout transition", or "polish UI feedback". Covers UI motion with Framer Motion (motion/react) and modern CSS.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate page or route transitions", "add a page transition or crossfade between views", "animate route changes in Next.js App Router", "use the View Transitions API", "AnimatePresence exit doesn't fire on navigation", or "Framer Motion exit animation not working / exit animation before unmount in Next.js". Covers enter/exit page-transition animation with the View Transitions API and Framer Motion, for Next.js App Router and general SPA routing.

nehakanjamala/personal_website

Scrape web pages using Scrapling with anti-bot bypass (like Cloudflare Turnstile), stealth headless browsing, spiders framework, adaptive scraping, and JavaScript rendering. Use when asked to scrape, crawl, or extract data from websites; web_fetch fails; the site has anti-bot protections; write Python code to scrape/crawl; or write spiders.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate an SVG", "make a line draw itself on", "do a stroke draw-on / signature animation", "morph one shape into another", "move an element along a path", "animate an icon/logo", or "animate an SVG gradient or filter". Covers stroke-dashoffset draw-on, path morphing, motion-along-path, and animated icons/gradients/filters via CSS, SMIL, and GSAP.

相关技能