yrzhe/claude-skills/persona-sim
Claude Code and agent skill by yrzhe/claude-skills
- community
Checking that the SKILL.md file is still in the repository.
Simulate 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, 用虚拟人群测试, 模拟民意, 投票预测模拟.
Install
npx vskill@latest install yrzhe/claude-skills/persona-simSKILL.md
Persona Sim
Simulate feedback from census-grounded virtual populations. Five layers, each independently replaceable:
First-time setup (not optional)
Dependencies and config live outside the skill under ~/.claude/data/personas/ so sharing the skill never leaks keys. See SETUP.md for the full walk-through. Short version:
Always invoke with the venv interpreter:
When to use
- "Score this copy/feature with 100 virtual target users" →
sim_engine.panel_score() - "Find the persuadable middle for this tweet" →
sim_engine.sgo() - "Predict the US opinion distribution for this policy" →
panel_score()+ segment breakdown - "Which of these two pricing variants wins?" →
sgo()with anchored counterfactual probes
In-code API
Filter semantics (commonly misused)
sample_personas(filters={...}) interprets values by Python type:
| Filter value | Match behavior | |
|---|---|---|
(low, high) tuple of numbers | inclusive range (low <= rv <= high) | |
[...] list | membership (rv in list) | |
"substring" string | case-insensitive substring in str(rv) — great for free-text occupation_isco | |
| other (int/str literal) | equality |
Missing field on row (rv is None) → row rejected.
Default `adults_only=True` injects age=(18, 120) unless you pass your own age filter. Nemotron data includes children with synthetic professional_persona fields — always filter them out for work/product panels.
Six non-obvious rules (READ BEFORE ANY CHANGE)
- Narrative > demographic stub. Park et al. 2024 proved demographic-only prompts amplify stereotypes.
_persona_cardputs Nemotron's longprofessional_personanarrative FIRST; demographics are a footnote. - Never output a single mean. Output distribution + segment breakdown +
disagreement_flag. High variance = signal, not noise. - Prompt caching is mandatory for panels. System + task are identical across N personas; with cache_read at 10% of base, a 50-persona panel costs ~1/10 of naive. Cache breakpoint goes BEFORE the persona card (which varies per row).
- SGO uses ANCHORED counterfactuals. The probe re-injects the persona's original score + reason so the delta is causal (attribution to the change), not two independent scorings. See
_anchored_delta_oneinsim_engine.py. - Persuadable middle = score 4–7 only. 1–3 never buys; 8+ already sold. Don't waste LLM calls on extremes.
- Calibration disclaimer is required. Tjuatja 2311.04076 + Bisbee 2024 proved LLM synthetic samples lack human response biases (acquiescence, anchoring, framing). Every public-facing result must include the
warningfield.
Empirical validation
Smoke-tested on Nemotron-USA + Haiku 4.5:
| Panel | Filter | Median | IQR | Persuadable middle | |
|---|---|---|---|---|---|
| Generic (n=5) | none | 2 | — | 0/5 | |
| Software devs (n=30) | occupation_isco~"software", age (22,55) | 7 | (7, 8) | 19/30 |
Same product, different panel → median shifts from 2 to 7. Personas play roles faithfully; single dissenter at 3 had concrete reasoning. SGO has enough signal when targeting is correct.
LLM routing
Active provider set in ~/.claude/data/personas/config.json → provider field. Three shapes supported:
anthropic(native) — Anthropic SDK withANTHROPIC_API_KEY; supports prompt cachinganthropicwithbase_urloverride — for custom Anthropic-compatible gateways (enterprise proxies, Vertex-routed gateways, etc.)openai(gateway-compatible) — OpenRouter, vLLM, Together, Groq, etc.
Escalate to gradient_model (default Sonnet 4.5) for:
- SGO anchored counterfactual (fine-grained semantic judgment)
- Bias audit probes (framing / order / authority)
- Long-narrative fidelity eval
See data/config.example.json for template config blocks.
Data fetch flow (streaming works without any download)
MVP runs entirely on HF streaming — no local copy needed. Only fetch when you're running many panels and want the speed:
manifest.json per-dataset default_mode:
local→ prompts to download on first usestream→ direct HF streaming (default for MVP)ask→ shows license + manual-download URL
redistribute: false entries (most Nemotron / PersonaHub / WVS / CGSS) are NEVER bundled when sharing the skill — each user fetches them per license terms.
Bias audit
lib/bias_audit.py tests whether LLM personas reproduce four known human biases:
| Probe | What it measures | Human typical | LLM typical | |
|---|---|---|---|---|
| framing | Tversky-Kahneman gain/loss reframe | +0.25 to +0.50 shift | ~0 (none) | |
| acquiescence | agree-bias on symmetric statements | +0.10 to +0.20 excess | ~0 (logical) | |
| order | primacy/recency on option list | 0.05-0.15 TV distance | <0.03 | |
| authority | "experts say" prefix shift | +0.10 to +0.20 | +0.00 to +0.05 |
Results flagged with calibration warnings. Run before publishing any survey-style prediction.
Subagent pattern (for n > 200)
Main agent aggregates per-slice distributions to avoid context bloat.
Known gaps
- Chinese persona data pipeline is scaffolded (
references/chinese_pipeline.md) but not implemented — see that file for the 3-source recipe (census + WVS + LLM narrative). demo_corrsuite requires persona income field (not in Nemotron); currently skips that dimension.- ANES demographic correlation reference values are approximations — re-verify against the official codebook before publishing.
Resources
lib/{fetch,sampler,llm_router,sim_engine,aggregator,bias_audit,ipf}.py— core layersprompts/persona_system.md— narrative-first system prompt with anti-agreeable guardrailsprompts/sgo_gradient.md— anchored counterfactual templateeval/run_eval.py+eval/*.json— 6-suite score card (gss_20q, bfi44, test_retest, diversity, demo_corr, bias_audit)references/methodology.md— Park 2024, Santurkar, SGO, CoBRA, Tjuatja synthesisreferences/datasets.md— dataset inventory + field mapsreferences/chinese_pipeline.md— scaffold for Chinese persona synthesisscripts/smoke_test.py,scripts/smoke_test2.py— minimal working examplesSETUP.md— venv + config bootstraprequirements.txt— pinned depsdata/manifest.json— dataset registry (safe to share)data/config.example.json— sanitized LLM config template
Eval loop
Target: overall >= 0.75. If any dimension fails, that dimension is the highest-priority edit target for the next iteration.
Scenario skills
Three thin scenario wrappers ship alongside the core. They route into persona-sim's API with opinionated defaults for common use cases:
- `product-feedback-sim` — SGO ranking for product/copy/pricing candidates
- `vote-predict` — categorical opinion prediction with IPF post-stratification
- `social-sandbox` — what-if experiments with open-ended narrative clustering
Each has its own SKILL.md with a full recipe.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/persona-sim/skills/persona-sim/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
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/yrzhe/claude-skills/persona-sim)