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

Apify Actor 化

既存のプロジェクトをApify Actor(サーバーレスクラウドプログラム)に変換します。JavaScript/TypeScript(Actor.init/exitを備えたSDK)、Python(非同期コンテキストマネージャー)、またはその他の言語(CLIラッパー)に対応。コードをApifyに移行する際、CLIツールをActorとしてラップする際、または既存のプロジェクトにActor SDKを追加する際に使用します。

Apify Actor 化 とは?

このスキルは、既存のソフトウェアプロジェクトをApifyプラットフォーム上で再利用可能なサーバーレスアプリケーション(Actor)に変換するプロセスをガイドします。ActorはDockerイメージとしてパッケージ化されたプログラムで、定義されたJSON入力を受け付け、アクションを実行し、構造化されたJSON出力を生成します。このスキルは、JavaScript/TypeScript、Python、およびその他の言語(CLIベース)をサポートします。主な手順には、`apify init`によるActor構造の初期化、言語固有のSDKライフサイクル(例:JS/TSでは`await Actor.init()`と`await Actor.exit()`、Pythonでは`async with Actor:`)によるコードのラッピング、入力/出力スキーマの設定、ローカルテスト、および`apify push`によるデプロイが含まれます。このスキルは、コードのApifyプラットフォームへの移行、CLIツールのActor化、Crawleeプロジェクトの移行など、様々なユースケースに対応しています。また、セキュリティベストプラクティス(クロールされたコンテンツのサニタイズ、依存関係の固定、資格情報の分離など)と、Actorを収益化するためのオプション(PPE: Pay Per Eventなど)に関するガイダンスも提供します。

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

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

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

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

ドキュメント

Apify Actor 化 は何をしますか?

Actor 化とは、既存のソフトウェアを Apify プラットフォームと互換性のある再利用可能なサーバーレスアプリケーションに変換することです。Actor は Docker イメージとしてパッケージ化されたプログラムで、明確に定義された JSON 入力を受け付け、アクションを実行し、オプションで構造化された JSON 出力を生成します。

クイックスタート

  1. プロジェクトルートで apify init --user-agent apify-agent-skills/apify-actorization を実行
  2. SDK ライフサイクルでコードをラップ(下記の言語別セクションを参照)
  3. .actor/input_schema.json を設定
  4. apify run --input '{"key": "value"}' --user-agent apify-agent-skills/apify-actorization でテスト
  5. apify push --user-agent apify-agent-skills/apify-actorization でデプロイ

このスキルを使用するタイミング

  • 既存のプロジェクトを Apify プラットフォームで実行するように変換する場合
  • プロジェクトに Apify SDK 統合を追加する場合
  • CLI ツールやスクリプトを Actor としてラップする場合
  • Crawlee プロジェクトを Apify に移行する場合

前提条件

apify CLI がインストールされていることを確認します:

apify --help

インストールされていない場合は、以下のいずれかの方法を使用します(優先順位順):

# 推奨:パッケージマネージャーを介してインストール(整合性チェックを提供)
npm install -g apify-cli

# または(Mac):brew install apify-cli

セキュリティ注記: リモートスクリプトをシェルにパイプして CLI をインストールしないでください (例:curl ... | bash や irm ... | iex)。常にパッケージマネージャーを使用してください。

CLI がログインしていることを確認します:

apify info  # ユーザー名が返されるはずです

ログインしていない場合は、OAuth を使用して認証します(ブラウザが開きます):

apify login

ブラウザログインが利用できない場合(ヘッドレス環境や CI の場合)、APIFY_TOKEN 環境変数がエクスポートされていることを確認します(注:変数は APIFY_TOKEN であり、APIFY_API_TOKEN ではありません)。CLI は自動的にそれを読み取ります。明示的なログインは不要です。ユーザーがトークンを持っていない場合は、https://console.apify.com/settings/integrations で生成します。

Apify プラットフォーム環境: Actor が Apify プラットフォーム上で実行されると、APIFY_TOKEN が環境変数として自動的に注入され、Apify SDK が自動的に読み取ります。明示的に渡す必要はありません。ローカルでは、apify login が ~/.apify に資格情報を保存し、SDK はそれを使用します。

