---
name: "shapely-geometric-predicates-union"
description: "Construct, manipulate, and validate planar 2D geometries using high-performance Shapely 2.0."
metadata:
  author: "Shapely"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "shapely buffer polygon"
  - "check polygon intersection shapely"
  - "use shapely strtree"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Shapely Vector Geometry & Topological Predicates

Manipulates geometric objects with Shapely: creating Points, LineStrings, and Polygons, computing topological predicates (contains, intersects, touches), buffering geometries, and accelerating operations with STRtree.

## When to Invoke
Invoke this skill whenever you need to:
- shapely buffer polygon
- check polygon intersection shapely
- use shapely strtree

## Execution SOP & Rules
1. Import geometry primitives: from shapely.geometry import Point, Polygon, LineString.
2. Repair topology: clean_poly = shapely.make_valid(raw_polygon) to eliminate self-intersections.
3. Create spatial index: tree = shapely.STRtree(polygons_list) for high-speed spatial querying.
4. Query spatial relationships: matching_indices = tree.query(search_geom, predicate='intersects').

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
