AI Skill MartBrowse skillsPromptsProgramsLearnWhat is a Skill?
← Back to list

PostGIS Spatial Table Design

A reference skill that guides Claude to design PostGIS tables with the right geometry types, SRIDs, and spatial indexes.

Dev & CodingIntermediate★ 1,885⑂ 119AI score 8/10Last updated: Nov 8, 2026

What it does

  • Decides GEOMETRY vs GEOGRAPHY with a side-by-side table (units, accuracy, function coverage, performance, index support).
  • Enforces SRID discipline: store in 4326, transform to UTM for measurements, never mix SRIDs, add CHECK constraints.
  • Spatial index selection: GiST by default, BRIN for very large append-only GEOMETRY tables, SP-GiST for point-only data.
  • Ready-to-adapt schemas for POIs, property parcels, GPS tracking, and service/coverage zones.
  • Performance patterns: prefer ST_DWithin over ST_Distance, && bounding-box pre-filtering, generated columns instead of functions on indexed columns, geometry simplification for display.
  • Validation guardrails: ST_IsValid/ST_MakeValid, coordinate-range checks, and a reminder to parameterize SQL.

Who it's for

  • Backend engineers building location features (store finder, delivery zones, fleet tracking) on PostgreSQL + PostGIS.
  • Data engineers tuning slow spatial queries or oversized indexes.
  • Teams new to GIS data who keep tripping over (lon, lat) ordering and SRID mismatches.

Example uses

  1. "Design a table for a 'restaurants within 1 km' endpoint" → GEOGRAPHY(POINT,4326) + GiST index + ST_DWithin query.
  2. "I need parcel area in square meters" → generated column using ST_Area(boundary::GEOGRAPHY) or a UTM transform workflow.
  3. "My 100M-row GPS table has a huge GiST index" → BRIN with pages_per_range plus the accuracy trade-offs.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/timescale/pg-aiguide/HEAD/skills/design-postgis-tables/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
↓ Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on AI Skill Mart.
Copy the skills/design-postgis-tables folder from the GitHub repo timescale/pg-aiguide into my ~/.claude/skills/design-postgis-tables/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/timescale/pg-aiguide.git && mkdir -p ~/.claude/skills && cp -r pg-aiguide/skills/design-postgis-tables ~/.claude/skills/

⚠ This is a third-party skill. Check the source repository before installing.

  1. Open a terminal.
  2. Clone the repository: git clone https://github.com/timescale/pg-aiguide.git
  3. Create the skills folder: mkdir -p ~/.claude/skills
  4. Copy the skill in: cp -r pg-aiguide/skills/design-postgis-tables ~/.claude/skills/
  5. Restart Claude Code and ask something like "help me design PostGIS tables for GPS tracking".
  6. Before applying the SQL, confirm your database is PostgreSQL 15+ and that you have run CREATE EXTENSION postgis;.
View source on GitHub ↗License: Apache-2.0