/persona-sim:vote-predictfrom persona-sim
Simulates opinion distributions and voting patterns across demographic segments using census-matched persona panels with IPF weighting. Outputs full distributions with uncertainty, segment breakdowns, and bias disclaimers.
Ships in persona-sim. 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.
None: SKILL.md is the whole skill.
Thin scenario wrapper for opinion/vote simulation. Unlike product-feedback which scores 1-10, vote-predict uses categorical choices and post-stratification so the distribution maps to population-level prediction.
import sys, json
sys.path.insert(0, str(__import__('pathlib').Path.home() / '.claude/skills/persona-sim'))
from lib import sampler, ipf, aggregator
from lib.sim_engine import SYSTEM_PROMPT, _persona_card
from lib.llm_router import generate
# 1. Sample a large panel (census-matched after IPF)
panel = sampler.sample_personas(n=100, source="nemotron_usa", mode="stream")
# 2. Compute IPF weights to match target population marginals
weights = ipf.ipf_weights(
panel,
targets={
"age": {"<25": 0.12, "25-39": 0.26, "40-59": 0.33, "60+": 0.29}, # US adult
"gender": {"male": 0.49, "female": 0.51},
},
bucketers={"gender": lambda x: x.strip().lower() if isinstance(x, str) else None},
)
# 3. Ask each persona the question
def ask(persona, question, options):
task = (f"{question}\nChoose ONE of: {options}.\n"
f'Respond JSON: {{"vote": "<choice>"}}')
resp = generate(system=SYSTEM_PROMPT, persona_card=_persona_card(persona),
task=task, tier="default", max_tokens=100)
# parse JSON (see eval/run_eval._parse_json_answer)
...
# 4. Aggregate with weights
# Option-wise: weighted_share[option] = sum(weights[i] for i where vote[i]==option) / sum(weights)
lib/bias_audit.py — humans show acquiescence and framing biases that LLM personas do not. Flag the prediction as "LLM-synthetic, not a replacement for real polling".aggregator._dip_test_proxy says multi-modal, the population is split and averaging misleads.Known US baselines from eval/gss_20q.json can sanity-check predictions. If your simulated distribution is >0.2 JS-divergence from the reference for a similar question, the simulation is not trustworthy for this topic. Run eval first.
persona-sim/lib/ipf.py — post-stratification implementationpersona-sim/lib/bias_audit.py — run before publishing any predictionpersona-sim/eval/gss_20q.json — baseline attitude distributionsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/persona-simSimulate feedback from statistically grounded virtual human populations. Use when the user wants to get product or copy feedback from a panel of diverse personas, predict group opinions or voting behavior, run social-experiment sandboxes, or compute a semantic gradient (SGO) for A/B ranking. Also triggers on mentions of Nemotron-Personas, PersonaHub, synthetic population, generative agents, silicon sample, LLM survey simulation, persuadable middle, SGO, social sandbox, 用虚拟人群测试, 模拟民意, 投票预测模拟./product-feedback-simGet structured feedback on a product, copy, pricing, or feature from a simulated panel of target users. Use when the user wants to rank A/B candidates, find persuadable-middle users, or compute a semantic gradient before shipping. Triggers on 产品反馈模拟, A/B 排序, SGO 梯度, persuadable middle, 50 个虚拟用户打分, 看看目标用户怎么想./npx claudepluginhub yrzhe/claude-skills --plugin persona-simOther plugins' skills for the same job