agentsclimarketplace

Redistricting analysis

Skill brycewang-stanford/Auto-Empirical-Research-Skills/skills/22-christopherkenny-skills/skills/redistricting-analysis

Redistricting analysis in R using the redistverse ecosystem. Use whenever the user is working with redist, redistmetrics, ggredist, geomander, adj, alarmdata, PL94171, censable, easycensus, tinytiger, baf, rict, or redistio. Covers the complete pipeline: Census and spatial data loading, adjacency graph construction, SMC/MCMC simulation, constraints (population balance, county splits, VRA compliance), convergence diagnostics, plan metrics (compactness, partisan fairness, splits), visualization, summary tables, and interactive plan drawing. Invoke whenever the user mentions redistricting, gerrymandering, district plans, simulation ensembles, or any redistverse package by name.From its SKILL.md

Install
npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill redistricting-analysis

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

5.8 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

Redistricting Analysis with the redistverse

A comprehensive reference for redistricting analysis in R using the redistverse ecosystem (library(redistverse) loads redist, redistmetrics, ggredist, geomander, sf, and adj).

Standard Analysis Pipeline

  1. Load data — Download pre-built precinct map + demographics + elections via alarmdata, or assemble your own sf object and build a redist_map. → 12-alarmdata.md
  2. Prepare adjacency — Verify and edit the adjacency graph (remove water-body edges, fix topological errors). → 08-adj.md, 09-geomander-adjacency.md
  3. Set constraints — Define population tolerance, county-split penalties, VRA hinge constraints, compactness. → 02-redist-constraints.md
  4. Simulate — Run redist_smc() (recommended) or MCMC to generate an ensemble of valid plans. → 01-redist-simulation.md
  5. Validate — Check convergence (summary()), R-hat, effective sample size, and plan diversity. → 01-redist-simulation.md
  6. Score — Compute compactness, partisan fairness, splits, and other metrics across the ensemble. → 04–06 redistmetrics references
  7. Visualize & compare — Map plans, plot metric distributions, compare enacted plan to the baseline. → 07-ggredist.md

Quick Navigation

Package / TopicReference
redist_map, redist_smc, redist_mergesplit, redist_flip, redist_plans, diagnostics01-redist-simulation.md
redist_constr, add_constr_splits, add_constr_grp_hinge, all soft constraints02-redist-constraints.md
redist_enumpart, redist_shortburst, redist_cyclewalk, init_particles03-redist-advanced.md
redistmetrics — Polsby-Popper, Reock, spanning tree, prep_perims, comp_* functions04-redistmetrics-compactness.md
redistmetrics — efficiency gap, mean-median, bias, declination, part_* functions05-redistmetrics-partisan.md
redistmetrics — county splits, segregation, competitiveness, incumbents, plan_parity, group_frac06-redistmetrics-other.md
ggredistgeom_district, party color scales, cartographic palettes, theme_map07-ggredist.md
adj — adjacency graph construction, edge operations, coloring, Laplacian08-adj.md
geomander — adjacency construction, contiguity checks, seam_rip, edge editing09-geomander-adjacency.md
geomandergeo_match, estimate_down/up, block2prec, spatial estimation10-geomander-spatial.md
geomander — downloading VEST, ALARM, DRA, HEDA, get_lewis election data11-geomander-data.md
alarmdataalarm_50state_map, pre-built datasets, caching, alarm_add_plan12-alarmdata.md
PL94171 — Census P.L. 94-171 decennial data ingestion13-pl94171.md
censable (data + state IDs), easycensus (ACS), tinytiger (TIGER shapefiles)14-census-utilities.md
baf — download official Census Bureau block assignment files15-baf.md
rictgt summary tables: population, demographics, elections, compactness, splits16-rict.md
redistio — interactive Shiny plan drawing (draw()) and adjacency editor (adj_editor())17-redistio.md

Key Data Structures

redist_map — an sf tibble with one row per precinct. Stores the adjacency graph, population column, number of districts, and population tolerance. Created by redist_map() or downloaded via alarm_50state_map(). Standard columns include pop, pop_black, pop_hisp, pop_asian, pop_white, pop_vap, pop_bvap, ndv (Democratic votes), nrv (Republican votes), and geometry.

redist_plans — a tibble with one row per district per plan (so nsims × ndists rows, plus reference plans). Stores district assignments in a hidden integer matrix; metrics are added as columns via mutate(). Access the plan matrix with get_plans_matrix().

adj — an S3 vector class representing an adjacency list. Each element is a zero-indexed integer vector of neighbors. Stored as the adj column in redist_map.

Population Tolerance Guidelines

Map typeTypical pop_tolLegal basis
Congressional0.005 (±0.5%)Wesberry v. Sanders
State legislative0.05 (±10%)Reynolds v. Sims
LocalVaries by stateState law

What ships with it: 17 files

77.0 KB alongside SKILL.md

Gives 0 of the 12 instructions most research analysis skills give in ~1.4k tokens

Counted across 1,213 of the 2,113 authors here whose files we hold, read 2026-09-06

  • Cite sources for every important claimin 47 of 1213, across 38 files
  • Separate facts from inferences and recommendationsin 21 of 1213, across 12 files
  • Write findings to a markdown filein 19 of 1213
  • Label every insight with a confidence levelin 18 of 1213, across 8 files
  • Read product marketing context before asking questionsin 18 of 1213, across 8 files
  • Rank themes by frequency and intensityin 16 of 1213, across 6 files
  • Establish research mode before proceedingin 16 of 1213, across 6 files
  • Segment survey responses by customer tier or tenurein 16 of 1213, across 6 files
  • Categorize support tickets before analyzingin 16 of 1213, across 6 files
  • Weight research sources from the last twelve monthsin 16 of 1213, across 6 files
  • Use at least five data points per segmentin 15 of 1213, across 5 files
  • Extract verbatim quotes for all research findingsin 15 of 1213, across 5 files

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.