grind-lab-core/night_owl_research_agent/spatial-analysis
Claude Code and agent skill by grind-lab-core/night_owl_research_agent
- community
Checking that the SKILL.md file is still in the repository.
Guideline-driven spatial analysis skill. Given a research question and data context, provides decision frameworks for selecting appropriate spatial methods, diagnostics, and interpretation strategies. Adapts to available data, spatial units, and analytical objectives — Claude Code determines the optimal workflow. Use when user says "spatial analysis", "analyze spatial data", "run spatial regression", "check for clustering", "map this", or needs to go from a research question to a complete spatial analysis.
Install
npx vskill@latest install grind-lab-core/night_owl_research_agent/spatial-analysisSKILL.md
Spatial Analysis: Guideline-Driven Decision Framework
Analyze: $ARGUMENTS
Purpose
This skill provides guidelines, decision tables, and guardrails for spatial analysis — not a fixed procedure. The sequence and combination of methods should be determined by Claude Code based on:
- The research question and its analytical objective
- The available data (type, size, quality, spatial unit)
- The study context (domain, audience, publication target)
Read skills/knowledge/spatial-methods.md for reference implementations. This skill decides when, why, and under what conditions to use them.
Constants
- OUTPUT_DIR = `output/spatial-analysis` — Default destination for all analysis artifacts.
- MAX_FEATURES = 15 — Soft cap on predictors before recommending dimensionality reduction.
- MGWR_MAX_N = 3000 — Subsample threshold for MGWR.
- GWR_MAX_N = 5000 — Subsample threshold for GWR.
- SIGNIFICANCE_LEVEL = 0.05 — Default alpha unless user specifies otherwise.
- SPATIAL_CV_FOLDS = 5 — Default spatial cross-validation folds.
Override via argument, e.g.,/spatial-analysis "question" — significance: 0.01, max features: 8.
1. Research Question Classification
Before selecting any method, classify the research question. This classification drives every downstream decision.
1.1 Analytical Objective Mapping
| Objective | Signal phrases | Typical method families | |
|---|---|---|---|
| Description | "what is the spatial pattern of...", "how is X distributed" | Choropleth, KDE, summary statistics, ESDA | |
| Explanation | "what factors explain...", "why does X vary across..." | Regression ladder (OLS → spatial → local) | |
| Comparison | "does X differ between regions..." | Stratified analysis, interaction terms, regional subsetting | |
| Prediction | "can we predict...", "where will X occur..." | ML + spatial CV, feature engineering | |
| Clustering / hot spots | "are events clustered...", "where are hot spots..." | Moran's I, LISA, Getis-Ord Gi*, DBSCAN | |
| Association | "is X related to Y spatially..." | Bivariate Moran's I, spatial regression | |
| Accessibility | "who has access to...", "what areas are underserved..." | Network analysis, 2SFCA, isochrones | |
| Temporal-spatial change | "how has X changed over time across space..." | Panel methods, spatiotemporal aggregation | |
| Causal inference | "does X cause Y..." | Spatial DiD, IV, RDD — flag limitations explicitly | |
| Interpolation | "what is the value at unsampled locations..." | Kriging, IDW, cross-validation |
If the question maps to multiple objectives, identify the primary one and treat others as supporting. If the question is too vague, ask the user to clarify the outcome, spatial unit, and study area.
1.2 Should Spatial Methods Be Used at All?
Not every geographic dataset requires spatial statistics. Evaluate:
| Question | If "no" | If "yes" | |
|---|---|---|---|
| Is spatial dependence theoretically plausible? | Standard methods may suffice | Spatial structure likely matters | |
| Is the spatial structure itself the research question? | Spatial methods are optional | Spatial methods are mandatory | |
| Would ignoring spatial structure bias results? | OLS may be adequate | Spatial adjustment needed |
Guideline: If all three are "no", recommend non-spatial analysis and explain why. Do not force spatial methods where they add no value.
1.3 Write Question Classification
Save classification to output/spatial-analysis/question_classification.md:
2. Data Readiness Guidelines
These guidelines apply regardless of analytical objective. Evaluate data readiness before proceeding to any analysis. The depth of preparation depends on the situation.
2.1 CRS Decision Framework
This is non-negotiable. Wrong CRS invalidates distance, area, and density calculations.
| If the analysis involves... | CRS requirement | Recommendation | |
|---|---|---|---|
| Distance or density calculations | Projected (meters) | Local UTM or national grid | |
| Area calculations | Equal-area projection | Albers, Mollweide, or national equal-area | |
| Only display / web mapping | Any (geographic OK) | WGS84 (EPSG:4326) | |
| Spatial joins / overlays | Both layers must match | Reproject to analysis CRS first | |
| Mixed (distance + display) | Analyze in projected, display in geographic | Two CRS in workflow |
Guardrail: If data is in EPSG:4326 and the analysis involves distances, areas, or density — project first. Never compute Euclidean distance on lat/lon.
UTM zone estimation (when no local CRS is obvious):
2.2 Data Quality Checklist
Evaluate these as needed — not all checks apply to every dataset:
| Issue | When to check | How to handle | |
|---|---|---|---|
| Missing CRS | Always | Ask user or infer from coordinate range | |
| Invalid geometries | Before spatial operations | gdf.geometry.buffer(0) to fix | |
| Duplicated geometries | Before spatial statistics | Investigate context before dropping | |
| Multipart features | When analysis requires single-part | gdf.explode() | |
| Empty geometries | Always | Drop or investigate | |
| Missing values | Always | Document spatial pattern of missingness — clustered missingness biases spatial statistics |
2.3 Multi-Dataset Integration
When combining datasets, address these issues in the order they arise:
| Issue | Guideline | |
|---|---|---|
| CRS mismatch | Reproject all layers to a common analysis CRS before any spatial operation | |
| Temporal mismatch | Document the assumption that spatial patterns are stable over the time gap; flag if gap > 2 years | |
| Resolution mismatch (MAUP) | Document aggregation/disaggregation method; warn about ecological fallacy; consider sensitivity analysis at different scales | |
| Boundary mismatch | Use areal interpolation if administrative boundaries don't align |
2.4 Variable Preparation Guidelines
| Situation | Guideline | |||
|---|---|---|---|---|
| Suspected outliers | Inspect in spatial context — an "outlier" may be a real local phenomenon. Do NOT auto-remove | |||
| Skewed distributions | Log-transform only if theoretically justified AND skewness > \ | 2\ | ||
| Many predictors (> MAX_FEATURES) | Apply domain-driven selection or dimensionality reduction before modeling | |||
| Multicollinearity (VIF > 10) | Drop or combine correlated predictors | |||
| Preparing for GWR/MGWR | Standardize predictors (mean=0, std=1) so bandwidths are comparable |
3. Spatial Weights Selection Guide
Spatial weights underpin most spatial statistics. The choice is consequential and must be justified.
| Data type | Recommended weights | Rationale | |
|---|---|---|---|
| Regular polygon tessellation (counties, tracts) | Queen contiguity | Captures all adjacency relationships | |
| Grid-like polygons | Rook contiguity | Corner adjacency often not meaningful | |
| Point data | KNN (k=5–8) | Adapts to varying point density | |
| Irregular polygon sizes | KNN or distance band | Contiguity unreliable with very different sizes | |
| Interaction decays with distance | Distance band | Captures distance-decay process |
Guardrails:
- Always check for islands:
W.islands. Islands break spatial statistics — add manual connections or switch to KNN. - Always row-standardize:
W.transform = 'R'. - Document your choice and reasoning. If results are sensitive to weights choice, report this.
4. Analytical Approach Guidelines
Select your approach based on the analytical objective from Section 1. These are not sequential steps — choose the relevant section(s) and adapt.
4.1 Exploratory Spatial Data Analysis (ESDA)
When to use: Almost always — ESDA should precede formal modeling in most situations. Skip only if the question is purely about accessibility/network analysis with no distributional component.
What to include depends on the question:
| If the question is about... | ESDA should include | |
|---|---|---|
| Spatial patterns or distribution | Choropleth/KDE maps, global Moran's I, LISA or Gi* | |
| Regression / explanation | Distribution of outcome + predictors, correlation matrix, global Moran's I to determine if spatial modeling is needed | |
| Prediction | Feature distributions, spatial autocorrelation of target variable, visual inspection for spatial structure | |
| Clustering | Global clustering test first (Moran's I or General G), then local tests |
Map classification guidance:
| Data distribution | Best classification scheme | |
|---|---|---|
| Roughly uniform | equal_interval | |
| Skewed (common) | quantiles (equal-count bins) | |
| Multimodal or natural groupings | natural_breaks or fisher_jenks | |
| Need to highlight deviation from mean | std_mean (only if roughly normal) |
Color scheme rules:
| Variable type | Use | Never use | |
|---|---|---|---|
| Sequential (counts, rates) | viridis, YlOrRd, Blues | rainbow/jet | |
| Diverging (residuals, change) | RdBu_r, coolwarm, PiYG | sequential colormap | |
| Categorical (clusters) | Set2, tab10 | continuous colormap |
Global Moran's I interpretation:
| Result | Implication | |
|---|---|---|
| p < 0.01 | Strong spatial autocorrelation — spatial methods likely needed | |
| 0.01 ≤ p < 0.05 | Moderate — spatial methods recommended; compare with non-spatial | |
| p ≥ 0.05 | Not significant — non-spatial methods may suffice; still check residuals after modeling |
Local pattern detection — LISA vs Getis-Ord Gi*:
| Use LISA when | Use Gi* when | |
|---|---|---|
| You care about both clusters AND spatial outliers (HH, LL, HL, LH) | You only care about hot spots and cold spots | |
| You want to identify areas that deviate from neighbors | You want to identify concentration of extreme values |
Guardrail: Multiple testing — with N spatial units, you run N local tests. Report the number of significant clusters and note potential false positives. Consider Bonferroni or FDR correction.
4.2 Explanatory Analysis (Regression)
When to use: The research question asks why a spatial pattern exists or what factors explain spatial variation.
Decision framework — choose the model based on diagnostics, not assumption:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/spatial-analysis/SKILL.md
Popularity
- Repository stars
- 80
- Repository forks
- 21
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 15 May 2026, 5 months ago.
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/grind-lab-core/night_owl_research_agent/spatial-analysis)