Validate geometry
Skill buildmoonshot/skillpacks/skills/gis/beginner/validate-geometry
A beginner-to-expert curriculum of drop-in skills for Claude Code, Codex, and any coding agent. Copy-paste ready, tested, not a link farm.
npx -y skills add buildmoonshot/skillpacks --skill validate-geometryAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use before running spatial operations — joins, overlays, buffers, dissolves, area or length calculations — on vector data, especially data from an external or non-GIS source. Makes the agent check for invalid geometries and repair them deliberately first, instead of letting them silently corrupt the result or crash the operation.
SKILL.md
2.0 KB, as published. Nobody here has run it
Validate Geometry
Invalid geometries are the second great source of silent GIS errors. Before spatial operations, check validity and repair deliberately.
What to check
Before an overlay, join, buffer, or dissolve, verify the geometries are valid and clean:
- Validity — self-intersections ("bowties"), unclosed rings, wrong ring orientation. Use
ST_IsValid(PostGIS),.is_valid(Shapely/GeoPandas),Check Geometry(ArcPy), orogrinfo(GDAL). - Empties and nulls — null or empty geometries that will break joins or produce surprising results.
- Geometry-type consistency — mixed single/multi, or polygons and lines living in one layer.
- Duplicate vertices and slivers that throw off topology.
Repair deliberately, not blindly
- Use the right repair tool:
ST_MakeValid(PostGIS),make_valid()(Shapely — and know the olderbuffer(0)trick can silently drop slivers),Repair Geometry(ArcPy),ogr2ogr -makevalid(GDAL). - Understand what the repair changed. Repair can split a feature, drop a sliver, or turn a polygon into a multipolygon. Report it — "repaired 14 self-intersecting polygons; 2 became multipolygons" — instead of silently mutating the data.
- Repair a copy, or clearly flag the change. Don't quietly overwrite the source.
Why this matters
An invalid polygon doesn't announce itself. It makes an intersection return empty, a dissolve leak across boundaries, or an area come back negative — output that looks valid and passes review on its way to the map. Checking validity before the operation turns a silent wrong answer into either a clean result or an explicit "here's what I had to fix."