Community이미지github.com

stockflow-diagrams

Build publication-quality system dynamics diagrams — Forrester stock-and-flow diagrams (levels, rates, auxiliaries, constants, exogenous variables, delays, lookup tables, clouds) and causal loop diagrams with polarities and R/B loops — using the Stockflow MCP server or the `stockflow` CLI, and export them as PDF, EPS, SVG or PNG for papers, theses and slides. Use when the user asks for a Forrester diagram, stock-and-flow diagram, "diagrama de Forrester", "diagrama causal", causal loop diagram (CLD), feedback loop map or a system dynamics model drawing. Not for running simulations.

stockflow-diagrams란 무엇인가요?

stockflow-diagrams is a Claude Code agent skill that build publication-quality system dynamics diagrams — Forrester stock-and-flow diagrams (levels, rates, auxiliaries, constants, exogenous variables, delays, lookup tables, clouds) and causal loop diagrams with polarities and R/B loops — using the Stockflow MCP server or the `stockflow` CLI, and export them as PDF, EPS, SVG or PNG for papers, theses and slides. Use when the user asks for a Forrester diagram, stock-and-flow diagram, "diagrama de Forrester", "diagrama causal", causal loop diagram (CLD), feedback loop map or a system dynamics model drawing. Not for running simulations.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Jairodaniel-17/stockflow/tree/HEAD/skills/stockflow-diagrams

Installed? Explore more 이미지 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Stockflow: Forrester and causal loop diagrams

Stockflow draws system dynamics diagrams; it does not simulate. Prefer the MCP tools (diagram_*); if they are not available use the CLI (stockflow …, or node <repo>/bin/stockflow.js …). Both read and write the same store, and the live viewer (diagram_open / stockflow open) refreshes by itself.

Workflow

  1. Model first, then draw. List the stocks (what accumulates), the flows that fill/drain each stock, and the auxiliaries, constants and exogenous inputs that drive each flow. Decide every link's polarity.
  2. Create everything in one call with diagram_create (or stockflow create file.json). Omit x/y: the automatic layout places nodes. Set auto_loops: true to add R/B markers for the detected feedback loops.
  3. Check with diagram_analyze: fix every notation warning and confirm the loop polarities make sense.
  4. Look at it: diagram_render with preview: true returns a PNG. If labels cross or links are confusing, adjust with diagram_update (node x/y, link curve from -1.5 to 1.5, flow orient h/v, loop x/y) and preview again. Give fixed positions only to the nodes you move; the rest keeps auto-layout.
  5. Publish: set caption, figure, source, lang (es/en) and legend: true, then diagram_render with format: "pdf" (or eps, svg, png with dpi: 300). Report the file path(s).

JSON shape

{
  "title": "SIR epidemic", "type": "forrester", "auto_loops": true,
  "caption": "Stock-and-flow structure of the SIR model.", "figure": "1", "source": "Adapted from Sterman (2000).", "lang": "en", "legend": true,
  "nodes": [
    {"id": "s", "type": "stock", "label": "Susceptible"},
    {"id": "i", "type": "stock", "label": "Infected"},
    {"id": "infection", "type": "flow", "label": "Infection rate", "from": "s", "to": "i"},
    {"id": "births", "type": "flow", "label": "Births", "from": null, "to": "s"},
    {"id": "contact", "type": "constant", "label": "Contact rate"},
    {"id": "time", "type": "aux", "label": "Time", "shadow": true}
  ],
  "links": [
    {"from": "s", "to": "infection", "polarity": "+"},
    {"from": "contact", "to": "infection", "polarity": "+"}
  ],
  "loops": [{"type": "B", "nodes": ["s", "infection"], "label": "Depletion"}]
}

Node types: stock, flow (from/to = stock id or null for a cloud), aux, constant, exogenous, delay, table, cloud, variable (text node for causal diagrams). Spanish aliases work (nivel, flujo, auxiliar, constante, exogena, retardo, tabla, nube). Links reference node ids or labels. shadow: true draws <Name>. Links accept delay: true (‖ mark) and style: "solid"|"dashed".

Notation rules (the analyzer enforces most of them)

  • A stock changes only through flows. Never draw an information link into a stock; link into its flow instead.
  • Every flow needs at least one driver (an information link into it). Constants and exogenous variables receive no links.
  • In causal diagrams (type: "causal") every link needs a polarity. A loop with an even number of − links is reinforcing (R); an odd number makes it balancing (B). Flows count as + into their target stock and − into their source stock.
  • Keep labels as short noun phrases (variables, not verbs or sentences); they wrap automatically.
  • Mark only the loops that matter to the argument; trivial drain loops (stock ↔ own outflow) are skipped by auto_loops.

Styles

style: "academic" (default) is monochrome serif, ready for journals and grayscale print. Use style: "modern" (colour and animation) only for slides or web, when the user asks for it. Animated SVG is only produced in the modern style.

CLI quick reference

stockflow create model.json --loops            # full diagram from JSON
stockflow add <id> stock "Inventory"           # incremental edits
stockflow add <id> flow "Sales" --from inventory
stockflow link <id> demand sales +
stockflow analyze <id>
stockflow meta <id> --figure 2 --caption "…" --source "…" --lang en --legend
stockflow render <id> -o figure.pdf            # .eps .svg .png (--dpi 300)
stockflow open <id>                            # live viewer at http://localhost:4610

관련 스킬