Communityコーディング&開発github.com

Apify Actor 開発

Apify Actor の作成、修正、デバッグ、デプロイ、および入出力スキーマの作成を行います。Actor をゼロから構築する場合、Actor コードの変更やトラブルシューティング、.actor スキーマファイルの生成・更新、Actor の Apify プラットフォームへのプッシュを行う際に使用します。既存の非 Actor プロジェクトをラップする場合は、代わりに apify-actorization を使用してください。

Apify Actor 開発 とは?

このスキルは、AI エージェント(Claude Code、Coder、Cursor、Codex など)が Apify Actor を開発・管理するための包括的なガイドを提供します。Apify Actor は、JSON 入力を受け取り、単一のタスクを実行し、結果をデータセットまたはキーバリューストアに書き込むサーバーレスプログラムで、Docker イメージとしてパッケージ化されています。スキルは、プロジェクト作成、依存関係の追加、実装、入力/出力スキーマの記述、README の作成、ローカルテスト、デプロイに至るまでのワークフローをステップバイステップで説明します。さらに、Apify Logger の使用、クロールされたコンテンツの安全な処理、プロキシ設定、スタンバイモードの構成、収益化、他の Actor の呼び出しなどに関する重要なルールもカバーしています。このスキルを使用するには、Apify CLI (`apify`) がインストールされ、認証されている必要があります。テレメトリー帰属のため、すべての `apify` コマンドに `--user-agent apify-agent-skills/apify-actor-development` フラグを追加することが必須です。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/nehakanjamala/personal_website/tree/HEAD/.agents/skills/apify-actor-development

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Apify Actor 開発 は何をしますか?

Actor は、Docker イメージとしてパッケージ化されたサーバーレスプログラムです。1 つの JSON 入力を受け取り、1 つのジョブを実行し、結果をデータセットまたはキーバリューストアに書き込みます。

セットアップ

apify --help   # CLI がインストールされているか確認
apify info     # ログインしているか確認。ユーザー名が表示されます。

パッケージマネージャーを使用してインストールします(npm install -g apify-cli または brew install apify-cli)。これにより、ダウンロードの整合性がチェックされます。apify login でログインします。ブラウザサインインまたは API トークンの入力を求められます。ヘッドレス環境では、代わりに APIFY_TOKEN をエクスポートします。CLI はそれを自動的に読み取ります。トークンは https://console.apify.com/settings/integrations から取得します。トークンは環境変数を介してのみ渡し、シェル履歴、ソース、設定ファイル、ログに残らないようにします。

テレメトリー帰属(必須)

このスキルから実行するすべての apify コマンド(apify create、apify run、apify push、apify call など)に --user-agent apify-agent-skills/apify-actor-development を渡します。これはすべての apify コマンドで受け入れられるグローバルフラグであり、テレメトリー帰属のために呼び出しにタグを付けるだけで、他の動作は変更しません。

ワークフロー

