query-graph

query-graph is a skill for Claude Code, Codex from ayeshakhalid192007-dev/graph-engineering-crash-course. It costs 34 tokens per session (1,278 once invoked), scanned A, original, MIT.

A skill that loads a graph schema into a local SQLite database and answers graph questions with SQL. SQLite is a small database stored in a file.

In plain words
What is it for?
It helps query the nodes and edges tables, build the database when needed, and check relationship metadata while enforcing SQLite foreign-key rules.
Why use it?
It avoids repeatedly reasoning over the original source material and provides database-backed answers about availability and edge provenance.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ayeshakhalid192007-dev/graph-engineering-crash-course/query-graph
Any agent
npx skills add ayeshakhalid192007-dev/graph-engineering-crash-course --skill query-graph
Clone the repo
git clone --depth 1 https://github.com/ayeshakhalid192007-dev/graph-engineering-crash-course

Made for: Claude Code, Codex.

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 query-graph

README.md
[![agentmods](https://agentmods.dev/badge/skills/ayeshakhalid192007-dev/graph-engineering-crash-course/query-graph.svg)](https://agentmods.dev/skills/ayeshakhalid192007-dev/graph-engineering-crash-course/query-graph)
Your own site
<a href="https://agentmods.dev/skills/ayeshakhalid192007-dev/graph-engineering-crash-course/query-graph"><img src="https://agentmods.dev/badge/skills/ayeshakhalid192007-dev/graph-engineering-crash-course/query-graph.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,278 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00034 $0.01278
Opus 5 $0.00017 $0.00639
Sonnet 5 $0.00007 $0.00256
Haiku 4.5 $0.00003 $0.00128

Measured 4d ago against content hash cfbc8c5f7283, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

query-graph 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 4d 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.

starters/sqlite-backed-graph/.claude/skills/query-graph/SKILL.md · 116 lines

How it starts

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

query-graph

Turns schema.sql into a queryable graph.db file, then answers a question against the two tables it defines — an availability check on a tool, or a provenance lookup on a specific edge — by running SQL, not by re-reasoning over the Elm Street chat from scratch each time.

Instructions

You are a Claude Code skill implementing the sqlite-backed-graph pattern. Follow these steps in order:

  1. Load the database if it isn't already loaded. Check whether graph.db exists in this kit's root. If it doesn't, build it by running schema.sql against a fresh file: sqlite3 graph.db < schema.sql, or, if the sqlite3 CLI isn't available, the Python equivalent: python3 -c "import sqlite3; sqlite3.connect('graph.db').executescript(open('schema.sql').read())". If graph.db already exists, leave it as is rather than reloading it — this step must be safe to skip on a second run.
  2. Turn on foreign key enforcement for this connection. SQLite does not enforce REFERENCES constraints unless the connection asks for it, so every query in this skill must run PRAGMA foreign_keys = ON; first, even against an already-loaded graph.db.
  3. Resolve the question. Default to this kit's worked question if the user doesn't name one: check whether the stud finder can be borrowed right now, and confirm the ladder's status too — which means running the availability query from step 4 against both tool-ladder and tool-stud-finder.
  4. Run the availability query per tool. For a given tool id, find its most recent borrowed edge by id (edge ids climb in the same order the source messages arrived, so the highest id is the latest borrowed edge):
    SELECT id, from_id FROM edges
    WHERE label = 'borrowed' AND to_id = :tool_id
    ORDER BY id DESC LIMIT 1;
    
    If no row comes back, the tool has never left its owns edge and is available. If a row comes back, check for a matching returned edge with a higher id:
    SELECT id FROM edges
    WHERE label = 'returned' AND to_id = :tool_id AND from_id = :borrower
      AND id > :borrowed_edge_id;
    
    A match means available (the tool came back); no match means still out with :borrower. Name the specific edge id(s) that produced the verdict — never report a verdict without the row backing it.
  5. Run the provenance query on request, or on the edge that grounded step 4's verdict. For a specific edge id:
    SELECT source_doc, extraction_run_id, schema_version FROM edges
    WHERE id = :edge_id;
    
    This is the receipt-per-edge fields doing their job here: naming which source document, which extraction run, and which schema version produced the edge the verdict rests on.
  6. Write the result to output.json (or the path the user requested) in this kit's root, with this shape: queries (an array, one entry per tool or edge checked, each carrying the SQL text run and its raw result), and verdicts (one entry per tool, with tool, available, grounding_edge_id, and — if not available — held_by).
  7. Report a summary alongside the file: each tool's verdict, the edge id(s) it rests on, and that verdict's provenance (source document, run id, schema version) via step 5's lookup.

Read the full file on GitHub · 116 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. 4d ago First seen · 116 lines · 34 tokens per session scan A cfbc8c5f7283

Subscribe to this mod's changes

query-graph is a skill published in the GitHub repository ayeshakhalid192007-dev/graph-engineering-crash-course (5 stars, last pushed 9d ago), licensed MIT. It adds 34 tokens to every session and 1,278 once invoked, about $0.0002 per session on Opus 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-08-31.

Related

Other skills, from other repositories

postgres-database-migration

Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…

timescale/pg-aiguide · 222 tokens

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

design-postgis-tables

Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications.

timescale/pg-aiguide · 31 tokens

pgvector-semantic-search

Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: Store or search vector embeddings in PostgreSQL Set up semantic search, similarity search, or nearest neighbor search Create HNSW or IVFFlat indexes for vectors…

timescale/pg-aiguide · 190 tokens

find-hypertable-candidates

Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables. Trigger when user asks to: Analyze database tables for hypertable conversion potential Identify time-series or event tables in an existing schema Evaluate if a table would…

timescale/pg-aiguide · 184 tokens

postgres-hybrid-text-search

Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF). Trigger when user asks to: Combine keyword and semantic search Implement hybrid search or multi-modal retrieval Use BM25/pgtextsearch with pgvector together Implement RRF (Reciprocal…

timescale/pg-aiguide · 162 tokens