vanjs-core

A set of rules for using VanJS, a small JavaScript library that builds web pages directly with browser elements and supports reactive state.

In plain words
What is it for?
Use it when creating or modifying VanJS interfaces, including components, mutable state, derived values, and automatic page updates.
Why use it?
It gives the coding agent a consistent reference for VanJS's element-building and state APIs when working on VanJS code.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/benallfree/vibescale/vanjs-core
Clone the repo
git clone --depth 1 https://github.com/benallfree/vibescale

Made for: Cursor.

Per session 5 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,344 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00005 $0.01344
Opus 5 $0.00003 $0.00672
Sonnet 5 $0.00001 $0.00269
Haiku 4.5 $0.00001 $0.00134

Measured yesterday against content hash 150b785e2416, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

vanjs-core scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/vanjs-core.mdc · 253 lines

How it starts

The opening of the file, as written. The whole thing — 253 lines — stays where its author put it; the contents beside it link to each section on GitHub.

VanJS Core Documentation

Core API Structure

const van = {
  tags: {}, // HTML/SVG tag functions
  add: (dom, ...children) => dom, // Add children to DOM element
  state: (initVal) => State, // Create reactive state
  derive: (f) => State, // Create derived state
  hydrate: (dom, f) => void // Hydrate SSR components
}

Key Concepts

1. DOM Composition

  • Tag functions create DOM elements directly (no virtual DOM)
  • Elements can have properties and child nodes
  • Supports both HTML and SVG elements via namespace

2. State Management

  • State objects represent mutable values
  • States have a .val property for getting/setting
  • Derived states update automatically based on dependencies
  • State bindings update DOM when state changes

3. State Binding Types

  • Property binding: Bind state to element property
  • Child binding: Bind state as child node
  • Derived binding: Complex bindings with computation

Core APIs

van.tags

  • Creates DOM elements
  • Parameters: [props], ...children
  • Returns: DOM Element
  • Props can be primitive values or state objects

van.state(initVal)

  • Creates reactive state
  • Parameters: initial value
  • Returns: State object with .val property

van.derive(f)

  • Creates derived state
  • Parameters: derivation function
  • Returns: State object that auto-updates

van.add(dom, ...children)

  • Adds children to DOM element
  • Parameters: target DOM, child nodes
  • Returns: target DOM element

van.hydrate(dom, f)

  • Hydrates SSR components with reactivity
  • Parameters:
    • dom: Existing SSR DOM node
    • f: Function returning hydrated component
  • Returns: undefined
  • Example:
van.hydrate(document.getElementById('app'), (dom) =>
  Counter({
    init: Number(dom.getAttribute('data-count')),
  })
)

DOM Implementation Details

Namespace Support

// Create elements with custom namespace
const { circle, path, svg } = van.tags('http://www.w3.org/2000/svg')
const { math, mi, mn } = van.tags('http://www.w3.org/1998/Math/MathML')

Read the full file on GitHub · 253 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 253 lines · 5 tokens per session scan A 150b785e2416

Subscribe to this mod's changes

vanjs-core is a cursor rule published in the GitHub repository benallfree/vibescale (4 stars, last pushed 1y ago), licensed MIT. It adds 5 tokens to every session and 1,344 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.