跳到正文
Skillpedia
部署与云(DevOps)48k · #3790

apify-generate-output-schema

它能做什么

这个 AI 代理可以帮你创建 Apify Actor 的配置文件。它会分析程序代码,了解程序会输出什么信息,以及这些信息应该如何组织。

适用场景

  • ✓在 Apify 上创建新程序(Actor)时。
  • ✓当你需要更新现有 Apify 程序的结果展示方式时。
  • ✓当你不确定如何描述程序生成的数据时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/apify-generate-output-schema/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/apify-generate-output-schema/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我需要为我的 Actor 创建一个 schema 文件,用来收集商品名称和价格。”

每周 5 个新技能,1 分钟读完。

工作原理

代理会读取你程序的代码,看清它实际输出了哪些数据。然后据此生成 schema 文件,告诉 Apify 如何以清晰、统一的方式展示这些数据。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

When to Use

  • Use when this upstream workflow matches the user's stated goal.
  • Use when the task requires the procedures documented in this skill.

Generate Actor output schema

You are generating output schema files for an Apify Actor. The output schema tells Apify Console how to display run results. You will analyze the Actor's source code, create dataset_schema.json, output_schema.json, and key_value_store_schema.json (if the Actor uses key-value store), and update actor.json.

Core principles

  • Analyze code first: Read the Actor's source to understand what data it actually pushes to the dataset — never guess
  • Every field is nullable: APIs and websites are unpredictable — always set "nullable": true
  • Anonymize examples: Never use real user IDs, usernames, or personal data in examples
  • Verify against code: If TypeScript types exist, cross-check the schema against both the type definition AND the code that produces the values
  • Reuse existing patterns: Before generating schemas, check if other Actors in the same repository already have output schemas — match their structure, naming conventions, description style, and formatting
  • Don't reinvent the wheel: Reuse existing type definitions, interfaces, and utilities from the codebase instead of creating duplicate definitions

Phase 1: Discover Actor structure

Goal: Locate the Actor and understand its output

Initial request: $ARGUMENTS

Actions:

  1. Create todo list with all phases
  2. Find the .actor/ directory containing actor.json
  3. Read actor.json to understand the Actor's configuration
  4. Check if dataset_schema.json, output_schema.json, and key_value_store_schema.json already exist
  5. Search for existing schemas in the repository: Look for other .actor/ directories or schema files (e.g., **/dataset_schema.json, **/output_schema.json, **/key_value_store_schema.json) to learn the repo's conventions — match their description style, field naming, example formatting, and overall structure
  6. Find all places where data is pushed to the dataset:
    • JavaScript/TypeScript: Search for Actor.pushData(, dataset.pushData(, Dataset.pushData(
    • Python: Search for Actor.push_data(, dataset.push_data(, Dataset.push_data(
  7. Find all places where data is stored in the key-value store:
    • JavaScript/TypeScript: Search for Actor.setValue(, keyValueStore.setValue(, KeyValueStore.setValue(
    • Python: Search for Actor.set_value(, key_value_store.set_value(, KeyValueStore.set_value(
  8. Find output type definitions — reuse them directly instead of recreating from scratch:
    • TypeScript: Look for output type interfaces/types (e.g., in src/types/, src/types/output.ts). If an interface or type already defines the output shape, derive the schema fields from it — do not create a parallel definition
    • Python: Look for TypedDict, dataclass, or Pydantic model definitions. Use the existing field names, types, and docstrings as the source of truth
  9. Check for existing shared schema utilities or helper functions in the codebase that handle schema generation or validation — reuse them rather than creating new logic
  10. If inline storages.dataset or storages.keyValueStore config exists in actor.json, note it for migration

Present findings to user: list all discovered dataset output fields, key-value store keys, their types, and where they come from.


Phase 2: Generate dataset_schema.json

Goal: Create a complete dataset schema with field definitions and display views

File structure

{
    "actorSpecification": 1,
    "fields": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
            // ALL output fields here — every field the Actor can produce,
            // not just the ones shown in the overview view
        },
        "required": [],
        "additionalProperties": true
    },
    "views": {
        "overview": {
            "title": "Overview",
            "description": "Most important fields at a glance",
            "transformation": {
                "fields": [
                    // 8-12 most important field names
                ]
            },
            "display": {
                "component": "table",
                "properties": {
                    // Display config for each overview field
                }
            }

…
常见问题

这些 schema 文件(dataset_schema.json、output_schema.json)是什么?

它们定义了程序生成数据的结构。能帮助 Apify 把结果清晰、有条理地展示出来,比如以表格形式。

为什么所有字段都要设为“nullable”?

因为网站和数据来源可能会变化或出错。把字段设为“nullable”(可为空),即使某条数据缺失,程序也不会崩溃。

“anonymize examples”是什么意思?

意思是在 schema 中展示数据示例时,不要使用真实用户的信息(比如姓名或 ID),应使用虚构数据来保护隐私。

详情

作者的原始描述

Generate output schemas (dataset_schema.json, output_schema.json, key_value_store_schema.json) for an Apify Actor by analyzing its source code. Use when creating or updating Actor output schemas.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3790
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能