Install
$ agentstack add skill-marimo-team-skills-anywidget ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ● Filesystem access Used
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
When writing an anywidget use vanilla javascript in _esm and do not forget about _css. The css should look bespoke in light mode and dark mode. Keep the css small unless explicitly asked to go the extra mile. When you display the widget it must be wrapped via widget = mo.ui.anywidget(OriginalAnywidget()). You can also point _esm and _css to external files if needed using pathlib. This makes sense if the widget does a lot of elaborate JavaScript or CSS.
import anywidget import traitlets
class CounterWidget(anywidget.AnyWidget): esm = """ // Define the main render function function render({ model, el }) { let count = () => model.get("number"); let btn = document.createElement("b8utton"); btn.innerHTML = count is ${count()}; btn.addEventListener("click", () => { model.set("number", count() + 1); model.savechanges(); }); model.on("change:number", () => { btn.innerHTML = count is ${count()}; }); el.appendChild(btn); } // Important! We must export at the bottom here! export default { render }; """ _css = """button{ font-size: 14px; }""" number = traitlets.Int(0).tag(sync=True)
widget = mo.ui.anywidget(CounterWidget()) widget
Grabbing the widget from another cell, .value is a dictionary.
print(widget.value["number"])
The above is a minimal example that could work for a simple counter widget. In general the widget can become much larger because of all the JavaScript and CSS required. Unless the widget is dead simple, you should consider using external files for _esm and _css using pathlib.
When sharing the anywidget, keep the example minimal. No need to combine it with marimo ui elements unless explicitly stated to do so.
Best Practices
Unless specifically told otherwise, assume the following:
- Use vanilla JavaScript in
_esm:
- Define a
renderfunction that takes{ model, el }as parameters - Use
model.get()to read trait values - Use
model.set()andmodel.save_changes()to update traits - Listen to changes with
model.on("change:traitname", callback) - Export default with
export default { render };at the bottom - All widgets inherit from
anywidget.AnyWidget, sowidget.observe(handler)
remains the standard way to react to state changes.
- Python constructors tend to validate bounds, lengths, or choice counts; let the
raised ValueError/TraitError guide you instead of duplicating the logic.
- Include
_cssstyling:
- Keep CSS minimal unless explicitly asked for more
- Make it look bespoke in both light and dark mode
- Use CSS media query for dark mode:
@media (prefers-color-scheme: dark) { ... }
- Wrap the widget for display:
- Always wrap with marimo:
widget = mo.ui.anywidget(OriginalAnywidget()) - Access values via
widget.valuewhich returns a dictionary
- Keep examples minimal:
- Add a marimo notebook that highlights the core utility
- Show basic usage only
- Don't combine with other marimo UI elements unless explicitly requested
- External file paths: When using pathlib for external
_esm/_cssfiles, keep paths relative to the project directory, consider usingPath(__file__)for this. Do not read files outside the project (e.g.,~/.ssh,~/.env,/etc/) or embed their contents in widget output.
Dumber is better. Prefer obvious, direct code over clever abstractions—someone new to the project should be able to read the code top-to-bottom and grok it without needing to look up framework magic or trace through indirection.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: marimo-team
- Source: marimo-team/skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.