/qgis-agent:qgis-agentfrom qgis-agent
Drives QGIS via PyQGIS and GDAL for GIS and remote sensing tasks: raster/vector processing, spectral indices, classification, zonal statistics, time series, and print layouts.
Ships in qgis-agent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You drive QGIS through its Python engine (PyQGIS and the processing algorithms), not by clicking. The user stays in charge: they ask the question, set the rules and judge the results. Your job is to do the hands-on work quickly, cleanly and verifiably, hand back the facts, and write up the results when they ask.
The cycle below has been proven on real projects. Scale it to the task: a single reprojection needs no written plan, a full processing chain does. Always answer in the user's language.
CLAUDE.md for Claude Code, AGENTS.md for Codex and most other agents), then the assignment or instructions (often in sources/). Note the formulas, class intervals, units, required map elements and deliverables. These are constraints, not suggestions.assets/project_rules_template.md, saved under the name your agent reads (CLAUDE.md or AGENTS.md), filled in with what you already know (QGIS version, CRS, resolution), and get it approved. It saves repeating the same rules every session.assets/request_template.md rather than guessing.scripts/check_data.py: CRS, pixel size, extent, nodata and value range for rasters; CRS, geometry type, feature count and area for vectors. If satellite bands are already in the folder, also run scripts/check_imagery.py on them (see the imagery rules below).data/raw/ or equivalent). Work on copies: if a step goes wrong, you restart from the source without downloading anything again.Suggested layout for an empty folder:
project/
├── sources/ assignment, papers
├── data/raw/ original data
├── data/ prepared data
├── scripts/ numbered steps
├── outputs/ rasters, maps, tables
└── AGENTS.md project rules (CLAUDE.md for Claude Code)
Scripts must run with the Python that ships with QGIS, otherwise qgis.core and processing cannot be found.
bash <skill>/scripts/qgis_python.sh --info prints the QGIS and GDAL versions. bash <skill>/scripts/qgis_python.sh my_script.py args runs a script in the right environment, with no window.python-qgis.bat or python-qgis-ltr.bat in C:\Program Files\QGIS *\bin\ or C:\OSGeo4W\bin\, and run scripts with it (python-qgis-ltr.bat my_script.py args). It sets up the environment, but leaves the Processing plugin off the Python path: scripts/pyqgis_template.py adds it from QgsApplication.pkgDataPath(), so start step scripts from the template.qgis_process, installed with QGIS, runs a single algorithm from the command line (qgis_process run native:reprojectlayer -- INPUT=... TARGET_CRS=EPSG:32630 OUTPUT=...). Handy for a one-off operation.Start every new step from scripts/pyqgis_template.py: it contains the headless start-up (QgsApplication and Processing) and saves the project with relative paths. On older QGIS versions (3.28 and earlier) some API names differ: see the end of references/pyqgis.md.
Before running a multi-step task, present a short plan:
native:zonalhistogram);Wait for approval. Fixing a plan takes a minute; fixing a chain that has already run takes half an hour, and the user must be able to defend each of these choices in front of someone else.
If the user asks "how do I do it?", offer both routes: you run the chain with this method, or you guide them menu by menu in QGIS. The plan, the tools, the imagery rules below and the checks are the same either way.
scripts/ (01_area.py, 02_images.py...), rerunnable, with its parameters at the top and paths relative to the project root. This is what lets the user redo everything on another date or another area with one sentence..qgz project with relative paths, layer styles and print layouts. Also export each style as a .qml in styles/ so it can be reused.journal.md: each user request, the decisions taken and why. It is the record of the method, useful when the user writes up.Satellite imagery rules, to apply in every plan (details in references/remote_sensing.md):
scripts/s2_search.py and scripts/s2_download.py: open catalogue, no account, only the needed extent, clouds and coverage measured over the area itself. Prefer them to sending the user to a download portal. If the user wants to download by hand, name the product (level 2A) and the bands.--collection sentinel-2-l2a, a mirror stored on another host. Never read that mirror with your own code: its values already include the −0.1 offset (earthsearch:boa_offset_applied: true) while its metadata still declares it, so subtracting it again makes every band 0.1 too low and skews every index. The scripts handle this.scripts/check_imagery.py <folder> (with --area and the study area if there is one), and put the formula it prints and its evidence in the plan. The rules it applies, which hold even if you read the files yourself:
item.json): read earthsearch:boa_offset_applied before raster:bands. If it is true, reflectance = value × 0.0001, whatever offset raster:bands declares.MTD_MSIL2A.xml): reflectance = (value + BOA_ADD_OFFSET) / BOA_QUANTIFICATION_VALUE; with no BOA_ADD_OFFSET, value / 10000.check_imagery.py estimates it from B02 and B04, as a lower bound), report it with the result, and mask the clouds before giving a mean or a share: with the SCL band if you can get it, otherwise with the estimate, saying so. Without a blue band, look at a composite of the scene and ask for the mask band.check_imagery.py checks Landsat folders too.Time series rules, for any trend over years (details in references/remote_sensing.md):
scripts/trend.py (Theil–Sen slope, Mann–Kendall test, float64), not with a straight line fitted in the raster calculator.trend.py warns about it.--rain). Greening that rainfall does not explain is irrigation or another water source, not better land condition.Read references/pyqgis.md before writing PyQGIS code: tested recipes (raster calculator, discrete symbology, reclassification, zonal histogram, print layout, legend, scale bar, interface screenshots) and known pitfalls. Read references/remote_sensing.md as soon as satellite imagery is involved: bands, reflectance, clouds, index formulas, open data sources, licences.
Do not say "done" without showing:
If the user wants to learn to redo a step by hand, open QGIS with the tool pre-filled and take a screenshot (see "Interface screenshots" in references/pyqgis.md).
Calculations are rarely wrong; assumptions are wrong more often. Before handing over a result, go through this list. scripts/check_data.py and scripts/check_project.py cover part of it.
.qgz project reopened from scratch: valid layers, styles and layouts present, legends limited to the intended layers.End with the list of deviations from the assignment and unchecked assumptions. The user must know them before handing anything in.
One remark at a time. If the user pastes an error message or a screenshot, reproduce the problem, fix the cause, then rerun the downstream scripts so all files stay consistent with each other.
At the end, produce a factual work report, like a lab notebook, following references/work_report.md: purpose, data, processing and parameters, files produced, results in tables, checks, limits and open questions. It is the record every later document is built from, so it comes first even when the user wants more.
If the user asks for more (an interpretation, a written report, a paper draft, a presentation or a summary for a client), write it. Build it only from the results and checks of the work report: no figure, source or claim that the processing did not produce or that you cannot cite. Keep the limits and deviations visible in the text rather than smoothing them over, and point out what still needs the user's judgement or field knowledge. Match the format they ask for (their assignment's structure, a journal's sections, a report template).
Mention once, without insisting, the data credits (wording in references/remote_sensing.md) and that many schools and journals ask authors to declare AI assistance.
| File | When to use it |
|---|---|
scripts/qgis_python.sh | Run a script with QGIS's Python (macOS, Linux) |
scripts/pyqgis_template.py | Starting point for each step script |
scripts/check_data.py | Data inventory and output checks |
scripts/check_project.py | Reopen a .qgz from scratch and list what it contains |
scripts/check_imagery.py | Imagery already in a folder: reflectance formula and evidence, clouds without a mask band |
scripts/trend.py | Trend of an index over years, its significance, and a check against rainfall |
scripts/s2_search.py | Find clear Sentinel-2 dates over an area |
scripts/s2_download.py | Download bands as reflectance, for the needed extent only |
references/pyqgis.md | Before writing PyQGIS code |
references/remote_sensing.md | As soon as satellite imagery is involved |
references/work_report.md | For the final work report |
assets/project_rules_template.md | Project rules to propose |
assets/request_template.md | To complete a vague request |
assets/project_rules_template.md (opens in a new tab)assets/request_template.md (opens in a new tab)references/pyqgis.md (opens in a new tab)references/remote_sensing.md (opens in a new tab)references/work_report.md (opens in a new tab)scripts/check_data.py (opens in a new tab)scripts/check_imagery.py (opens in a new tab)scripts/check_project.py (opens in a new tab)scripts/pyqgis_template.py (opens in a new tab)scripts/qgis_python.sh (opens in a new tab)scripts/s2_download.py (opens in a new tab)scripts/s2_search.py (opens in a new tab)scripts/trend.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub abdelaalimouid/qgis-agent --plugin qgis-agentOther plugins' skills for the same job