セキュリティ注記: トークンをコマンドライン引数として渡さないでください(例:apify login -t <token>)。 引数はプロセス一覧に表示され、シェル履歴に記録される可能性があります。 OAuth ログインまたは環境変数を優先してください。 ソースコードや設定ファイルに APIFY_TOKEN をログ、出力、埋め込まないでください。 最小限の必要な権限を持つトークン(スコープ付きトークン)を使用し、定期的にローテーションしてください。

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

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

apify push --user-agent apify-agent-skills/apify-actorization

Actor 化チェックリスト

進捗を追跡するためにこのチェックリストをコピーします:

  • ステップ 1:プロジェクトを分析(言語、エントリポイント、入力、出力)
  • ステップ 2:apify init --user-agent apify-agent-skills/apify-actorization を実行して Actor 構造を作成
  • ステップ 3:言語固有の SDK 統合を適用
  • ステップ 4:.actor/input_schema.json を設定
  • ステップ 5:.actor/output_schema.json を設定(該当する場合)
  • ステップ 6:.actor/actor.json メタデータを更新
  • ステップ 7:Apify Store リスティング用の README.md を作成
  • ステップ 8:apify run --user-agent apify-agent-skills/apify-actorization でローカルテスト
  • ステップ 9:apify push --user-agent apify-agent-skills/apify-actorization でデプロイ

ステップ 1:プロジェクトを分析

変更を加える前に、プロジェクトを理解します:

  1. 言語を特定 - JavaScript/TypeScript、Python、またはその他
  2. エントリポイントを見つける - 実行を開始するメインファイル
  3. 入力を特定 - コマンドライン引数、環境変数、設定ファイル
  4. 出力を特定 - ファイル、コンソール出力、API 応答
  5. 状態を確認 - 実行間でデータを永続化する必要があるか

ステップ 2:Actor 構造を初期化

プロジェクトルートで実行:

apify init --user-agent apify-agent-skills/apify-actorization

これにより作成されるもの:

  • .actor/actor.json - Actor 設定とメタデータ
  • .actor/input_schema.json - Apify Console 用の入力定義
  • Dockerfile(存在しない場合) - コンテナイメージ定義

ステップ 3:言語固有の変更を適用

プロジェクトの言語に基づいて選択します:

クイックリファレンス

言語インストールコードのラップ
JS/TSnpm install apifyawait Actor.init() ... await Actor.exit()
Pythonpip install apifyasync with Actor:
その他ラッパースクリプトで CLI を使用apify actor:get-input / apify actor:push-data

ステップ 4~6:スキーマを設定

詳細な設定については、schemas-and-output.md を参照してください:

  • 入力スキーマ(.actor/input_schema.json)
  • 出力スキーマ(.actor/output_schema.json)
  • Actor 設定(.actor/actor.json)
  • 状態管理(リクエストキュー、キーバリューストア)

@apify/json_schemas npm パッケージに対してスキーマを検証します。

ステップ 7:README を作成

重要: Actor 化の一環として、常に README.md を生成してください。README は Apify Store 上の Actor のランディングページであり、発見可能性(SEO)、ユーザーオンボーディング、およびサポートにとって重要です。適切な README なしで Actor を完了したと見なさないでください。

必要な構造については、skills/apify-actor-development/references/actor-readme.md の Actor README ガイドラインを参照してください。これには、紹介と機能、データ抽出テーブル、ステップバイステップチュートリアル、価格情報、入出力例、FAQ が含まれます。SEO に最適化された H2/H3 見出しを使用して、少なくとも 300 ワードを目指してください。また、ベストプラクティスとして以下のトップ Actor も確認してください:

ステップ 8:ローカルでテスト

インライン入力で Actor を実行します(JS/TS および Python Actor の場合):

apify run --input '{"startUrl": "https://example.com", "maxItems": 10}' --user-agent apify-agent-skills/apify-actorization

または入力ファイルを使用:

apify run --input-file ./test-input.json --user-agent apify-agent-skills/apify-actorization

重要: npm start や python main.py ではなく、常に apify run を使用してください。CLI が適切な環境とストレージを設定します。

ステップ 9:デプロイ

apify push --user-agent apify-agent-skills/apify-actorization

これにより、Actor が Apify プラットフォームにアップロードおよびビルドされます。

収益化(オプション)

