Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

apify-generate-output-schemaapify 生成输出模式

Agent Skill

apify-generate-output-schema 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

72,168

周安装

3,070

GitHub Stars

2,015

下载量

25,296
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:apify-generate-output-schema(apify 生成输出模式)
来源仓库:https://github.com/apify/agent-skills
仓库路径:skills/apify-generate-output-schema
安装命令:
npx skills add https://github.com/apify/agent-skills --skill apify-generate-output-schema
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/apify/agent-skills --skill apify-generate-output-schema

简介

用于为 Apify Actor 生成标准化的输出模式文件,包括数据集、输出和键值存储的结构定义。

  • 适合在构建或维护 Apify 爬虫项目时,自动推导数据结构并生成可配置的 schema 文件。
  • 通过分析 Actor 源码自动生成 dataset_schema.json、output_schema.json 等文件,需配合 GitHub 仓库使用。
  • 安装前需确认权限范围和维护状态,注意可能涉及代码读取和配置文件写入操作。
  • apify-generate-output-schema 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

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(

  1. 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(

  1. 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

  1. 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
  2. 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
                }
            }
        }
    }
}

Consistency with existing schemas

If existing output schemas were found in the repository during Phase 1 (step 5), follow their conventions:

  • Match the description writing style (sentence case vs. lowercase, period vs. no period, etc.)
  • Match the field naming convention (camelCase vs. snake_case) — this must also match the actual keys produced by the Actor code
  • Match the example value style (e.g., date formats, URL patterns, placeholder names)
  • Match the view structure (number of fields in overview, display format choices)
  • Match the JSON formatting (indentation, property ordering, spacing) — all schemas in the same repository must use identical formatting, including standalone Actors

When the Actor code already has well-defined TypeScript interfaces or Python type classes, derive fields directly from those types rather than re-analyzing pushData/push_data calls from scratch. The type definition is the canonical source.

Hard rules (no exceptions)

RuleDetail
All fields in propertiesThe fields.properties object must contain every field the Actor can output, not just the fields shown in the overview view. The views section selects a subset for display — the properties section must be the complete superset
"nullable": trueOn every field — APIs are unpredictable
"additionalProperties": trueOn the top-level fields object AND on every nested object within properties. This is the most commonly missed rule — it must appear at both levels
"required": []Always empty array — on the top-level fields object AND on every nested object within properties
Anonymized examplesNo real user IDs, usernames, or content
"type" required with "nullable"AJV rejects nullable without a type on the same field
Warning — most common mistakes: 1. Only including fields that appear in the overview view. The fields.properties must list ALL output fields, even if they are not in the views section. 2. Only adding "required": [] and "additionalProperties": true on nested object-type properties but forgetting them on the top-level fields object. Both levels need them.
Note: nullable is an Apify-specific extension to JSON Schema draft-07. It is intentional and correct.

Field type patterns

String field:

"title": {
    "type": "string",
    "description": "Title of the scraped item",
    "nullable": true,
    "example": "Example Item Title"
}

Number field:

"viewCount": {
    "type": "number",
    "description": "Number of views",
    "nullable": true,
    "example": 15000
}

Boolean field:

"isVerified": {
    "type": "boolean",
    "description": "Whether the account is verified",
    "nullable": true,
    "example": true
}

Array field:

"hashtags": {
    "type": "array",
    "description": "Hashtags associated with the item",
    "items": { "type": "string" },
    "nullable": true,
    "example": ["#example", "#demo"]
}

Nested object field:

"authorInfo": {
    "type": "object",
    "description": "Information about the author",
    "properties": {
        "name": { "type": "string", "nullable": true },
        "url": { "type": "string", "nullable": true }
    },
    "required": [],
    "additionalProperties": true,
    "nullable": true,
    "example": { "name": "Example Author", "url": "https://example.com/author" }
}

Enum field:

"contentType": {
    "type": "string",
    "description": "Type of content",
    "enum": ["article", "video", "image"],
    "nullable": true,
    "example": "article"
}

Union type (e.g., TypeScript ObjectType | string):

"metadata": {
    "type": ["object", "string"],
    "description": "Structured metadata object, or error string if unavailable",
    "nullable": true,
    "example": { "key": "value" }
}

Anonymized example values

Use realistic but generic values. Follow platform ID format conventions:

Field typeExample approach
IDsMatch platform format and length (e.g., 11 chars for YouTube video IDs)
Usernames"exampleuser", "sampleuser123"
Display names"Example Channel", "Sample Author"
URLsUse platform's standard URL format with fake IDs
Dates"2025-01-15T12:00:00.000Z" (ISO 8601)
Text contentGeneric descriptive text, e.g., "This is an example description."

Views section

  • transformation.fields: List 8–12 most important field names (order = column order in UI)
  • display.properties: One entry per overview field with label and format
  • Available formats: "text", "number", "date", "link", "boolean", "image", "array", "object"

Pick fields that give users the most useful at-a-glance summary of the data.


Phase 3: Generate key_value_store_schema.json (if applicable)

Goal: Define key-value store collections if the Actor stores data in the key-value store

Skip this phase if no Actor.setValue() / Actor.set_value() calls were found in Phase 1 (beyond the default INPUT key).

File structure

{
    "actorKeyValueStoreSchemaVersion": 1,
    "title": "<Descriptive title — what the key-value store contains>",
    "description": "<One sentence describing the stored data>",
    "collections": {
        "<collectionName>": {
            "title": "<Human-readable title>",
            "description": "<What this collection contains>",
            "keyPrefix": "<prefix->"
        }
    }
}

