Skip to content

Add mapbox-cli-geospatial-patterns skill - #79

Open
mattpodwysocki wants to merge 2 commits into
mainfrom
add-mapbox-cli-geospatial-patterns-skill
Open

mattpodwysocki wants to merge 2 commits into
mainfrom
add-mapbox-cli-geospatial-patterns-skill

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

What

Adds a new skill, mapbox-cli-geospatial-patterns, teaching an agent how to
chain the mapbox CLI's JSON output with local Turf.js scripts over a shell
pipe. mapbox-geospatial-operations already covers this same offline-vs-
routing decision framework, but for MCP tool calls; this is for the case
that skill doesn't reach, no MCP server available, just the CLI binary and
a shell (a script, a CI job, an agent without MCP access).

What's in it

  • scripts/: six small @turf/turf helpers (buffer, distance,
    points-within-polygon, nearest-point, centroid, length), each reading
    GeoJSON from stdin and writing GeoJSON or a number to stdout. Real
    package.json/package-lock.json, npm install once and they run.
  • Five worked scenarios in SKILL.md, each actually run end to end against
    a real build of the CLI and real Mapbox responses before being written
    down, not just plausible-looking snippets:
    • store-locator containment (isochrone + search category +
      points-within-polygon)
    • pre-filtering many candidates by straight-line distance before an
      expensive matrix call
    • search-along-route corridors (directions + buffer +
      points-within-polygon)
    • trip length after cleaning a GPS trace (map-matching + length)
    • reverse-geocoding an area's centroid (centroid + geocoder reverse)
  • Calls out turf-cli on npm by name as a trap: last published years ago
    against Turf 2.x, incompatible with the current @turf/turf 7.x these
    scripts use. Verified this directly (npm view turf-cli / @turf/turf)
    before writing the warning, not just going on reputation.

Verification

npm run check passes (format, spellcheck, markdown lint, skills
validation), and the pre-push hook ran all four again before this pushed.

Every command shown in the skill was actually run against a real mapbox
build first: geocoder forward/reverse, search category, isochrone,
directions, and map-matching (the last three from their own not-yet-merged
feature branches, since that's the CLI's near-term shape). The full
store-locator pipeline (isochrone → search → points-within-polygon) and the
directions→buffer and map-matching→length pipelines were each run for real,
not assumed from documentation.

Not checked: the eval suite (evals/evals.json, 4 evals) is structurally
valid and passed validate:skills, but I couldn't get a real delta measurement
in this environment. The ANTHROPIC_API_KEY available here returned a 401 for
direct API calls. Worth running npm run eval mapbox-cli-geospatial-patterns
with a working key before merging, to confirm the +20pp target this repo asks
for.

🤖 Generated with Claude Code

Teaches an agent to chain the mapbox CLI's JSON output with local
Turf.js scripts over a shell pipe, for the case mapbox-geospatial-operations
doesn't cover: no MCP server available, just the CLI and a shell.

- scripts/ ships six small, tested Turf.js helpers (buffer, distance,
  points-within-polygon, nearest-point, centroid, length), each reading
  GeoJSON from stdin and writing GeoJSON or a number to stdout
- Five worked scenarios, each verified end to end against a real build
  of the CLI and real Mapbox responses, not just plausible-looking
  examples: store-locator containment, matrix pre-filtering by straight-
  line distance, search-along-route corridors, GPS trace length after
  map matching, and reverse-geocoding an area's centroid
- Calls out turf-cli (npm) by name as a trap: it's a stale,
  single-maintainer package built against Turf 2.x, incompatible with
  the current @turf/turf 7.x the scripts here actually use
- Cross-references mapbox-geospatial-operations for the shared
  tool-choice framework rather than duplicating it

Structural validation, formatting, spellcheck and markdown lint all
pass (npm run check). The eval suite is written (4 evals, targeting the
CLI/shell-specific angle rather than repeating the existing MCP-tool
skill's scenarios) but could not be run end to end in this environment:
the available ANTHROPIC_API_KEY isn't valid for direct API calls here,
so the delta this skill produces is not yet measured.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mattpodwysocki
mattpodwysocki requested a review from a team as a code owner September 28, 2026 15:02
mapbox-maps-flutter restructured into a monorepo (mapbox_maps_flutter,
mapbox_maps_flutter_mobile, etc.); the example app moved from the repo
root to mapbox_maps_flutter/example, and the old /tree/main/example URL
now 404s. Caught by this PR's own link-check CI run, unrelated to the
new skill it's otherwise adding. Verified the new URL resolves (200)
before committing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zmofei

zmofei commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Thanks for this! isochrone, directions, map-matching and matrix are still in open PRs (mapbox/mapbox-cli#43, mapbox/mapbox-cli#44, mapbox/mapbox-cli#45, mapbox/mapbox-cli#48) and their shapes may still change, so could we move this to draft until they're released? A few things to fix in the meantime:

  • Scenario 1: the jq step strips the search results to coordinates, so the output has no store names. Passing the features through keeps them.
  • Scenario 2: straight-line distance can drop a true top-20 result (water, highways), and matrix ranks by time. Worth saying it's a heuristic.
  • Scenarios 3 and 4: directions and map-matching return simplified geometry unless you pass --overview full. Also, .matchings[].distance already gives the trip length, so Turf isn't needed there.
  • SAR note: those flags are on search category, need --sar-type, and --route takes an encoded polyline, not GeoJSON.
  • node scripts/... only works from the skill directory. An installed skill needs its full path.

After the release, please re-run the examples on the released binary and run the evals before asking for review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants