esmailhussien/terraproof/stac-and-cloud-access
Claude Code and agent skill by esmailhussien/terraproof
- community
Checking that the SKILL.md file is still in the repository.
Search STAC APIs reproducibly and read cloud-hosted rasters lazily, covering collections/bbox/intersects/datetime/query/filter parameters, item and asset provenance, signed URLs and requester-pays buckets, COG and Zarr windowed reads through HTTP range requests and GDAL /vsicurl/, loader scale/offset behaviour, caching and pinning item ids in a run manifest; use when finding, loading or recording satellite data from STAC catalogs or object storage.
Install
npx vskill@latest install esmailhussien/terraproof/stac-and-cloud-accessSKILL.md
The same SKILL.md was published earlier as esmailhussien/terraproof/stac-and-cloud-access.
STAC search and cloud-native access
Search with explicit, reproducible parameters
STAC API Item Search (GET /search required, POST recommended) returns an ItemCollection (GeoJSON FeatureCollection of Items). Core parameters [S1]:
| Parameter | Meaning and pitfalls | |
|---|---|---|
collections | Collection ids; always set it so results are not cross-collection by accident. | |
bbox | [min lon, min lat, max lon, max lat] in WGS 84 (CRS84); 2D or 3D. | |
intersects | One GeoJSON geometry. Only one of `bbox` or `intersects`; both is a 400 error. | |
datetime | RFC 3339 instant or interval with /; .. for open ends. Item times are UTC [S2]. | |
ids | Exact Item ids — the way to re-fetch a pinned set. | |
limit | Page size suggestion only; servers may return fewer and paginate via next links. |
Property filtering is an extension: the Query extension (query, operators eq, neq, lt, lte, gt, gte, startsWith, endsWith, contains, in) [S3] or the recommended Filter extension (filter, filter-lang = cql2-text or cql2-json) [S4]. Check conformance before relying on either; a server that does not implement one may ignore or reject it.
Client.search defaults to POST; max_items caps total items, limit is the per-page hint; filter defaults to cql2-json for dict input [S5]. When run in October 2026 this endpoint advertised Query but not Filter, so a filter= search only warned. An AOI can return items from several UTM zones/tiles; plan a common output CRS. Dataset discovery and licensing are covered by geospatial data discovery. Shared rules: engineering, simplicity, security.
Record item and asset provenance
An Item requires id, geometry, bbox (when geometry is not null), properties.datetime (or null with start_datetime/end_datetime), links and assets; ids are unique within a Collection, so record collection + id [S2]. For each input keep:
- STAC API root URL, collection id, item id,
datetime, self link; - asset key and unsigned
href, media type and roles; - processing version:
processing:version(e.g. a Sentinel processing
baseline) [S6], or the deprecated s2:processing_baseline still used by some catalogs [S7];
- encoding metadata: raster extension
scale/offset/nodata(raster:bands
in v1.x, raster:scale/raster:offset in v2.0) [S8];
- the exact search parameters and the date the search ran.
Catalogs change (reprocessing, new baselines, removed items). A search re-run later can return different items; the pinned ids cannot silently change. Re-fetch with client.search(collections=[...], ids=[...]). A manifest pattern is in references/run-manifest.md.
Signed URLs and requester-pays storage
- Signed URLs (SAS): Microsoft Planetary Computer assets need signing,
e.g. Client.open(url, modifier=planetary_computer.sign_inplace) or planetary_computer.sign(item); tokens expire and signed items gain an msft:expiry property [S9]. Sign at read time; never store signed URLs or tokens in manifests, logs or reports (security).
- Requester pays: the reader pays for access and transfer. Example:
s3://usgs-landsat/collection02/ is a requester-pays bucket [S10]. GDAL needs credentials plus AWS_REQUEST_PAYER=requester; AWS_NO_SIGN_REQUEST=YES disables signing for public buckets [S11]. Estimate transfer before bulk reads.
Read COG windows with HTTP range requests
/vsicurl/ reads remote files piece-wise with HTTP range requests, chunked and cached in memory; /vsicurl_streaming/ does not use range requests; a plain URL without /vsi uses the HTTP driver, which downloads the whole file [S11]. COGs are tiled with overviews and an internal tile index, which is what makes partial reads efficient [S11]. Rasterio opens https:// hrefs through GDAL.
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR stops directory listing and side-car probing; CPL_VSIL_CURL_ALLOWED_EXTENSIONS limits which files GDAL assumes exist [S12]. CLI equivalents: gdalinfo /vsicurl/https://.../B04.tif, and gdal_translate -projwin_srs EPSG:4326 -projwin ... for a subset. Retries (GDAL_HTTP_MAX_RETRY, GDAL_HTTP_RETRY_DELAY) and cache sizes are in references/run-manifest.md. Windows/blocks and COG creation: raster processing.
Know what your loader decodes
In the example above (Earth Search Sentinel-2 L2A, October 2026) the STAC asset declared scale 0.0001, offset -0.1, nodata 0, while the GeoTIFF reported identity scale/offset: rasterio.read() returns raw DN [S8]. Loaders differ:
odc.stac.load(...)returned rawuint16DN withnodata0 in the same test;
decode afterwards, exactly once.
stackstac.stack(...)defaults torescale=True, applyingraster:bands
scale/offset, with dtype=float64 and NaN fill [S13]; do not decode again.
xarray.open_zarr(...)defaults tomask_and_scale=True(CF decoding) and
lazy Dask chunks when Dask is installed [S14].
Decoding rules and sensor offsets: satellite preprocessing.
Load many items as a lazy cube
groupby="solar_day" places items from the same solar day in one time slice; by default overlapping pixels are filled from the first valid item in a deterministic time/id order; patch_url can sign hrefs (e.g. planetary_computer.sign) [S15]. Set resampling per band, e.g. nearest for categorical scl [S15]. In the test above, 4 tile-items became 2 dates. Record crs, resolution, groupby, resampling and library versions with the outputs.
Cache and pin for reproducibility
GDAL's /vsicurl/ cache is in-process memory only [S11]; it is not a reproducibility mechanism. For results that must be re-verified:
- Pin collection + item ids and asset keys; store unsigned hrefs.
- Copy the exact bytes you analysed to a local or bucket cache and record
SHA-256 and size; verify hashes before reuse.
- Record processing versions, encoding metadata, loader parameters, library and
GDAL versions, and the search parameters.
- Keep timestamps and machine paths outside the hashed part of a manifest.
Verify with Terraproof
stac.provenance checks Item time and a projection code, not full lineage, licences or calibration. Raster outputs get crs.defined, crs.consistent, raster.nodata_declared, raster.grid_alignment, raster.cog_layout, and rs.reflectance_range with --expect reflectance (only after decoding).
Use --manifest run.json --require-provenance for provenance.reproducible (re-hashes manifest inputs/outputs; warns on tool-version drift, fails on content drift). Add --time-range START END for rs.temporal_scope on source Items. For rs.scale_applied_once, compare a decoded raster with its raw source using --reference-input RAW.tif --encoding s2-l2a or landsat-c2-l2; the sampled output is compared with DN × scale + offset under that declared encoding. For s2-l2a also pass --decode-offset: -0.1 for ESA DNs from processing baseline 04.00, 0 for earlier baselines and for distributions that already applied it (an Earth Search item says earthsearch:boa_offset_applied: true).
Not checked automatically: whether the search returned the right items, whether pinned items still exist upstream, licence compliance and transfer costs. Manifest credential guards reject known secret-bearing paths/URLs, but do not audit every application log or prevent all signed-URL leakage.
Sources
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/stac-and-cloud-access/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/esmailhussien/terraproof/stac-and-cloud-access)