apify-generate-output-schema

apify/agent-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/apify/agent-skills --skill apify-generate-output-schema
0 commentsdiscussion
summary

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.

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(
  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
                }
            }
        }
    }
}

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)

Rule Detail
All fields in properties The 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": true On every field — APIs are unpredictable
"additionalProperties": true On 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 examples No 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 type Example approach
IDs Match platform format and length (e.g., 11 chars for YouTube video IDs)
Usernames "exampleuser", "sampleuser123"
Display names "Example Channel", "Sample Author"
URLs Use platform's standard URL for
how to use apify-generate-output-schema

How to use apify-generate-output-schema on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add apify-generate-output-schema
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

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

The skills CLI fetches apify-generate-output-schema from GitHub repository apify/agent-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/apify-generate-output-schema

Reload or restart Cursor to activate apify-generate-output-schema. Access the skill through slash commands (e.g., /apify-generate-output-schema) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.434 reviews
  • Dhruvi Jain· Dec 24, 2024

    Useful defaults in apify-generate-output-schema — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Dev Khan· Dec 16, 2024

    Useful defaults in apify-generate-output-schema — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Michael Jackson· Dec 12, 2024

    I recommend apify-generate-output-schema for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Oshnikdeep· Nov 15, 2024

    apify-generate-output-schema has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Aisha Ndlovu· Nov 7, 2024

    apify-generate-output-schema has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Yusuf Li· Nov 3, 2024

    Solid pick for teams standardizing on skills: apify-generate-output-schema is focused, and the summary matches what you get after install.

  • Aisha Tandon· Oct 26, 2024

    Solid pick for teams standardizing on skills: apify-generate-output-schema is focused, and the summary matches what you get after install.

  • Amina White· Oct 22, 2024

    apify-generate-output-schema has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Ganesh Mohane· Oct 6, 2024

    Solid pick for teams standardizing on skills: apify-generate-output-schema is focused, and the summary matches what you get after install.

  • Evelyn Khanna· Sep 13, 2024

    Keeps context tight: apify-generate-output-schema is the kind of skill you can hand to a new teammate without a long onboarding doc.

showing 1-10 of 34

1 / 4