stateful-widget

stateful-widget is a skill for Claude Code, Codex from googlicius/obsidian-steward. It costs 33 tokens per session (2,712 once invoked), scanned A, original, MIT.

A workflow for building interactive HTML widgets whose runtime state survives closing and reopening a conversation note. It covers games, counters, quizzes, forms, and similar widgets.

In plain words
What is it for?
Use it when creating interactive demos or widgets that must remember clicks, typed values, scores, or other user actions.
Why use it?
It prevents user changes from being lost when the note is reopened, scrolled away from, or the widget code is updated.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating interactive demos or widgets that must remember clicks, typed values, scores, or other user actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/googlicius/obsidian-steward/stateful-widget
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.

Any agent
npx skills add googlicius/obsidian-steward --skill stateful-widget
Clone the repo
git clone --depth 1 https://github.com/googlicius/obsidian-steward

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for stateful-widget

README.md
[![agentmods](https://agentmods.dev/badge/skills/googlicius/obsidian-steward/stateful-widget/github.svg)](https://agentmods.dev/skills/googlicius/obsidian-steward/stateful-widget)
Your own site
<a href="https://agentmods.dev/skills/googlicius/obsidian-steward/stateful-widget"><img src="https://agentmods.dev/badge/skills/googlicius/obsidian-steward/stateful-widget/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for stateful-widget

Your own site · 80×15
<a href="https://agentmods.dev/skills/googlicius/obsidian-steward/stateful-widget"><img src="https://agentmods.dev/badge/skills/googlicius/obsidian-steward/stateful-widget.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,712 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 9 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Prompt Injection · line 40
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Memory Poisoning · line 162
    Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.
    Fix: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.
  • medium Memory Poisoning · line 164
    Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.
    Fix: Implement context-window management that detects and rejects padding or stuffing attempts. Prioritize system instructions over user-injected content.
  • medium Prompt Injection · line 162
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 164
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 165
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 166
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 167
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
  • medium Prompt Injection · line 168
    Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.
    Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
How audits are shown
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.1 $0.00033 $0.02712
Opus 5 $0.00016 $0.01356
Sonnet 5 $0.00007 $0.00542
Haiku 4.5 $0.00003 $0.00271

Measured 10d ago against content hash 07657ae3bc27, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

stateful-widget 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 10d ago.

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.

standard-skills/widget/stateful-widget/SKILL.md · 209 lines

How it starts

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

Stateful Widget Skill

Use this skill when creating interactive HTML project widgets (games, counters, quizzes, forms) where user actions must persist after the user closes and reopens the conversation note.

When to use

  • User asks for a game, interactive demo, counter, quiz, or any widget that changes based on clicks/keyboard input.
  • You use show_widget with project mode (files: [{ name, content }, ...]), not a single code blob.
  • State must survive: reopening the note, scrolling away and back, or editing widget code files (hot-reload).

Skip this pattern for static animations, one-shot diagrams, or SVG-only widgets with no runtime state.

How a widget is rendered

  • Create (show_widget): Writes project files under {stewardFolder}/Widgets/{widgetId}/ (index.html, main.js, style.css, Widget.md, etc.). widgetId = slugified widgetName + short unique suffix. Appends a stw-widget-project fence to the conversation note:

    <widgetId>
    
  • Mount (WidgetPostProcessor): When the note is displayed, the post-processor reads the fence, resolves {stewardFolder}/Widgets/{widgetId}, bundles the entry HTML (inlines linked CSS/JS from the project folder), injects window.stw for state and assets, and renders the bundle in a sandboxed iframe (srcdoc, allow-scripts, strict CSP, no network). Manifest assets are not inlined into HTML; the iframe requests allowed files from the host at runtime and creates local blob URLs.

  • Hot-reload: Edits to project files via edit trigger a re-bundle and iframe refresh.

Only project (HTML multi-file) widgets get the state bridge and state.json. Single-blob code widgets do not persist runtime state this way.

How state is managed

Piece Role
window.stw API injected into the iframe by the host (not written by you in vault files).
window.stw.getState() Returns last saved data object, or null on first load.
window.stw.setState(data) Saves a JSON-serializable snapshot; debounced ~400ms, then written to vault.
state.json Created lazily in the project folder on first successful setState. Host-owned; do not author or edit it manually.

Read the full file on GitHub · 209 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. 10d ago First seen · 209 lines · 33 tokens per session scan A 07657ae3bc27

Subscribe to this mod's changes

stateful-widget is a skill published in the GitHub repository googlicius/obsidian-steward (86 stars, last pushed 1mo ago), licensed MIT. It adds 33 tokens to every session and 2,712 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

spatie-guidelines

Spatie's PHP, Laravel, JavaScript and Vue coding guidelines and conventions. Use when writing or reviewing PHP, Laravel, JavaScript, or Vue code for Spatie projects or packages. Covers code style, type declarations, docblocks, control flow, naming, routing, controllers, Blade, validation, comments, testing (Pest)…

freekmurze/dotfiles · 113 tokens

laravel-inertia-react-structure

Frontend structure conventions for Laravel Inertia React applications based on Spatie's production practices. Use when creating, scaffolding, or reviewing frontend code in a Laravel Inertia React project. Triggers on creating React components, pages, modules, organizing frontend directories, setting up Inertia pages…

freekmurze/dotfiles · 88 tokens

react-best-practices

Provides React patterns for hooks, effects, refs, and component design. Covers escape hatches, anti-patterns, and correct effect usage. Must use when reading or writing React components (.tsx, .jsx files with React imports).

freekmurze/dotfiles · 52 tokens

livewire-4

Build Livewire 4 components and applications. Use when creating reactive Laravel interfaces, single-file components, multi-file components, page components, forms, actions, or any Livewire-based UI. Triggers include "Livewire component", "wire:model", "wire:click", building interactive Laravel UIs, or working with…

freekmurze/dotfiles · 75 tokens

worker-visualizer

A real-time data/particle/simulation visualizer whose heavy compute runs in a Web Worker (off the main thread), optionally sharing memory with the UI via SharedArrayBuffer, and renders to a canvas at 60fps. Produced as a single self-contained index.html. Use when the brief asks for a "web worker", "simulation"…

nexu-io/open-design · 123 tokens

develop-web-game

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with rendergametotext.

netease-youdao/LobsterAI · 64 tokens