How to identify collections

Group the discovered setValue / set_value calls by key pattern:

  1. Fixed keys (e.g., "RESULTS", "summary") — use "key" (exact match)
  2. Dynamic keys with a prefix (e.g., "screenshot-${id}", f"image-{name}") — use "keyPrefix"

Each group becomes a collection.

Collection properties

PropertyRequiredDescription
titleYesShown in UI tabs
descriptionNoShown in UI tooltips
keyConditionalExact key for single-key collections (use key OR keyPrefix, not both)
keyPrefixConditionalPrefix for multi-key collections (use key OR keyPrefix, not both)
contentTypesNoRestrict allowed MIME types (e.g., ["image/jpeg"], ["application/json"])
jsonSchemaNoJSON Schema draft-07 for validating application/json content

Examples

Single file output (e.g., a report):

{
    "actorKeyValueStoreSchemaVersion": 1,
    "title": "Analysis Results",
    "description": "Key-value store containing analysis output",
    "collections": {
        "report": {
            "title": "Report",
            "description": "Final analysis report",
            "key": "REPORT",
            "contentTypes": ["application/json"]
        }
    }
}

Multiple files with prefix (e.g., screenshots):

{
    "actorKeyValueStoreSchemaVersion": 1,
    "title": "Scraped Files",
    "description": "Key-value store containing downloaded files and screenshots",
    "collections": {
        "screenshots": {
            "title": "Screenshots",
            "description": "Page screenshots captured during scraping",
            "keyPrefix": "screenshot-",
            "contentTypes": ["image/png", "image/jpeg"]
        },
        "documents": {
            "title": "Documents",
            "description": "Downloaded document files",
            "keyPrefix": "doc-",
            "contentTypes": ["application/pdf", "text/html"]
        }
    }
}

Phase 4: Generate output_schema.json

Goal: Create the output schema that tells Apify Console where to find results

For most Actors that push data to a dataset, this is a minimal file:

{
    "actorOutputSchemaVersion": 1,
    "title": "<Descriptive title — what the Actor returns>",
    "description": "<One sentence describing the output data>",
    "properties": {
        "dataset": {
            "type": "string",
            "title": "Results",
            "description": "Dataset containing all scraped data",
            "template": "{{links.apiDefaultDatasetUrl}}/items"
        }
    }
}
Critical: Each property entry must include "type": "string" — this is an Apify-specific convention. The Apify meta-validator rejects properties without it (and rejects "type": "object" — only "string" is valid here).

If key_value_store_schema.json was generated in Phase 3, add a second property:

"files": {
    "type": "string",
    "title": "Files",
    "description": "Key-value store containing downloaded files",
    "template": "{{links.apiDefaultKeyValueStoreUrl}}/keys"
}

Available template variables

  • {{links.apiDefaultDatasetUrl}} — API URL of default dataset
  • {{links.apiDefaultKeyValueStoreUrl}} — API URL of default key-value store
  • {{links.publicRunUrl}} — Public run URL
  • {{links.consoleRunUrl}} — Console run URL
  • {{links.apiRunUrl}} — API run URL
  • {{links.containerRunUrl}} — URL of webserver running inside the run
  • {{run.defaultDatasetId}} — ID of the default dataset
  • {{run.defaultKeyValueStoreId}} — ID of the default key-value store

Phase 5: Update actor.json

Goal: Wire the schema files into the Actor configuration

Actions:

  1. Read the current actor.json
  2. Add or update the storages.dataset reference: "storages": {"dataset": "./dataset_schema.json"}
  3. If key_value_store_schema.json was generated, add the reference: "storages": {"dataset": "./dataset_schema.json", "keyValueStore": "./key_value_store_schema.json"}
  4. Add or update the output reference: "output": "./output_schema.json"
  5. If actor.json had inline storages.dataset or storages.keyValueStore objects (not string paths), migrate their content into the respective schema files and replace the inline objects with file path strings

Phase 6: Review and validate

Goal: Ensure correctness and completeness

Checklist:

  • Every output field from the source code is in dataset_schema.json fields.properties — not just the overview view fields but ALL fields the Actor can produce
  • Every field has "nullable": true
  • The top-level fields object has both "additionalProperties": true and "required": []
  • Every nested object within properties also has "additionalProperties": true and "required": []
  • Every field has a "description" and an "example"
  • All example values are anonymized
  • "type" is present on every field that has "nullable"
  • Views list 8–12 most useful fields with correct display formats
  • output_schema.json has "type": "string" on every property
  • If key-value store is used: key_value_store_schema.json has collections matching all setValue/set_value calls
  • If key-value store is used: each collection uses either key or keyPrefix (not both)
  • actor.json references all generated schema files
  • Schema field names match the actual keys in the code (camelCase/snake_case consistency)
  • If existing schemas were found in the repo, the new schema follows their conventions (description style, example format, view structure)
  • Schema fields are derived from existing type definitions (interfaces, TypedDicts, dataclasses) where available — no duplicated or divergent field definitions

Present the generated schemas to the user for review before writing them.


Phase 7: Summary

Goal: Document what was created

Report:

  • Files created or updated
  • Number of fields in the dataset schema
  • Number of collections in the key-value store schema (if generated)
  • Fields selected for the overview view
  • Any fields that need user clarification (ambiguous types, unclear nullability)
  • Suggested next steps (test locally with apify run, verify output tab in Console)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.98%
按下载量换算10,113

Claude

30.64%
按下载量换算7,751

Cursor

17.1%
按下载量换算4,326

Gemini CLI

9.79%
按下载量换算2,476

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills