kendrick-oppong/geoskills/geospatial-api-design

Claude Code and agent skill by kendrick-oppong/geoskills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when designing a REST or GraphQL API that serves geospatial data — bbox/geometry query parameters, GeoJSON response conventions, pagination of spatial results, filtering by distance/area, and structuring endpoints in a NestJS backend.

Install

npx vskill@latest install kendrick-oppong/geoskills/geospatial-api-design

SKILL.md

The same SKILL.md was published earlier as kendrick-oppong/geoskills/geospatial-api-design.

Geospatial API Design

When to use this skill

  • Designing endpoints for a NestJS/Express backend that return or accept geometry
  • "How should bbox filtering / nearby search work as a query parameter"
  • Deciding GeoJSON vs a custom response shape for API consumers

Core conventions (principal-level defaults)

  • Response format: return GeoJSON (FeatureCollection/Feature) for anything a frontend map will consume directly — it's a widely-understood standard every map library ingests natively, rather than a bespoke schema requiring a translation layer.
  • CRS assumption: GeoJSON is WGS84 lon/lat by spec — don't silently return a different CRS; if a projected CRS is genuinely needed by a consumer, make it an explicit, documented parameter/alternate endpoint, not a surprise.
  • Bounding box parameter convention: bbox=minLon,minLat,maxLon,maxLat (matches OGC API - Features convention) rather than inventing a custom shape — consumers and tooling already expect this order.
  • Pagination for large spatial result sets: cursor-based or limit/offset — never return an unbounded feature collection; cap response size and document the cap.
  • Distance/radius search: accept a center point + radius in meters (not degrees) as explicit parameters (lat, lon, radiusMeters) — avoids the degrees-vs-meters ambiguity trap from crs-and-reprojection.
  • Geometry simplification for list/overview endpoints: consider returning simplified geometry (or just centroids) for endpoints used to populate a low-zoom overview, with a separate "detail" endpoint returning full-precision geometry — mirrors the zoom-aware tiling principle even outside a tile pipeline.

Checklist

  • [ ] Every geometry-bearing response documents its CRS explicitly (default: WGS84/EPSG:4326) even if it's "obviously" GeoJSON
  • [ ] bbox/radius query params validated server-side (reject nonsensical bbox where min > max, reject radius beyond a sane cap) before hitting the database
  • [ ] Spatial queries are backed by an actual spatial index (spatial-indexing-strategy/postgis-geospatial) — an API contract that implies "fast nearby search" needs the database layer to actually support it
  • [ ] Large polygon/line geometries have a size guard — a single request shouldn't be able to return an unbounded multi-megabyte geometry blob without pagination or simplification
  • [ ], For GraphQL: geometry fields are typed explicitly (e.g., a custom GeoJSON scalar) rather than an untyped JSON blob, so client codegen produces useful types
  • [ ] Errors distinguish "invalid geometry/parameters" (400) from "not found" (404) from "query too broad, refine bbox/filters" (413/422) — geospatial APIs benefit from an explicit "too broad a query" error class since spatial queries can accidentally request enormous result sets
  • [ ] Versioning/documentation (OpenAPI/Swagger in NestJS via @nestjs/swagger) includes concrete bbox/geometry examples, since these parameter shapes aren't self-evident from a generic REST doc

Common pitfalls

  • Returning raw database geometry types (WKB hex strings) instead of GeoJSON: forces every consumer to parse WKB — do the ST_AsGeoJSON conversion server-side.
  • Unbounded bbox queries: an endpoint accepting an arbitrary bbox without a maximum-area guard can be trivially abused to request "the entire planet" and return an enormous payload — cap bbox area or feature count.
  • Mixing degrees and meters in the same parameter name: e.g. a radius param that's sometimes degrees, sometimes meters depending on internal implementation — always name and document units explicitly (radiusMeters).
  • No caching layer for expensive spatial aggregations: repeated identical bbox+filter combinations (e.g., a dashboard reloading the same viewport) hitting the database every time instead of a short-TTL cache.

Reference snippets

typescript
// NestJS controller — bbox + validated params
@Get('features')
async getFeatures(
@Query('bbox', new ParseBboxPipe()) bbox: [number, number, number, number],
@Query('limit', new DefaultValuePipe(500), ParseIntPipe) limit: number,
) {
if (limit > 2000) throw new BadRequestException('limit exceeds maximum of 2000');
const features = await this.featuresService.findInBbox(bbox, limit);
return { type: 'FeatureCollection', features }; // GeoJSON convention
}

Related skills

  • postgis-geospatial — the query layer backing these endpoints
  • crs-and-reprojection — units/CRS discipline referenced throughout
  • ogc-services-and-interop — the standardized alternative (OGC API - Features) to a fully custom 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kendrick-oppong/geoskills/geospatial-api-design/badge)](https://verified-skill.com/skills/kendrick-oppong/geoskills/geospatial-api-design)

Something wrong with this skill or its page? Tell us.