indexing-handler-syntax

Define event handlers with a consistent syntax and context API for the Polymarket indexer.

43|9|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/enviodev/polymarket-v2-indexer --skill indexing-handler-syntax
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: indexing-handler-syntax
Source: https://github.com/enviodev/polymarket-v2-indexer/tree/main/.claude/skills/indexing-handler-syntax
Command: npx skills add https://github.com/enviodev/polymarket-v2-indexer --skill indexing-handler-syntax

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing and maintaining event handlers for the Polymarket indexer can be error-prone without a consistent syntax and a reliable context API. This section explains how to standardize handler registration, access event data, and perform common tasks safely.

Core Features & Use Cases

  • Handler Registration: Register contract events with a clear API that exposes event, context, and chain information.
  • Context API: Read and write entities, perform queries, and access runtime information like chainId, isLive, context.log.
  • Safe Updates: Use spread updates to ensure immutability while applying changes to entities.
  • Runtime Interactions: Leverage indexer runtime API to introspect contracts, chains, and handlers during development.
  • Common Pitfalls: Avoid undefined fields, misusing _id suffixes, and unsafe mutations.

Quick Start

Create a new handler using Contract.Event.handler and start the indexer, then validate runtime execution in a test environment.

Frequently Asked Questions about indexing-handler-syntax

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register event handlers for a Polymarket indexer using TypeScript?

Register Polymarket indexer event handlers using Contract.Event.handler to expose event, context, and chain information. This standardizes handler registration and provides a consistent API for accessing event data within HyperIndex.

What is the context API in HyperIndex handler development?

The context API in HyperIndex allows you to read and write entities, perform getWhere queries, and access runtime information like chainId, isLive, and context.log. It provides a consistent interface for interacting with indexer runtime data during event processing.

How do I safely update entities in an indexer event handler?

Safely update entities in an indexer event handler by using spread updates to ensure immutability while applying changes. This pattern prevents unsafe mutations and maintains data integrity throughout the HyperIndex runtime execution.

Why does my indexer handler have undefined fields after an entity update?

Undefined fields in indexer handlers often occur from misusing _id suffixes or unsafe mutations. Avoid these common pitfalls by applying spread updates correctly and following safe patterns for entity CRUD operations within the context API.

Can I introspect contracts and chains during indexer runtime development?

Yes, you can leverage the indexer runtime API to introspect contracts, chains, and handlers during development. This allows you to validate runtime execution in a test environment and inspect available runtime information.

What are common pitfalls when writing event handlers for the Polymarket indexer?

Common pitfalls when writing event handlers include encountering undefined fields, misusing _id suffixes, and performing unsafe mutations. Enforcing safe patterns and correct spreading of entities guards against these errors in HyperIndex handler development.