kleros/foresight/indexer-schema
Claude Code and agent skill by kleros/foresight
- community
Checking that the SKILL.md file is still in the repository.
Use when defining or editing schema.graphql. Entity types, scalar types, enums, relationships, @derivedFrom, @index, @config directives, array rules, naming conventions, and schema-to-TypeScript type mapping.
Install
npx vskill@latest install kleros/foresight/indexer-schemaSKILL.md
Schema Reference (schema.graphql)
Entity Rules
- Every type is an entity — no `@entity` decorator (unlike TheGraph)
- Must have
id: ID!as first field - Names: 1-63 chars, alphanumeric + underscore, no reserved words
- Relationship fields use the entity type directly:
collection: NftCollection!— never add_idin the schema field name - The
_idsuffix only appears in TypeScript handlers (added by codegen): schema fieldcollection→ handler fieldcollection_id
Scalar Types
| Schema Type | TypeScript Type | Notes | |
|---|---|---|---|
ID! | string | Required on every entity | |
String! | string | ||
Int! | number | ||
Float! | number | ||
Boolean! | boolean | ||
BigInt! | bigint | Use @config(precision: N) for custom precision | |
BigDecimal! | BigDecimal | Use @config(precision: N, scale: M) | |
Bytes! | string | Hex-encoded | |
Timestamp! | Date | ||
Json! | any |
Enums
@derivedFrom
Virtual reverse-lookup — cannot access in handlers, only in API queries:
Critical rules:
- The
fieldargument must match the schema field name on the child entity — which is the entity reference name ("pool"), not"pool_id" - In TypeScript handlers, set this relationship using the
_idsuffix:pool_id: poolEntity.id— codegen transformspool: Pool!→pool_idin the TypeScript type - Never write `pool_id: String!` in the schema when using `@derivedFrom(field: "pool")`. The schema field must be
pool: Pool!; the_idis a codegen artifact for handlers only
@index
Single-field index for faster queries:
Composite index with optional DESC direction:
- Fields default to ASC; use
["field", "DESC"]for descending - IDs and
@derivedFromfields are automatically indexed - Only
idand@indexfields are queryable viacontext.Entity.getWhere()
@config
Customize precision for numeric types:
BigIntdefault precision: 76 digitsBigDecimaldefault: precision 76, scale 32
Array Rules
- Supported:
[Type!]!— non-nullable elements, non-nullable array - Not supported:
[Type]!(nullable elements), nested arrays,[Boolean!]!,[Timestamp!]! - Entity arrays require
@derivedFrom— bare[Swap!]!without it causes a codegen error
Example
Schema vs handler field names:
| Schema field | Schema type | TypeScript handler field | |
|---|---|---|---|
pool | Pool! | pool_id: string | |
token0 | Token! | token0_id: string | |
collection | NftCollection! | collection_id: string |
Codegen always appends _id to entity reference field names in the TypeScript types. Do not add _id yourself in the schema.
If something is unclear, use theenvio-docsskill to search and read the latest documentation.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingapps/indexer/.claude/skills/indexer-schema/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kleros/foresight/indexer-schema)