Skip to content
Development
Skill

/algo-social-virality

\"Model viral spread dynamics using SIR/SIS/SEIR compartmental models. Use this skill when the user needs to predict content spread patterns, estimate viral thresholds, or model information cascades in social networks — even if they say 'will this go viral', 'epidemic model for

From plugin
awesome-agent-skill
27200 skills4 commands

Claude Code

$ npx -y skills add charlieviettq/awesome-agent-skill --skill algo-social-virality --agent claude-code

SKILL.md

algo-social-virality.SKILL.md
name: "\"algo-social-virality\""
description: "\"Model viral spread dynamics using SIR/SIS/SEIR compartmental models. Use this skill when the user needs to predict content spread patterns, estimate viral thresholds, or model information cascades in social networks — even if they say 'will this go viral', 'epidemic model for content', or 'spread prediction'.\"."
allowed-tools: Read, Glob, Grep

Viral Spread Models

Overview

Compartmental models (SIR, SIS, SEIR) model how content/information spreads through populations. Susceptible → Infected → Recovered mirrors unaware → sharing → stopped sharing. Key metric: R0 (basic reproduction number). Solves as ODEs in O(T × N) for T timesteps, N compartments.

When to Use

**Trigger conditions:**

  • Modeling how content spreads through a social network
  • Estimating whether a campaign will achieve viral threshold
  • Analyzing post-hoc spread dynamics of viral events

**When NOT to use:**

  • When predicting individual user behavior (use influence scoring)
  • When measuring engagement metrics (use engagement rate calculator)

Algorithm

IRON LAW: Viral Spread Occurs ONLY When R0 > 1
R0 = transmission rate (β) / recovery rate (γ).
Below R0 = 1, content dies out regardless of initial seed size.
Above R0 = 1, exponential growth phase begins before saturation.
Design interventions (seeding, incentives) to push R0 above threshold.

Phase 1: Input Validation

Define: population size (N), initial seed size (I₀), transmission rate (β — probability of sharing upon exposure), recovery rate (γ — rate of losing interest). **Gate:** Parameters non-negative, β and γ estimated from historical data or assumed.

Phase 2: Core Algorithm

**SIR Model:** dS/dt = -βSI/N, dI/dt = βSI/N - γI, dR/dt = γI 1. Initialize: S=N-I₀, I=I₀, R=0 2. Iterate using Euler method or RK4 at discrete timesteps 3. Track peak infected (maximum simultaneous sharers) and total ever-infected

**SIS variant:** No recovery to immune state — recovered become susceptible again (recurring content).

Phase 3: Verification

Check: S+I+R = N at all timesteps (conservation). Peak and final sizes plausible for given R0. **Gate:** Population conserved, dynamics consistent with R0.

Phase 4: Output

Return time series of compartments and summary metrics.

Output Format

{
  "time_series": [{"t": 0, "S": 9900, "I": 100, "R": 0}],
  "summary": {"R0": 2.5, "peak_infected": 3200, "peak_day": 12, "total_infected": 8500},
  "metadata": {"model": "SIR", "beta": 0.5, "gamma": 0.2, "population": 10000}
}

Examples

Sample I/O

**Input:** N=10000, I₀=10, β=0.3, γ=0.1 (R0=3.0) **Expected:** Exponential growth, peak ~4000 at day ~15, total infected ~9500

Edge Cases

| Input | Expected | Why | |-------|----------|-----| | R0 = 0.8 | Rapid decay | Below threshold, dies out | | I₀ = 1 | Slower start but same eventual dynamics | Single seed takes longer to ignite | | β = γ (R0=1) | Linear, no growth | Critical threshold, endemic equilibrium |

Gotchas

  • **Homogeneous mixing assumption**: SIR assumes everyone interacts equally. Real networks have hubs, clusters, and weak ties. Use network-based models for realistic spread.
  • **Parameter estimation**: β and γ are hard to estimate for social content. Use early spread data to fit parameters, then project.
  • **Content ≠ disease**: Unlike diseases, content sharing is voluntary and influenced by content quality, platform algorithms, and trends. Models give rough dynamics, not precise predictions.
  • **Platform algorithms**: Social media algorithms amplify or suppress content. The "transmission rate" is partly determined by the platform, not just user behavior.
  • **Temporal dynamics**: Content virality often has a much shorter lifecycle than disease (hours-days vs weeks-months). Adjust timescales accordingly.

References

  • For network-based epidemic models, see `references/network-sir.md`
  • For parameter estimation from early data, see `references/parameter-fitting.md`
Read more
@charlieviettq
Ships withawesome-agent-skill

Curated skill pack for LLM agents in engineer and science workflow (Cursor & Claude ready).

Stars on GitHub

Momentum

stars in total
27
Star history of charlieviettq/awesome-agent-skill on GitHub, a chart by star-history.com

Other skills on awesome-agent-skill.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about algo-social-virality.

Which coding agents can use algo-social-virality?
algo-social-virality installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.