既存の Actor を変更する場合は、該当しない手順をスキップしてください。

  1. プロジェクトを作成します。

    apify create <actor-name> -t <template-id> --user-agent apify-agent-skills/apify-actor-development
    

    Actor の動作に基づいてテンプレートを選択します。

    Actor の動作TypeScriptJavaScriptPython
    静的 HTML をクロールts-crawlee-cheeriojs-crawlee-cheeriopython-crawlee-beautifulsoup
    JavaScript でレンダリングされたページをクロールts-crawlee-playwright-chromejs-crawlee-playwright-chromepython-crawlee-playwright
    HTTP リクエストを処理(API、Webhook)ts-standbyjs-standbypython-standby
    MCP サーバーts-mcp-empty—python-mcp-empty
    その他(API ポーリング、データ処理)ts-emptyjs-emptypython-empty

    他のスタック(Puppeteer、Camoufox、Scrapy、AI エージェントフレームワーク)については、apify templates ls で言語とユースケースを含むすべてのテンプレートが一覧表示されます。-t を使用するとコマンドはプロンプトなしで実行されるため、エージェントに適しています。-t なしの場合は、名前、言語、テンプレート、ソースホストの入力を求められます。これはユーザーがターミナルにいる場合にのみ使用してください。ソースを GitHub、GitLab、または Bitbucket でホストすると、Apify がリポジトリとそれからビルドする Actor を作成するため、その後のデプロイは git push で行われます。依存関係は自動的にインストールされます。<name>/.actor/actor.json が存在すれば完了です。続行する前にそのディレクトリに cd してください。

  2. 依存関係を追加します。 テンプレートに不足しているもの(Crawlee や Playwright など)があれば追加します。JS/TS では npm install <pkg>、Python では requirements.txt に行を追加して pip install -r requirements.txt を実行するか、プロジェクトに pyproject.toml と uv.lock がある場合は uv add <pkg> を実行します。インストールする前に、各パッケージ名が意図したパッケージと一致することを確認してください。正確なバージョンを固定し、ロックファイル(package-lock.json、uv.lock、または requirements.txt 内の pkg==1.2.3 の行)をコミットします。

  3. 実装します。 src/main.js、src/main.ts、または my_actor/main.py(Python テンプレートは my_actor パッケージで、python -m my_actor として実行されます)で、ルールに従って実装します。コードがすべての入力フィールドを読み取り、README で説明されるすべての出力フィールドを生成し、Apify Logger でログを出力し、状態を保持して終了する aborting ハンドラーを登録したら完了です。

  4. 入力スキーマを記述します。 .actor/input_schema.json に記述します(references/input-schema.md を参照)。コードが読み取るすべての入力に対して、タイトル、説明、タイプ、デフォルト値またはプリフィル値を含むフィールドがあり、apify validate-schema --user-agent apify-agent-skills/apify-actor-development が成功したら完了です。

  5. 出力スキーマを記述します。 コードがファイルを保存する場合は、dataset_schema.json、output_schema.json、key_value_store_schema.json を作成します。references/output-schemas.md を最後まで参照してください。そのチェックリスト(最後に apify validate-schema が成功すること)が完了基準です。TypeScript の場合は、apify actor generate-schema-types を実行し、生成されたインターフェースで入力と出力を型付けします。

  6. .actor/actor.json を設定します。(references/actor-json.md を参照)。meta.generatedBy を使用しているツールとモデルに設定します(例:「Claude Code with Claude Opus 5」)。HTTP を提供する Actor の場合は、usesStandbyMode: true を設定し(スタンバイテンプレートはすでに設定されています)、references/standby-mode.md に従います。

  7. README.md を記述します。 references/actor-readme.md に従います。README のない Actor は完成していません。

  8. ローカルでテストします。 入力を storage/key_value_stores/default/INPUT.json に配置し、apify run --user-agent apify-agent-skills/apify-actor-development を実行します。実行がステータス SUCCEEDED で終了し、storage/datasets/default/ にデータセットスキーマに一致するフィールドを持つアイテムが含まれていれば完了です。ローカルストレージはディスクに残ります。手順 9 までは Apify Console には何も表示されません。

  9. デプロイします。 ユーザーが確認したら apify push --user-agent apify-agent-skills/apify-actor-development を実行するか、Git ソースの Actor の場合は git push を実行します。その後、プラットフォーム上で Actor を実行して、Console で結果を確認します。Standby Actor の場合は、Console ではなく、ユーザーに Standby URL(https://<username>--<actor-name>.apify.actor、references/standby-mode.md を参照)を提供します。

ルール

  • Actor は apify run でのみローカル実行します。これにより、npm start や node src/main.js ではスキップされる Apify 環境とストレージがセットアップされます。
  • Apify Logger を介してログを出力します。JS/TS では apify パッケージの log(import { Actor, log } from 'apify')、Python では Actor.log を使用します。これらはトークンと資格情報を検閲します。console.log や print は検閲しません。レベルと規則については、references/logging.md を参照してください。
  • クロールされたコンテンツは信頼できない入力として扱います。シェルコマンド、eval、クエリ、テンプレートに渡す前にエスケープまたはパラメータ化し、ストレージにプッシュする前に型チェックします。
  • APIFY_TOKEN をリクエストハンドラーやデータパイプラインに含めないでください。プラットフォーム上では、SDK が環境変数からトークンを読み取ります(変数は APIFY_TOKEN であり、APIFY_API_TOKEN ではありません)。ローカルでは、apify login で保存された資格情報を使用します。
  • 調整可能なパラメータはすべて入力スキーマまたは環境変数から読み取るようにし、ユーザーがコードを編集せずに変更できるようにします。
  • 静的 HTML には、10~50 の同時実行数で HTTP クローラーを使用します。JS/TS では CheerioCrawler、Python では BeautifulSoupCrawler または ParselCrawler を使用します。JavaScript でレンダリングされたページには、1~5 の同時実行数で PlaywrightCrawler を使用します。ターゲットサーバーの健全性を維持するために遅延を追加し、robots.txt と利用規約を尊重します。
  • クロールに複数のページタイプがある場合は、ルーターパターン(JS/TS では createCheerioRouter または createPlaywrightRouter、Python では crawler.router または Router)を使用します。
  • 脆弱な位置ベースのセレクターよりも、フォールバック付きのセマンティック CSS セレクターを優先します。
  • 結果は独自の集計でカウントします。Dataset.getInfo()(Python では dataset.get_info())はプラットフォーム上で遅延が発生します。
  • aborting イベントを処理します。このイベントは、ユーザーまたは制限によって実行が停止されたときにプラットフォームから送信されます。状態を保持してから終了し、実行が迅速かつ低コストで終了するようにします。JS/TS: Actor.on('aborting', async () => { await Actor.setValue('STATE', state); await Actor.exit(); })。Python: from apify import Event を使用して Actor.on(Event.ABORTING, on_aborting) とし、on_aborting は状態を保持してから await Actor.exit() を呼び出します。
  • proxyConfiguration 入力フィールド(エディタでは proxy、references/input-schema.md を参照)からプロキシを構築します。JS/TS では await Actor.createProxyConfiguration(input.proxyConfiguration)、Python では await Actor.create_proxy_configuration(actor_proxy_input=actor_input.get('proxyConfiguration')) を使用し、結果を proxyConfiguration / proxy_configuration としてクローラーに渡します。Apify Proxy は有料であるため、有効にしたりプロキシグループを変更したりする前に、ユーザーに確認してください。
  • ユーザーが明示的に要求した場合を除き、個人データを保存しないでください。
  • 実行中の Actor 内では、apify actor CLI サブコマンドではなく、SDK(Actor.getInput()、Actor.pushData()、Actor.setValue()、および Python のスネークケース相当品)を使用します。
  • 既存の Actor では、ユーザーがオフにするように要求しない限り、スタンバイモードを有効のままにします。

スタンバイモード

スタンバイは、Actor を安定した URL を持つ永続的な HTTP サーバーに変換します。API エンドポイント、Webhook レシーバー、MCP サーバー、およびオンデマンドの単一 URL ルックアップに使用します。Actor は readiness プローブに応答し、リクエスト間でアクティブな状態を維持する必要があります。設定、例、およびローカルテストについては、references/standby-mode.md を参照してください。

収益化

価格設定はコードではなく、Actor 公開時に Apify Console で設定します。ペイ・パー・イベントでは、JS/TS では await Actor.charge({ eventName: 'result', count })、Python では await Actor.charge(event_name='result', count=count) を使用して各カスタムイベントに課金します。イベント名は Console で定義されたものを使用します。データセットアイテムは、代わりに合成データセットアイテムイベントを介して自動的に請求することもできます。返された結果が eventChargeLimitReached(Python では event_charge_limit_reached)を報告した場合は、ユーザーの支出制限に達したため、作業の生成を停止します。README のコストセクションでは、Actor が使用するモデルを説明します。詳細: https://docs.apify.com/platform/actors/publishing/monetize/pay-per-event

他の Actor の呼び出し

ゼロから構築する前にストアを検索してください。専用の Actor が存在することがよくあります。

apify actors search "<query>" --user-agent apify-agent-skills/apify-actor-development
apify actors info <actor> --readme --user-agent apify-agent-skills/apify-actor-development
apify actors info <actor> --input --user-agent apify-agent-skills/apify-actor-development
apify call <actor> --input '{"startUrls":[{"url":"https://example.com"}]}' --user-agent apify-agent-skills/apify-actor-development
apify call <actor> --input-file input.json --user-agent apify-agent-skills/apify-actor-development

入力は 1 つの JSON オブジェクトです。インライン JSON は引用符で囲みます。複雑な場合は --input-file を使用します。

あまり知られていないコマンド

# これらの各コマンドにも --user-agent apify-agent-skills/apify-actor-development を追加してください。
apify secrets add <name> <value>   # actor.json から "@name" として参照。プッシュ時にアップロードされます。
apify pull <actor>                 # プラットフォームから Actor のコードをダウンロードします。
apify api <endpoint>               # Apify API への認証済みリクエスト。
apify actor generate-schema-types  # TypeScript: .actor スキーマからインターフェースを生成し、src/__generated__/actor/ に出力します。
apify <command> --help

ドキュメント

  • Apify MCP サーバー(https://mcp.apify.com/?tools=docs)を使用: search-apify-docs および fetch-apify-docs。
  • docs.apify.com/llms.txt および llms-full.txt、Apify プラットフォーム。
  • crawlee.dev/llms.txt および llms-full.txt、Crawlee。
  • Actor ホワイトペーパー、完全な Actor 仕様。
  • Playwright MCP サーバー(npx @playwright/mcp@latest)は、デバッグ中にページを検査しセレクターをキャプチャするための実際のブラウザを駆動します。

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

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

Design and build an official Apify integration for a company's product - workflow-automation apps (Zapier/n8n-style), AI agent plugins (coding-agent skills+MCP bundles or OpenClaw/Hermes-style harnesses), AI framework packages (LangChain/LlamaIndex-style), or direct application clients via apify-client. Use when planning, creating, or reviewing an integration that exposes Apify Actors, runs, datasets, or key-value stores inside another product.

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.

関連スキル