agentleFS
opengeosopengeos/geoai-skills/skills/process-raster/SKILL.md

process-raster

Skill31 starsChanged 8 months agoMITView on GitHub

Process raster data: clip by bounding box, stack multiple bands, mosaic GeoTIFFs, or convert between raster and vector formats.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow these steps in order.

    line 14
  2. Distinctive:

    If the operation is unclear from the input, ask the user to specify.

    line 28
  3. Distinctive:

    If the user recently inspected or downloaded a file and did not specify an input, check the state file for context:

    line 44
  4. Distinctive:

    If state exists, read the last inspected or downloaded file:

    line 54
  5. Very specific:

    Default pixel size: 1.0 (or infer from context).

    line 161
  6. Distinctive:

    If a state directory exists, update it with the output file path using the same state resolution pattern as Step 2.

    line 167

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are helping the user process geospatial raster data using geoai.

Input: $@

Follow these steps in order.

Step 1 -- Determine the operation

Parse $@ to identify the requested operation:

OperationTriggersRequired inputs
clip"clip", "crop", "subset", --bbox presentinput raster + bbox
stack"stack", "combine bands"list of input rasters
mosaic"mosaic", "merge"input directory or list of rasters
raster-to-vector"to vector", "vectorize", "polygonize"input raster
vector-to-raster"to raster", "rasterize", "burn"input vector + pixel size

If the operation is unclear from the input, ask the user to specify.

Step 2 -- Resolve input file(s)

For single-file operations (clip, raster-to-vector, vector-to-raster):

find "$PWD" -name "INPUT_FILENAME" -not -path '*/.git/*' 2>/dev/null

For multi-file operations (stack, mosaic), if a directory is given:

find "INPUT_DIR" -name "*.tif" -o -name "*.tiff" 2>/dev/null | sort

If the user recently inspected or downloaded a file and did not specify an input, check the state file for context:

STATE_DIR=""
test -f .geoai-skills/state.json && STATE_DIR=".geoai-skills"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
PROJECT_ID="$(echo "$PROJECT_ROOT" | tr '/' '-')"
test -f "$HOME/.geoai-skills/$PROJECT_ID/state.json" && STATE_DIR="$HOME/.geoai-skills/$PROJECT_ID"

If state exists, read the last inspected or downloaded file:

python3 -c "
import json
with open('STATE_DIR/state.json') as f:
    state = json.load(f)
if 'last_inspected' in state:
    print(f'Last inspected: {state[\"last_inspected\"][\"path\"]}')
if 'downloaded_files' in state:
    for f in state['downloaded_files']:
        print(f'Downloaded: {f}')
"

Step 3 -- Execute the operation

Clip by bounding box

python3 -c "
import geoai

result = geoai.clip_raster_by_bbox(
    input_raster='INPUT_PATH',
    output_raster='OUTPUT_PATH',
    bbox=[MINX, MINY, MAXX, MAXY],
)
print(f'Clipped raster saved to: {result}')
info = geoai.get_raster_info(result)
for k, v in info.items():
    print(f'{k}: {v}')
"

Default output: ./clipped_<original_name>.tif

Stack bands

python3 -c "
import geoai

result = geoai.stack_bands(
    input_files=['FILE1', 'FILE2', 'FILE3'],
    output_file='OUTPUT_PATH',
)
print(f'Stacked raster saved to: {result}')
info = geoai.get_raster_info(result)
for k, v in info.items():
    print(f'{k}: {v}')
"

Mosaic GeoTIFFs

python3 -c "
import geoai

result = geoai.mosaic_geotiffs(
    input_dir='INPUT_DIR',
    output_file='OUTPUT_PATH',
)
print(f'Mosaic saved to: {result}')
info = geoai.get_raster_info(result)
for k, v in info.items():
    print(f'{k}: {v}')
"

Raster to vector

python3 -c "
import geoai

gdf = geoai.raster_to_vector(
    raster_path='INPUT_PATH',
    output_path='OUTPUT_PATH',
)
print(f'Vectorized: {len(gdf)} features')
print(f'Saved to: OUTPUT_PATH')
print(f'Columns: {list(gdf.columns)}')
"

Default output: ./<original_name>.gpkg

Vector to raster

python3 -c "
import geoai

result = geoai.vector_to_raster(
    vector_path='INPUT_PATH',
    output_path='OUTPUT_PATH',
    pixel_size=PIXEL_SIZE,
)
print(f'Rasterized: {result}')
info = geoai.get_raster_info(result)
for k, v in info.items():
    print(f'{k}: {v}')
"

Default pixel size: 1.0 (or infer from context). Default output: ./<original_name>.tif

Replace all placeholder values with actual paths and parameters before running.

Step 4 -- Update state

If a state directory exists, update it with the output file path using the same state resolution pattern as Step 2.

Step 5 -- Report and suggest

Report:

  • Operation performed
  • Input and output file paths
  • Key properties of the output (dimensions, CRS, band count, feature count)

Then suggest: "Use /geoai-skills:inspect-geo to examine the result in detail."

Error handling

  • import geoai fails -> delegate to /geoai-skills:install-geoai.
  • File not found -> use find to locate, suggest corrected path.
  • CRS mismatch (for stack/mosaic) -> report the issue and suggest reprojecting first.
  • Insufficient disk space -> report the error.
  • Memory error (very large rasters) -> suggest processing in tiles or using a smaller extent.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.