graphile-postgis

Installation
SKILL.md

graphile-postgis

Use this skill when a task mentions PostGIS, spatial queries, geometry/geography columns, or "the client is pulling GeoJSON and filtering in JS". The answer is almost always declare a spatial relation and query it through the ORM where: tree — not adding a custom resolver and not sending polygons over the wire.

When to reach for this

  • "Find clinics inside a county / points inside a polygon / things near a location"
  • An agentic-DB session is shipping GeoJSON to the client to compute point-in-polygon or distance on the browser
  • A PR adds a new custom GraphQL field that takes a polygon as input and runs ST_* inline
  • You're about to write a per-pair SQL function like clinics_in_county(county_id) to paper over a missing relation

In all of those cases: add a @spatialRelation tag on the owning column (or a RelationSpatial entry in a blueprint) and use the generated where: field.

The primitive: @spatialRelation

Declared on the owning geometry/geography column. Turns into a first-class virtual relation: a new field on the owning table's generated where input that runs an EXISTS (…) subquery using a PostGIS predicate. One line of SQL, and the ORM/GraphQL schema pick it up automatically.

Tag grammar

Installs
1
GitHub Stars
46
First Seen
May 9, 2026
graphile-postgis — constructive-io/constructive