Usgs earthquakes

From mvanhorn/printing-press-library · View interactive version

Usgs earthquakes is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every USGS earthquake feed and event query in one terminal, with offline SQLite cache, agent-native output, and a... Trigger phrases: `any recent earthquakes`, `earthquakes near`, `aftershocks of`, `USGS earthquake feed`, `M5 earthquake`, `tsunami earthquake`, `swarm detection`, `use usgs-earthquake

How to use this skill

Skill file

USGS Earthquakes — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the usgs-earthquakes-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install usgs-earthquakes --cli-only

```

  1. Verify: usgs-earthquakes-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/other/usgs-earthquakes/cmd/usgs-earthquakes-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Reach for this CLI any time an agent needs to answer questions about USGS earthquakes — recent activity, historical search, single-event detail, aftershock sequences, regional comparisons, or live monitoring. It is the right choice when speed matters (offline SQLite cache), when output must be agent-friendly (--json, --select, --compact, --csv on every command), or when the workflow spans multiple events that the raw FDSN API would require stitching together. Not the right choice for non-USGS seismic networks (IRIS event service, EMSC) or for waveform/station data — those need an FDSN station-service client like obspy.

When Not to Use This CLI

Do not activate this CLI for requests that require creating, updating, deleting, publishing, commenting, upvoting, inviting, ordering, sending messages, booking, purchasing, or changing remote state. This printed CLI exposes read-only commands for inspection, export, sync, and analysis.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Real-time monitoring

_Reach for this when you want a long-running monitor over USGS earthquakes without writing a polling loop. Pluggable shell hook means it composes with notify-send, Slack curl, paging systems, anything._

```bash

usgs-earthquakes-pp-cli watch --min-magnitude 5 --notify "echo {id}: {place}" --interval 60s

```

Cross-event analysis

_Reach for this any time you have a mainshock event ID and need to see what came after. The single-call alternative is dozens of /query invocations stitched in jq._

```bash

usgs-earthquakes-pp-cli aftershocks us7000abcd --radius-km 100 --days 30 --min-mag 3.0 --json

```

_Reach for this when monitoring a volcano, fault zone, or fracking region for unusual clustering. The output names each cluster with center, count, peak magnitude, and time range._

```bash

usgs-earthquakes-pp-cli swarm-detect --bbox -122.5,46.5,-121.5,47.5 --window 7d --min-events 10 --cluster-radius-km 20 --json

```

_Reach for this when answering 'is region A more active than region B?' or 'is this region quieter than it used to be?'. Outputs delta percentages and energy ratios._

```bash

usgs-earthquakes-pp-cli compare --region-a -122.5,37.5,-122.0,37.9 --region-b -118.5,33.8,-118.0,34.2 --window 30d --json

```

Agent-native output

_Reach for this in newsroom or Slack contexts where you need a one-event summary an editor or downstream agent can drop straight into copy. Includes the USGS event-page URL._

```bash

usgs-earthquakes-pp-cli brief us7000abcd --format markdown

```

_Reach for this when you need 'the events that matter right now' rather than 'all events by magnitude'. The composite score promotes felt + PAGER + tsunami over raw magnitude._

```bash

usgs-earthquakes-pp-cli top --window 24h --limit 10 --score composite --json

```

Local state that compounds

_Reach for this when a previously-automatic event might have just been reviewed by an analyst (revising magnitude or alert), or to answer 'what's new since I last looked?'_

```bash

usgs-earthquakes-pp-cli changes --since 24h --type revised --min-mag-delta 0.3 --json

```

_Reach for this when you see an opaque USGS event ID (e.g. nc73947885, ak0202xyz) and need to know which network reported it before reading the data._

```bash

usgs-earthquakes-pp-cli decode-id us7000abcd

```

Command Reference

catalogs — USGS earthquake source catalogs (ANSS contributors and processing centers)

contributors — USGS earthquake data contributors

events — Search and retrieve earthquakes from the USGS FDSN Event service

feeds — Pre-built GeoJSON earthquake summary feeds (updated every minute by USGS)

metadata — FDSN Event service metadata: enumerated values for every parameter

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

usgs-earthquakes-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Hand-written Extensions

These commands are declared by the spec author and require separate hand-written wiring; the generator does not emit Cobra registration for them. They are listed here for discoverability and are intentionally outside ## Command Reference so the verify-skill unknown-command check does not treat them as generator-owned paths.

Recipes

Did anything newsworthy happen in the last hour?

usgs-earthquakes-pp-cli top --window 1h --limit 10 --json --select events.id,events.mag,events.place,events.alert,events.tsunami,events.score

Ranks the past hour's events by composite editorial score (sig × alert × felt × tsunami) and narrows the agent context to just the editorially-relevant fields via --select.

Track a swarm at Mount Hood for the past 7 days

usgs-earthquakes-pp-cli swarm-detect --near 45.3736,-121.6960 --radius-km 25 --window 7d --min-events 5 --json

Spatial-temporal clustering around the Mount Hood coordinate; returns named clusters with center, count, peak magnitude, and time range.

Aftershock report for a recent mainshock

usgs-earthquakes-pp-cli aftershocks us7000abcd --radius-km 100 --days 14 --min-mag 3.0 --json

Local SQLite haversine query bounded by the mainshock's time and location; falls back to FDSN /query when the event isn't cached.

Daily newsroom briefing for the top event

usgs-earthquakes-pp-cli top --window 24h --limit 1 --json --select events.id

Returns just the top-ranked event's ID; pipe to xargs -I {} usgs-earthquakes-pp-cli brief {} --format markdown to get a newsroom-ready briefing.

Find events that have a ShakeMap product near San Francisco

usgs-earthquakes-pp-cli events search --latitude 37.7749 --longitude -122.4194 --max-radius-km 200 --product-type shakemap --start 2025-01-01 --json

Uses the FDSN --product-type filter (not exposed by the competing MCP) plus the --latitude/--longitude circle filter to find events that have a ShakeMap polygon since the start of the year.

Auth Setup

No authentication required.

Run usgs-earthquakes-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

usgs-earthquakes-pp-cli catalogs --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

usgs-earthquakes-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
usgs-earthquakes-pp-cli feedback --stdin < notes.txt
usgs-earthquakes-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.usgs-earthquakes-pp-cli/feedback.jsonl. They are never POSTed unless USGS_EARTHQUAKES_FEEDBACK_ENDPOINT is set AND either --send is passed or USGS_EARTHQUAKES_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

usgs-earthquakes-pp-cli profile save briefing --json
usgs-earthquakes-pp-cli --profile briefing catalogs
usgs-earthquakes-pp-cli profile list --json
usgs-earthquakes-pp-cli profile show briefing
usgs-earthquakes-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show usgs-earthquakes-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/other/usgs-earthquakes/cmd/usgs-earthquakes-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add usgs-earthquakes-pp-mcp -- usgs-earthquakes-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which usgs-earthquakes-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

usgs-earthquakes-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: usgs-earthquakes-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.