Skip to main content
skill CX Codex

shapely-compute — Claude Code skill: what it does, how to install

Runs computational geometry with Shapely: builds shapes, checks spatial predicates, and measures areas directly from your coding agent.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add parcadei/Continuous-Claude-v3 --skill shapely-compute -a claude-code
Open on GitHub

What shapely-compute does

This skill gives your agent a dedicated CLI toolset for 2D computational geometry powered by Shapely. It creates points, lines, and polygons from raw coordinates or WKT strings. The tool handles boolean operations like intersections and unions, evaluates spatial predicates such as contains or within, and extracts centroids or bounding boxes.

Each operation runs via uv run python scripts/shapely_compute.py. You need the uv runner and the local Python script present in your project. Without this setup, commands will fail. If invalid shapes with self-intersections occur, the makevalid command repairs the geometry automatically.

What it helps with

  • Calculate intersections or differences between geometric shapes
  • Check whether a point lies within a polygon boundary
  • Measure polygon areas, perimeters, and centroids
  • Repair self-intersecting or invalid geometries using makevalid

Example prompts for the agent

  • Calculate the area of a polygon with coords 0,0 1,0 1,1 0,1 using shapely-compute
  • Check if this point is inside the polygon using shapely-compute predicates
  • Fix self-intersections in this geometry using makevalid

How to install shapely-compute

1Skills CLI (Vercel)

npx skills add parcadei/Continuous-Claude-v3 --skill shapely-compute -a claude-code

2Manually: put the files in place

~/.claude/skills/shapely-compute/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/shapely-compute/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about shapely-compute

How to install shapely-compute in Claude Code?

Run npx skills add parcadei/Continuous-Claude-v3 --skill shapely-compute -a claude-code.

What does shapely-compute do?

It lets the agent run 2D geometry operations, including shape creation, spatial predicates, boolean logic, and affine transformations.

What dependencies are required to run this skill?

You need Python, the uv tool installed, and the scripts/shapely_compute.py script located in your project.

Source text

SKILL.md · MIT
---
name: shapely-compute
description: Computational geometry with Shapely - create geometries, boolean operations, measurements, predicates
triggers: ["geometry", "polygon", "intersection", "area", "contains", "distance between points", "buffer", "convex hull", "centroid", "WKT"]
---

# Computational Geometry with Shapely

## When to Use
- Creating geometric shapes (points, lines, polygons)
- Boolean operations (intersection, union, difference)
- Spatial predicates (contains, intersects, within)
- Measurements (area, length, distance, centroid)
- Geometry transformations (translate, rotate, scale)
- Validating and fixing invalid geometries

## Quick Reference

| I want to... | Command | Example |
|--------------|---------|---------|
| Create geometry | `create` | `create polygon --coords "0,0 1,0 1,1 0,1"` |
| Intersection | `op intersection` | `op intersection --g1 "POLYGON(...)" --g2 "POLYGON(...)"` |
| Check contains | `pred contains` | `pred contains --g1 "POLYGON(...)" --g2 "POINT(0.5 0.5)"` |
| Calculate area | `measure area` | `measure area --geom "POLYGON(...)"` |
| Distance | `distance` | `distance --g1 "POINT(0 0)" --g2 "POINT(3 4)"` |
| Transform | `transform translate` | `transform translate --geom "..." --params "1,2"` |
| Validate | `validate` | `validate --geom "POLYGON(...)"` |

## Commands

### create
Create geometric objects from coordinates.
```bash
# Point
uv run python scripts/shapely_compute.py create point --coords "1,2"

# Line (2+ points)
uv run python scripts/shapely_compute.py create line --coords "0,0 1,1 2,0"

# Polygon (3+ points, auto-closes)
uv run python scripts/shapely_compute.py create polygon --coords "0,0 1,0 1,1 0,1"

# Polygon with hole
uv run python scripts/shapely_compute.py create polygon --coords "0,0 10,0 10,10 0,10" --holes "2,2 8,2 8,8 2,8"

# MultiPoint
uv run python scripts/shapely_compute.py create multipoint --coords "0,0 1,1 2,2"

# MultiLineString (pipe-separated lines)
uv run python scripts/shapely_compute.py create multilinestring --coords "0,0 1,1|2,2 3,3"

# MultiPolygon (pipe-separated polygons)
uv run python scripts/shapely_compute.py create multipolygon --coords "0,0 1,0 1,1 0,1|2,2 3,2 3,3 2,3"
```

### op (operations)
Boolean geometry operations.
```bash
# Intersection of two polygons
uv run python scripts/shapely_compute.py op intersection \
    --g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
    --g2 "POLYGON((1 1,3 1,3 3,1 3,1 1))"

# Union
uv run python scripts/shapely_compute.py op union --g1 "POLYGON(...)" --g2 "POLYGON(...)"

# Difference (g1 - g2)
uv run python scripts/shapely_compute.py op difference --g1 "POLYGON(...)" --g2 "POLYGON(...)"

# Symmetric difference (XOR)
uv run python scripts/shapely_compute.py op symmetric_difference --g1 "..." --g2 "..."

# Buffer (expand/erode)
uv run python scripts/shapely_compute.py op buffer --g1 "POINT(0 0)" --g2 "1.5"

# Convex hull
uv run python scripts/shapely_compute.py op convex_hull --g1 "MULTIPOINT((0 0),(1 1),(0 2),(2 0))"

# Envelope (bounding box)
uv run python scripts/shapely_compute.py op envelope --g1 "POLYGON(...)"

# Simplify (reduce points)
uv run python scripts/shapely_compute.py op simplify --g1 "LINESTRING(...)" --g2 "0.5"
```

### pred (predicates)
Spatial relationship tests (returns boolean).
```bash
# Does polygon contain point?
uv run python scripts/shapely_compute.py pred contains \
    --g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
    --g2 "POINT(1 1)"

# Do geometries intersect?
uv run python scripts/shapely_compute.py pred intersects --g1 "..." --g2 "..."

# Is g1 within g2?
uv run python scripts/shapely_compute.py pred within --g1 "POINT(1 1)" --g2 "POLYGON(...)"

# Do geometries touch (share boundary)?
uv run python scripts/shapely_compute.py pred touches --g1 "..." --g2 "..."

# Do geometries cross?
uv run python scripts/shapely_compute.py pred crosses --g1 "LINESTRING(...)" --g2 "LINESTRING(...)"

# Are geometries disjoint (no intersection)?
uv run python scripts/shapely_compute.py pred disjoint --g1 "..." --g2 "..."

# Do geometries overlap?
uv run python scripts/shapely_compute.py pred overlaps --g1 "..." --g2 "..."

# Are geometries equal?
uv run python scripts/shapely_compute.py pred equals --g1 "..." --g2 "..."

# Does g1 cover g2?
uv run python scripts/shapely_compute.py pred covers --g1 "..." --g2 "..."

# Is g1 covered by g2?
uv run python scripts/shapely_compute.py pred covered_by --g1 "..." --g2 "..."
```

### measure
Geometric measurements.
```bash
# Area (polygons)
uv run python scripts/shapely_compute.py measure area --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"

# Length (lines, polygon perimeter)
uv run python scripts/shapely_compute.py measure length --geom "LINESTRING(0 0,3 4)"

# Centroid
uv run python scripts/shapely_compute.py measure centroid --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"

# Bounds (minx, miny, maxx, maxy)
uv run python scripts/shapely_compute.py measure bounds --geom "POLYGON(...)"

# Exterior ring (polygon only)
uv run python scripts/shapely_compute.py measure exterior_ring --geom "POLYGON(...)"

# All measurements at once
uv run python scripts/shapely_compute.py measure all --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"
```

### distance
Distance between geometries.
```bash
uv run python scripts/shapely_compute.py distance --g1 "POINT(0 0)" --g2 "POINT(3 4)"
# Returns: {"distance": 5.0, "g1_type": "Point", "g2_type": "Point"}
```