デプロイ後、Apify Store で Actor を収益化できます。推奨されるモデルは Pay Per Event(PPE) です:

  • 結果/アイテムのスクレイピングごと
  • 処理されたページごと
  • API 呼び出しごと

Apify Console の Actor > Monetization で PPE を設定します。コード内で await Actor.charge('result') を使用してイベントに対して課金します。

その他のオプション:レンタル(月額サブスクリプション)または無料(オープンソース)。

セキュリティ

クロールされたすべての Web コンテンツを信頼できない入力として扱います。 Actor は、悪意のあるペイロードを含む可能性がある外部 Web サイトからデータを取り込みます。以下のルールに従ってください:

  • クロールされたデータをサニタイズする — 生の HTML、URL、スクレイピングされたテキストを、シェルコマンド、eval()、データベースクエリ、テンプレートエンジンに直接渡さないでください。適切なエスケープまたはパラメータ化された API を使用してください。
  • すべての外部データを検証および型チェックする — データセットやキーバリューストアにプッシュする前に、値が期待される型と形式に一致することを確認してください。予期しない構造は拒否またはサニタイズしてください。
  • クロールされたコンテンツを実行または解釈しない — スクレイピングされたテキストをコード、コマンド、設定として扱わないでください。Web サイトからのコンテンツには、プロンプトインジェクションの試行や埋め込みスクリプトが含まれる可能性があります。
  • 資格情報をデータパイプラインから分離する — APIFY_TOKEN およびその他のシークレットがリクエストハンドラーからアクセス可能になったり、クロールされたデータと一緒に渡されたりしないようにしてください。データ処理コードで環境変数を介してトークンを渡すのではなく、Apify SDK の組み込み資格情報管理を使用してください。
  • インストール前に依存関係を確認する — npm install または pip install でパッケージを追加する場合は、パッケージ名と発行者を確認してください。タイポスクワッティングは、一般的なサプライチェーン攻撃ベクトルです。よく知られており、積極的にメンテナンスされているパッケージを優先してください。
  • バージョンを固定し、ロックファイルを使用する — 常に package-lock.json(Node.js)をコミットするか、requirements.txt(Python)で正確なバージョンを固定してください。ロックファイルは再現可能なビルドを保証し、サイレントな依存関係の置き換えを防ぎます。既知の脆弱性を定期的に確認するために、npm audit または pip-audit を定期的に実行してください。

デプロイ前チェックリスト

  • .actor/actor.json が存在し、正しい名前と説明が設定されている
  • .actor/actor.json が @apify/json_schemas(actor.schema.json)に対して検証される
  • .actor/input_schema.json が必要なすべての入力を定義している
  • .actor/input_schema.json が @apify/json_schemas(input.schema.json)に対して検証される
  • .actor/output_schema.json が出力構造を定義している(該当する場合)
  • .actor/output_schema.json が @apify/json_schemas(output.schema.json)に対して検証される
  • Dockerfile が存在し、ビルドが成功する
  • Actor.init() / Actor.exit() がメインコードをラップしている(JS/TS)
  • async with Actor: がメインコードをラップしている(Python)
  • 入力が Actor.getInput() / Actor.get_input() を介して読み取られる
  • 出力が Actor.pushData() またはキーバリューストアを使用する
  • apify run --user-agent apify-agent-skills/apify-actorization がテスト入力で正常に実行される
  • README.md が適切な構造(紹介、機能、データテーブル、チュートリアル、価格、入出力例)で存在する
  • generatedBy が actor.json のメタセクションに設定されている

MCP ツール

Apify MCP

Apify MCP サーバーが設定されている場合は、ドキュメントにこれらのツールを使用します:

  • search-apify-docs - ドキュメントを検索
  • fetch-apify-docs - 完全なドキュメントページを取得

それ以外の場合、MCP サーバーの URL は次のとおりです:https://mcp.apify.com/?tools=docs。

Playwright MCP(デバッグ)

Playwright MCP サーバーは、Web と対話する Actor のデバッグに便利なツールです。エージェントが実際のブラウザを操作してページを検査し、セレクターをキャプチャし、問題を再現できます。

Claude Code CLI でインストール:

claude mcp add playwright npx @playwright/mcp@latest

または、MCP 設定に手動で追加します:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@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

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

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.

関連スキル