boxel: Skill for Claude Code

.claude/skills/index-query-engine/SKILL.md

index-query-engine is a skill for Claude Code from cardstack/boxel. It costs 135 tokens per session (3,966 once invoked), scanned A, original, MIT.

An explanation of the query engine that turns filter, sort, and page requests into SQL for PostgreSQL and SQLite databases. It covers the two-stage process that resolves card fields before building the final query.

In plain words
What is it for?
Use it when changing query filtering, sorting, pagination, field traversal, or SQL generation for PostgreSQL and SQLite.
Why use it?
Changes to the engine must produce equivalent results in two databases with different SQL features. The guide records the constraints and invariants that keep generated queries compatible.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

This is cardstack/boxel's own configuration. It tells Claude Code how to work on boxel itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything boxel configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cardstack/boxel. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cardstack/boxel/main/.claude/skills/index-query-engine/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/cardstack/boxel

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for index-query-engine

README.md
[![agentmods](https://agentmods.dev/badge/skills/cardstack/boxel/index-query-engine/github.svg)](https://agentmods.dev/skills/cardstack/boxel/index-query-engine)
Your own site
<a href="https://agentmods.dev/skills/cardstack/boxel/index-query-engine"><img src="https://agentmods.dev/badge/skills/cardstack/boxel/index-query-engine/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for index-query-engine

Your own site · 80×15
<a href="https://agentmods.dev/skills/cardstack/boxel/index-query-engine"><img src="https://agentmods.dev/badge/skills/cardstack/boxel/index-query-engine.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 135 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,966 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00135 $0.03966
Opus 5.5 $0.00054 $0.01586
Sonnet 5.5 $0.00027 $0.00793
Haiku 4.5 $0.00014 $0.00397

Measured 5d ago against content hash b65d64751667, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

index-query-engine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/index-query-engine/SKILL.md · 275 lines

How it starts

The opening of the file, as written. The whole thing — 275 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Index query engine — architecture

The engine (packages/runtime-common/index-query-engine.ts) ingests a Query (filter tree + sort + page, defined in query.ts) and compiles it to one SQL statement that must run identically on Postgres and SQLite. Everything about its design follows from two constraints:

  1. Field semantics live in card definitions, which resolve asynchronously (DefinitionLookup — a cache read, or a module prerender on a miss). SQL can't be produced until the schema walk happens.
  2. SQLite is the floor. No arrays, no unnest, no @> containment, no ANY_VALUE, single-expression COUNT(DISTINCT …). Plural (containsMany / linksToMany) traversal therefore uses json_tree() — the lowest common denominator — and Postgres mirrors it with a custom jsonb_tree() function so one generated query shape serves both.

The pipeline

Query (filter tree)
  │  filterCondition()            stage 0 — sync tree expansion
  ▼
CardExpression                    tokens + DEFERRED schema-dependent nodes
  │  makeExpression()             pass 1 — async, definition-driven
  ▼
Expression                        only strings, params, resolved nodes
  │  expressionToSql()            pass 2 — mechanical rendering (expression.ts)
  ▼
SQL text + binds  ──sqlite──▶  SqliteAdapter.adjustSQL() text rewrites

Stage 0 (filterCondition and the per-operator builders) converts the filter tree into a CardExpression: a flat token array of SQL strings, param() bind markers, and deferred nodes. This is where a predicate is separated into left side / operator / right side:

  • left = fieldQuery(path, onRef, …) — the dotted field path, to become a JSON accessor;
  • operator = a literal (=, IS NULL, ILIKE, IN (…), range operators);
  • right = fieldValue(path, [param(v)], onRef, …) — deferred so the leaf field's serializer can format the bind (formatQuery);
  • the whole predicate wraps in fieldArity({ type, path, value, … }), which defers the plural-vs-singular decision.

Read the full file on GitHub · 275 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 275 lines · 135 tokens per session scan A b65d64751667

Subscribe to this mod's changes

index-query-engine is a skill published in the GitHub repository cardstack/boxel (27 stars, last pushed today), licensed MIT. It adds 135 tokens to every session and 3,966 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-21.

Related

Other skills, from other repositories

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

db-repair

Auto-fix gbrain's Postgres access so the brain stays available. When any gbrain command or MCP tool result carries a GBRAINDBACCESS marker (or an operator reports the brain database is down), run the hardcoded gbrain db-repair ladder: diagnose, apply the safe tier, verify. The action is ALWAYS the hardcoded command …

garrytan/gbrain · 96 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 246 tokens

polar-local-environment

This skill should be used when setting up or managing Polar local development environment with Docker.

fcakyon/claude-codex-settings · 22 tokens