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
- Derive nullability from evidence: Missing, null and guaranteed fields differ; preserve actual type/runtime contracts and verify Apify validator support.
- 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:
- Create todo list with all phases
- Find the
.actor/ directory containing actor.json
- Read
actor.json to understand the Actor's configuration
- Check if
dataset_schema.json, output_schema.json, and key_value_store_schema.json already exist
- 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
- 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(
- 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(
- 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
- 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
- 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
1---2name: apify-generate-output-schema3description: 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. 4category: Document Processing5source: antigravity6tags: [python, javascript, typescript, pdf, api, ai, agent, workflow, template, document]7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/apify-generate-output-schema8metadata:9 source: https://skillmd.com/skills/ranbot-ai/apify-generate-output-schema10---1112## When to Use13- Use when this upstream workflow matches the user's stated goal.14- Use when the task requires the procedures documented in this skill.1516# Generate Actor output schema1718You 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`.1920## Core principles2122- **Analyze code first**: Read the Actor's source to understand what data it actually pushes to the dataset — never guess23- **Derive nullability from evidence**: Missing, null and guaranteed fields differ; preserve actual type/runtime contracts and verify Apify validator support.24- **Anonymize examples**: Never use real user IDs, usernames, or personal data in examples25- **Verify against code**: If TypeScript types exist, cross-check the schema against both the type definition AND the code that produces the values26- **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 formatting27- **Don't reinvent the wheel**: Reuse existing type definitions, interfaces, and utilities from the codebase instead of creating duplicate definitions2829---3031## Phase 1: Discover Actor structure3233**Goal**: Locate the Actor and understand its output3435Initial request: $ARGUMENTS3637**Actions**:381. Create todo list with all phases392. Find the `.actor/` directory containing `actor.json`403. Read `actor.json` to understand the Actor's configuration414. Check if `dataset_schema.json`, `output_schema.json`, and `key_value_store_schema.json` already exist425. **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 structure436. Find all places where data is pushed to the dataset:44 - **JavaScript/TypeScript**: Search for `Actor.pushData(`, `dataset.pushData(`, `Dataset.pushData(`45 - **Python**: Search for `Actor.push_data(`, `dataset.push_data(`, `Dataset.push_data(`467. Find all places where data is stored in the key-value store:47 - **JavaScript/TypeScript**: Search for `Actor.setValue(`, `keyValueStore.setValue(`, `KeyValueStore.setValue(`48 - **Python**: Search for `Actor.set_value(`, `key_value_store.set_value(`, `KeyValueStore.set_value(`498. Find output type definitions — **reuse them directly** instead of recreating from scratch:50 - **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 definition51 - **Python**: Look for TypedDict, dataclass, or Pydantic model definitions. Use the existing field names, types, and docstrings as the source of truth529. Check for existing shared schema utilities or helper functions in the codebase that handle schema generation or validation — reuse them rather than creating new logic5310. If inline `storages.dataset` or `storages.keyValueStore` config exists in `actor.json`, note it for migration5455Present findings to user: list all discovered dataset output fields, key-value store keys, their types, and where they come from.5657---5859## Phase 2: Generate `dataset_schema.json`6061**Goal**: Create a complete dataset schema with field definitions and display views6263### File structure6465```jsonc66{67 "actorSpecification": 1,68 "fields": {69 "$schema": "http://json-schema.org/draft-07/schema#",70 "type": "object",71 "properties": {72 // ALL output fields here — every field the Actor can produce,73 // not just the ones shown in the overview view74 },75 "required": [],76 "additionalProperties": true77 },78 "views": {79 "overview": {80 "title": "Overview",81 "description": "Most important fields at a glance",82 "transformation": {83 "fields": [84 // 8-12 most important field names85 ]86 },87 "display": {88 "component": "table",89 "properties": {90 // Display config for each overview field91 }92 }93 }94 }95}96```9798### Consistency with existing schemas99100If existing output schemas were found in the repository during Phase 1 (step 5), follow their conventions:101- Match the **description writing style** (sentence case vs. lowercase, period vs. no period, etc.)102- Match the **field naming convention** (camelCase vs. snake_case) — this must also match the actual keys produced by the Actor code103- Match the **example value style** (e