kendrick-oppong/geoskills/postgis-geospatial
Claude Code and agent skill by kendrick-oppong/geoskills
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Use for geospatial SQL workflows in PostgreSQL/PostGIS — geometry vs geography choices, indexing, SRID handling, spatial joins, migrations, and query performance tuning. Relevant when the backend stack is NestJS/Node/TypeORM/Prisma over Postgres.
Install
npx vskill@latest install kendrick-oppong/geoskills/postgis-geospatialSKILL.md
The same SKILL.md was published earlier as kendrick-oppong/geoskills/postgis-geospatial.
PostGIS
When to use this skill
- Designing or reviewing a schema with a
geometry/geographycolumn - Writing or optimizing spatial SQL (
ST_Intersects,ST_DWithin,ST_Within, spatial joins) - Debugging slow spatial queries in a production Postgres database
- Wiring PostGIS into a Node/NestJS backend (via
pg, TypeORM, Prisma, or Kysely)
Core decisions
`geometry` vs `geography`:
| geometry | geography | ||
|---|---|---|---|
| Math | Planar (Cartesian) | Spheroidal (great-circle) | |
| Speed | Faster | Slower (more expensive math) | |
| Correct for | Regional/local data with an appropriate projected CRS | Global data, or when you want correct distances without manual reprojection | |
| Default recommendation | Use geometry + a suitable projected CRS for anything scoped to a country/region | Use geography for global-scale "distance in meters between any two points on Earth" without projection juggling |
Column & naming conventions (industry-standard, keep consistent across a codebase):
- Geometry column named
geom, geography column namedgeog - Always set an explicit SRID — never leave it at 0
- Store one geometry type per table where feasible; use
GEOMETRY(generic) only when genuinely mixed
Checklist
- [ ]
GEOMETRYcolumn has an explicit SRID (geometry(Polygon, 4326), not baregeometry) - [ ] GiST index exists on every geometry/geography column used in a
WHERE/JOINpredicate - [ ] Spatial joins use the sargable operators (
&&,ST_Intersects,ST_DWithin) so the planner can use the index — avoid wrapping the geometry column in a transform inside the predicate (ST_Transform(geom, x) = ...defeats the index unless a matching expression index exists) - [ ] For "within X meters" queries on
geometrytype, reproject to a metric CRS or add a bbox pre-filter (&&) before the exact distance check - [ ] Migrations are idempotent (
CREATE EXTENSION IF NOT EXISTS postgis,IF NOT EXISTSon indexes) — critical if managed via TypeORM/Prisma migration files - [ ]
VACUUM ANALYZEafter large bulk loads so the planner has fresh statistics for spatial columns - [ ] Use
EXPLAIN (ANALYZE, BUFFERS)to confirm index usage, not just query correctness
Common pitfalls
- Prisma/TypeORM don't natively model PostGIS types: geometry columns typically need raw SQL migrations and
$queryRaw/createQueryBuilderraw fragments for spatial predicates — plan for this rather than fighting the ORM. - N+1 spatial joins: looping application-side over rows to check
ST_Intersectsper-row instead of a single indexed SQL join. - Slow `ST_DWithin` because of missing bbox pre-filter on non-indexed expressions: always let the index-friendly operator run first.
- Storing lat/lon as separate float columns "for simplicity": loses every spatial indexing and query benefit — use a real geometry/geography column even for simple point data.
- Reprojecting inside the hot query path repeatedly: reproject once at write time and store an additional column in the target CRS if a specific fast query pattern needs it.
Reference snippets
Related skills
spatial-indexing-strategy— index type/strategy fundamentalscrs-and-reprojection— SRID and datum handlinggeospatial-api-design— exposing PostGIS query results through a REST/GraphQL API
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/postgis-geospatial/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kendrick-oppong/geoskills/postgis-geospatial)