sails-indexer
Use when a builder needs a read-side indexer and query API for a standard Gear/Vara Sails app using program events, IDL-driven decoding, projected read models, and optional on-chain query enrichment. Do not use for command-side backends, generic Node APIs, non-Sails repositories, Vara.eth or ethexe-first work.
What this skill does
# Sails Indexer ## Role Design and implement the read-side backend for a standard Gear/Vara Sails app. Use this skill when the frontend or integration layer needs history, pagination, filtering, search, aggregates, charts, timelines, or a fast read API that should not be rebuilt from direct chain queries on every screen load. Treat the indexer as a projection pipeline: `chain/archive -> Sails event decode -> optional on-chain enrichment -> Postgres read model -> thin GraphQL API` ## Local Handbook - `../../references/gear-execution-model.md` - `../../references/gear-messaging-and-replies.md` - `../../references/sails-program-and-service-architecture.md` - `../../references/sails-idl-client-pipeline.md` - `../../references/sails-cheatsheet.md` - `../../references/sails-gtest-and-local-validation.md` - `../../references/scale-binary-decoding-guide.md` - `../../references/contract-interface-evolution.md` - `../../references/sails-indexer-patterns.md` - `../../references/sails-idl-v2-syntax.md` — IDL v2 event syntax (`throws`, `@query`, service-scoped types) ## Standard Defaults - Default to an IDL-driven read-side indexer, not a generic command-side backend. - Treat the program `.idl` as the event and route contract for normal Sails decoding work. - Default stack: Subsquid-style archive ingestion, PostgreSQL read model, ORM-backed entities, and a thin GraphQL API. - Always expose GraphQL as the default read surface for frontend and integration consumers. Do not downgrade the default to REST. - Mount a real GraphQL endpoint such as `/graphql` and make it reachable from local frontend development without browser CORS failures. - Prefer one of two frontend-safe API exposure strategies and name the choice explicitly: enable CORS on the indexer API, or serve GraphQL through the frontend dev proxy or same-origin gateway. - Use a real ingestion adapter wired to chain or archive sources. Do not leave placeholder, null, or demo adapters in the runtime. - Prefer event-driven projections first. Use direct on-chain queries only for initial entity bootstrap or explicit source-of-truth confirmation, and keep them out of hot event-processing paths unless the design justifies the cost. - Keep projection logic in processor or handler services. Keep the API layer thin. - Model restart, replay, backfill, and duplicate safety as first-class requirements, not as later hardening. - Prefer deterministic entity IDs derived from chain facts such as program ID, message ID, block number, extrinsic position, or explicit domain keys. - If the repo already has an indexer stack, extend it instead of replacing it with a new framework casually. - Treat PostGraphile as a v4-compatible template constraint, not as a product requirement for every indexer. The bundled API template uses the v4 bootstrap/config API (`postgraphile(...)`, `PostGraphileOptions`, `appendPlugins`), so keep `postgraphile` on the 4.x line and `postgraphile-plugin-connection-filter` on the 2.x line when copying these assets. Do not switch to v5 by changing package versions alone; update the API bootstrap and template config together. - Follow the canonical runtime order from `../../references/sails-indexer-patterns.md`, especially `Start with configuration, not hardcoded endpoints`, `Build one shared batch processor and export its derived types`, `Centralize all IDL decoding behind one decoder`, `Wire the runtime in main.ts, but do not place projection logic there`, `Give every handler the same lifecycle contract`, `Process a batch in a stable order`, `Save in groups and only write what changed`, and `Expose a thin API layer on top of PostgreSQL`. ## Route Here When - the builder needs historical views, activity feeds, portfolio pages, or timelines - the frontend needs pagination, filtering, sorting, or joins that are awkward or expensive through direct chain queries - the project needs aggregated metrics, snapshots, counters, rankings, charts, or search - the app has many dynamic child programs that cannot be enumerated upfront and whose events must be indexed - the builder needs a query API backed by projected data rather than live state reads only - the work requires event decoding from `.idl` and mapping those events into off-chain entities ## Do Not Route Here When - the task is really a command-side backend, auth service, session service, cron worker, or general Node API - the task only needs a few direct Sails queries from frontend or scripts and no persistent read model - the project is Vara.eth or ethexe-first rather than standard Gear/Vara Sails - the main problem is contract architecture, not read-side projection design - the request is purely about frontend wiring without a new read model ## Required Input Contract Before implementation, make these inputs explicit: - target programs to index: fixed IDs, discovery source, or hybrid - `.idl` files or generated decode artifacts for each indexed program - `fromBlock` or backfill start rule - list of events, services, and payloads that matter - required read entities and the UI or integration surfaces that consume them - enrichment needs: event-only, event-plus-query, or periodic derived updates - GraphQL endpoint contract: route, local development origin policy, and whether frontend reaches it through direct CORS or dev proxy - restart, replay, and cutover constraints for existing deployments If any of these are unknown, stop and write the missing assumptions explicitly before coding. Cross-check against `../../references/sails-indexer-patterns.md`: - `Start with configuration, not hardcoded endpoints`, `Build one shared batch processor and export its derived types`, and `Create a typed boundary for Gear events before touching business payloads` for config, processor boundary, and typed Gear event boundary - `Centralize all IDL decoding behind one decoder` for decoder setup and query encoding or decoding - `Keep the SQL schema read-model oriented` before freezing the SQL or ORM schema ## Quick Start Use this cold-start path when the repo does not already contain a working indexer scaffold. Templates live in `skills/sails-indexer/assets/`: - `package.json` - `tsconfig.json` - `docker-compose.yml` - `.env.example` Cold-start defaults: - Node.js 20+ - PostgreSQL available locally (prefer a local service install; Docker is an alternative if a local service is not available) - `reflect-metadata` imported once at the top of each runtime entrypoint before TypeORM entities or data source code is loaded - `experimentalDecorators: true` and `emitDecoratorMetadata: true` enabled in `tsconfig.json` - separate Subsquid gateway URL (`VARA_ARCHIVE_URL`) and Vara archive RPC URL (`VARA_RPC_URL`); Subsquid performs historical queries that require an archive node on the RPC side, so do not point `VARA_RPC_URL` at a live non-archive endpoint Suggested first-run order: 1. Copy the files from `assets/` into the new indexer repo. 2. Fill `.env` from `.env.example`. 3. Install dependencies with `npm install`. 4. Start PostgreSQL (local service, or `docker compose up -d` if using Docker). 5. Generate TypeORM entities from `schema.graphql` with `npm run codegen`. 6. Build once with `npm run build`. 7. Generate a migration with `npm run db:generate`. 8. Apply the migration with `npm run db:apply`. 9. Start the processor with `npm run dev:processor`. 10. Start the API with `npm run dev:api`. 11. Verify that `/graphql` is reachable through the chosen local access path. For schema updates, use this order: 1. update `schema.graphql` 2. `npm run codegen` 3. `npm run build` 4. `npm run db:generate` 5. `npm run db:apply` For fixed-program projects, `.env` can stay minimal with one `VARA_PROGRAM_ID` and one `VARA_IDL_PATH`. For discovery-driven projects, replace that pair with the explicit root IDs that serve as discovery sources — `REGISTRY_PROGRAM_ID`, `FACTORY_PROGRAM_ID`, or other domain-specific anchors — and keep discovery logic separate from projection
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.