grind-lab-core/night_owl_research_agent/spatial-analysis

Claude Code and agent skill by grind-lab-core/night_owl_research_agent

Trust tier 3
  • community
Source check pending

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-analysis

SKILL.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:

  1. The research question and its analytical objective
  2. The available data (type, size, quality, spatial unit)
  3. 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
ObjectiveSignal phrasesTypical 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:

QuestionIf "no"If "yes"
Is spatial dependence theoretically plausible?Standard methods may sufficeSpatial structure likely matters
Is the spatial structure itself the research question?Spatial methods are optionalSpatial methods are mandatory
Would ignoring spatial structure bias results?OLS may be adequateSpatial 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:

markdown
# Research Question Classification
**Question**: [user's question]
**Date**: [today]
## Analytical Objective
-Primary: [objective type]
-Supporting: [if any]
## Key Components
-Outcome variable: [or N/A]
-Explanatory variables: [list or TBD]
-Spatial unit: [point / polygon / raster / network]
-Temporal structure: [cross-sectional / panel / time series]
-Study extent: [description]
-Estimated N: [if known]
## Spatial Methods Needed?
-[Yes / No / Conditional on diagnostics]
-Reasoning: [why]
## Method Candidates
1.[method — why it fits this question]
2.[method — why it fits this question]
3.[method — conditional on X]

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 requirementRecommendation
Distance or density calculationsProjected (meters)Local UTM or national grid
Area calculationsEqual-area projectionAlbers, Mollweide, or national equal-area
Only display / web mappingAny (geographic OK)WGS84 (EPSG:4326)
Spatial joins / overlaysBoth layers must matchReproject to analysis CRS first
Mixed (distance + display)Analyze in projected, display in geographicTwo 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):

python
centroid = gdf.geometry.unary_union.centroid
utm_zone = int((centroid.x + 180) / 6) + 1
hemisphere = 'north' if centroid.y >= 0 else 'south'
epsg = 32600 + utm_zone if hemisphere == 'north' else 32700 + utm_zone
2.2 Data Quality Checklist

Evaluate these as needed — not all checks apply to every dataset:

IssueWhen to checkHow to handle
Missing CRSAlwaysAsk user or infer from coordinate range
Invalid geometriesBefore spatial operationsgdf.geometry.buffer(0) to fix
Duplicated geometriesBefore spatial statisticsInvestigate context before dropping
Multipart featuresWhen analysis requires single-partgdf.explode()
Empty geometriesAlwaysDrop or investigate
Missing valuesAlwaysDocument 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:

IssueGuideline
CRS mismatchReproject all layers to a common analysis CRS before any spatial operation
Temporal mismatchDocument 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 mismatchUse areal interpolation if administrative boundaries don't align
2.4 Variable Preparation Guidelines
SituationGuideline
Suspected outliersInspect in spatial context — an "outlier" may be a real local phenomenon. Do NOT auto-remove
Skewed distributionsLog-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/MGWRStandardize 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 typeRecommended weightsRationale
Regular polygon tessellation (counties, tracts)Queen contiguityCaptures all adjacency relationships
Grid-like polygonsRook contiguityCorner adjacency often not meaningful
Point dataKNN (k=5–8)Adapts to varying point density
Irregular polygon sizesKNN or distance bandContiguity unreliable with very different sizes
Interaction decays with distanceDistance bandCaptures 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 distributionChoropleth/KDE maps, global Moran's I, LISA or Gi*
Regression / explanationDistribution of outcome + predictors, correlation matrix, global Moran's I to determine if spatial modeling is needed
PredictionFeature distributions, spatial autocorrelation of target variable, visual inspection for spatial structure
ClusteringGlobal clustering test first (Moran's I or General G), then local tests

Map classification guidance:

Data distributionBest classification scheme
Roughly uniformequal_interval
Skewed (common)quantiles (equal-count bins)
Multimodal or natural groupingsnatural_breaks or fisher_jenks
Need to highlight deviation from meanstd_mean (only if roughly normal)

Color scheme rules:

Variable typeUseNever use
Sequential (counts, rates)viridis, YlOrRd, Bluesrainbow/jet
Diverging (residuals, change)RdBu_r, coolwarm, PiYGsequential colormap
Categorical (clusters)Set2, tab10continuous colormap

Global Moran's I interpretation:

ResultImplication
p < 0.01Strong spatial autocorrelation — spatial methods likely needed
0.01 ≤ p < 0.05Moderate — spatial methods recommended; compare with non-spatial
p ≥ 0.05Not significant — non-spatial methods may suffice; still check residuals after modeling

Local pattern detection — LISA vs Getis-Ord Gi*:

Use LISA whenUse 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 neighborsYou 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/grind-lab-core/night_owl_research_agent/spatial-analysis/badge)](https://verified-skill.com/skills/grind-lab-core/night_owl_research_agent/spatial-analysis)

Something wrong with this skill or its page? Tell us.