### transform
Affine transformations.
```bash
# Translate (move)
uv run python scripts/shapely_compute.py transform translate \
    --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "5,10"
# params: dx,dy or dx,dy,dz

# Rotate (degrees, around centroid by default)
uv run python scripts/shapely_compute.py transform rotate \
    --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "45"
# params: angle or angle,origin_x,origin_y

# Scale (from centroid by default)
uv run python scripts/shapely_compute.py transform scale \
    --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "2,2"
# params: sx,sy or sx,sy,origin_x,origin_y

# Skew
uv run python scripts/shapely_compute.py transform skew \
    --geom "POLYGON(...)" --params "15,0"
# params: xs,ys (degrees)
```

### validate / makevalid
Check and fix geometry validity.
```bash
# Check if valid
uv run python scripts/shapely_compute.py validate --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"is_valid": true, "type": "Polygon", ...}

# Fix invalid geometry (self-intersecting, etc.)
uv run python scripts/shapely_compute.py makevalid --geom "POLYGON((0 0,2 2,2 0,0 2,0 0))"
```

### coords
Extract coordinates from geometry.
```bash
uv run python scripts/shapely_compute.py coords --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"coords": [[0,0],[1,0],[1,1],[0,1],[0,0]], "type": "Polygon"}
```

### fromwkt
Parse WKT and get geometry information.
```bash
uv run python scripts/shapely_compute.py fromwkt "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"type": "Polygon", "bounds": [...], "area": 1.0, ...}
```

## Geometry Types
- `point` - Single coordinate (x, y) or (x, y, z)
- `line`/`linestring` - Sequence of connected points
- `polygon` - Closed shape with optional holes
- `multipoint`, `multilinestring`, `multipolygon` - Collections

## Input Formats
- **Coordinates string**: `"0,0 1,0 1,1 0,1"` (space-separated x,y pairs)
- **WKT**: `"POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"`

## Output Format
All commands return JSON with:
- `wkt`: WKT representation of result geometry
- `type`: Geometry type (Point, LineString, Polygon, etc.)
- `bounds`: (minx, miny, maxx, maxy)
- `is_valid`, `is_empty`: Validity flags
- Measurement-specific fields (area, length, distance, etc.)

## Common Use Cases

| Use Case | Command |
|----------|---------|
| Collision detection | `pred intersects` |
| Point-in-polygon | `pred contains` |
| Area calculation | `measure area` |
| Buffer zones | `op buffer` |
| Shape combination | `op union` |
| Shape subtraction | `op difference` |
| Bounding box | `op envelope` or `measure bounds` |
| Simplify path | `op simplify` |

## Related Skills
- `/math-mode` - Full math orchestration (SymPy, Z3)
- `/math-plot` - Visualization with matplotlib

© parcadei · MIT · parcadei/Continuous-Claude-v3

Similar skills

All skills for Data and databases →

From the same set77

commit This skill turns session changes into git commits, shows you the plan first, and keeps Claude's name out of the messages. Handy when an agent has piled up edits. CX Codex +1 499installs implement_plan Takes an approved plan from thoughts/shared/plans/, works through its phases one by one and checks each against the plan's success criteria. Handy once the design is settled and code is next. CX Codex +1 498installs braintrust-tracing This skill explains how Claude Code sessions are traced in Braintrust and how to investigate sub-agent traces. Use it when hook events or spans need debugging. CX Codex +1 495installs workflow-router Picks the right specialist agent for your goal — research, planning, building or debugging — and allocates resources. Useful when you don't know where to start. CX Codex +1 495installs recall Pulls learnings from past sessions out of the memory system: patterns, errors, installs. Useful when the agent retraces ground you already covered. CX Codex +1 493installs math-router The skill maps a math request to an exact CLI command and returns it as JSON. Useful when the agent needs to integrate, prove or plot something. CX Codex +1 493installs help Interactive workspace discovery for Continuous-Claude-v3. Guides you to the right workflows, specialized agents, hooks, and CLI tools. CX Codex +1 491installs firecrawl-scrape This skill fetches page content and search results through Firecrawl MCP. Use it to extract web content as Markdown, HTML, or plain text. CX Codex +1 490installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor