spatial

spatial is a skill for Claude Code from duckdb/duckdb-skills. It costs 115 tokens per session (1,013 once invoked), scanned A, original, MIT.

A tool for answering questions about locations and geographic data with DuckDB, a database that can analyze files and tables. It works with coordinates, distances, boundaries, maps, and formats such as GeoJSON and Shapefile.

In plain words
What is it for?
Use it to find places near other places, measure distances, check which points are inside areas, analyze map files, find hotspots, count buildings or roads, and convert geographic data between formats.
Why use it?
It removes the need to work out spatial database queries or find geographic datasets from scratch. It can use your files or Overture Maps, a free global source of map data.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the duckdb-skills plugin — 9 skills shipped together

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/duckdb/duckdb-skills/spatial
Any agent
npx skills add duckdb/duckdb-skills --skill spatial
Clone the repo
git clone --depth 1 https://github.com/duckdb/duckdb-skills

Made for: Claude Code.

Or install duckdb-skills, the plugin that ships this one along with the rest of its 9 skills.

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 spatial

README.md
[![agentmods](https://agentmods.dev/badge/skills/duckdb/duckdb-skills/spatial.svg)](https://agentmods.dev/skills/duckdb/duckdb-skills/spatial)
Your own site
<a href="https://agentmods.dev/skills/duckdb/duckdb-skills/spatial"><img src="https://agentmods.dev/badge/skills/duckdb/duckdb-skills/spatial.svg" alt="Measured on agentmods" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,013 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.1 $0.00115 $0.01013
Opus 5 $0.00057 $0.00507
Sonnet 5 $0.00023 $0.00203
Haiku 4.5 $0.00012 $0.00101

Measured 6d ago against content hash b016c8355524, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

spatial 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 6d 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.

skills/spatial/SKILL.md · 84 lines

How it starts

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

You are answering spatial questions using DuckDB's spatial extension and, when needed, Overture Maps as a free global data source.

Question or file: $0 Additional context: ${1:-}

Step 1 — Understand what the user needs

Classify the question:

Pattern Data source Key functions
"Find X near Y" (no user file) Overture Maps on S3 ST_Distance_Spheroid, bbox filtering
"How far between A and B" Geocode or user data ST_Distance_Spheroid
"Which points fall inside polygons" User files ST_Contains
"Analyze this GeoJSON/Shapefile/GPX" User file ST_Read, measurement functions
"Show density/hotspots" User or Overture data H3 hex binning
"Convert to GeoJSON/GeoPackage" User file COPY TO (FORMAT GDAL)
"Count buildings/roads in area" Overture Maps bbox filtering + aggregation

If the question involves real-world places, POIs, buildings, roads, or boundaries and the user hasn't provided a file, use Overture Maps — read references/overture.md for S3 paths and schema.

For spatial function syntax, read references/functions.md.

Step 2 — Write and run the query

Always start with:

LOAD spatial;
SET geometry_always_xy = true;

Add extensions as needed:

  • Overture/remote data: LOAD httpfs; CREATE SECRET (TYPE S3, PROVIDER config, REGION 'us-west-2');
  • H3 hex binning: INSTALL h3 FROM community; LOAD h3;

Key principles

bbox filtering first — When querying Overture, always filter on bbox.xmin/xmax/ymin/ymax before any spatial function. This uses Parquet predicate pushdown and avoids downloading the full dataset.

Always set geometry_always_xy = true — This ensures all spatial functions interpret coordinates as longitude, latitude (the standard for Overture, GeoJSON, and most data sources). Without it, spheroid functions assume latitude first and return wrong results.

Use spheroid functions for real-world distancesST_Distance_Spheroid returns meters on the WGS84 ellipsoid. Plain ST_Distance uses planar coordinates and gives meaningless results for lat/lng. Important: spheroid functions (ST_Distance_Spheroid, ST_Area_Spheroid, etc.) require POINT_2D inputs, not generic GEOMETRY. Overture geometry columns are typed GEOMETRY('OGC:CRS84') and cannot be cast directly. Extract coordinates first:

ST_Point(ST_X(geometry), ST_Y(geometry))::POINT_2D

Read the full file on GitHub · 84 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 84 lines · 115 tokens per session scan A b016c8355524

Subscribe to this mod's changes

spatial is a skill published in the GitHub repository duckdb/duckdb-skills (538 stars, last pushed 4mo ago), licensed MIT. It adds 115 tokens to every session and 1,013 once invoked, about $0.0006 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-30.

Related

Other skills, from other repositories

lamindb

Use when working with LaminDB, the open-source lineage-native lakehouse for biological datasets and models. Covers setup, artifact registration, query/search, lineage tracking, validation, ontology-backed annotation with Bionty, collections, branches, storage, and workflow integrations.

K-Dense-AI/scientific-agent-skills · 56 tokens

tiledbvcf

Efficient storage and retrieval of genomic variant data using TileDB. Scalable VCF/BCF ingestion, incremental sample addition, compressed storage, parallel queries, and export capabilities for population genomics.

K-Dense-AI/scientific-agent-skills · 46 tokens

defining-cohort-phenotypes

Authors computable phenotype and cohort definitions in the OHDSI ATLAS / CIRCE style over the OMOP CDM, combining standard concept sets with NLP-derived features that OpenMed extracts. Use when the user wants to define a patient cohort, write a computable phenotype, reuse PheKB or OHDSI Phenotype Library logic, build…

maziyarpanahi/openmed · 191 tokens

benchling-integration

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

synthetic-sciences/openscience · 44 tokens

chembl-database

Query the ChEMBL database for bioactive molecules, drug targets, bioactivity data, approved drugs, and chemical structures. Use when the user asks about compounds, targets, IC50/Ki values, drug mechanisms, or structure searches.

google-deepmind/science-skills · 53 tokens

nvalchemi-data-storage

How to write, read, compose, and load atomic data using nvalchemi's composable Zarr-backed storage pipeline (Writer, Reader, Dataset, MultiDataset, DataLoader). Use when saving simulation outputs or trajectories to disk, converting structures (e.g. ASE / extxyz) into Zarr stores, assembling datasets for training or…

NVIDIA/nvalchemi-toolkit · 90 tokens