write-widget

A guide for writing an n-dashboard widget: a TypeScript function that returns the data for a dashboard card.

In plain words
What is it for?
Use it to add or change dashboard cards, choose how they are triggered or whether they keep history, and debug widgets that fail or show old data.
Why use it?
It helps you follow the widget's required data types and validation rules, reducing errors such as rejected results, wrong card shapes, or stale data.

Skill for Claude CodeCodex

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 skills/devapro/n-dashboard/write-widget
Any agent
npx skills add devapro/n-dashboard --skill write-widget
Clone the repo
git clone --depth 1 https://github.com/devapro/n-dashboard

Made for: Claude Code, Codex.

Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,696 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00071 $0.02696
Opus 5 $0.00036 $0.01348
Sonnet 5 $0.00014 $0.00539
Haiku 4.5 $0.00007 $0.00270

Measured 2d ago against content hash 7e375381fa68, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

write-widget scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -X POST localhost:8080/api/widgets -H 'content-type: application/json' \
.claude/skills/write-widget/SKILL.md · 201 lines

How it starts

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

Writing an n-dashboard widget

A widget is one function on disk. The platform decides when to call it (clock, MQTT message, webhook, manual), validates what it returns against its kind's schema, and pushes the result to open tabs over SSE. There is no plugin format and no config-driven renderer, so summing a field, joining two APIs and remembering what you already saw are all ordinary code.

Read these first, in this order

Do not write a widget from memory of this file — the API is defined in the repo and this skill can drift from it.

  1. src/shared/ctx.d.tsthe single source of truth for Ctx and for every kind's data type. Read the type you are about to return, in full.

  2. src/shared/kinds/<kind>.ts — the runtime Zod schema, the sample and the starter template for that kind. The schema is what actually rejects a result.

  3. The closest examples/*/widget.ts — each one exists to teach a specific part of the API and is heavily commented. Pick by what you need:

    need example
    HTTP JSON → one number crypto-price
    an API key stock-quote
    summing / reshaping an array api-sum
    MQTT, plus recorded history office-temp
    reading history back as a chart temp-history
    GraphQL (and why res.ok is not enough) github-prs, github-approvals
    a webhook and a poll in one widget slack-unread
    signed JWT + a token cached in ctx.state bigquery-query
    Google Calendar (same code on either auth path) next-meetings
    threshold bands disk-usage
    HTTP Basic + asking an API for fewer fields jira-jql

The two files

data/widgets/<id>/
  widget.json      config — kind, triggers, history, timeout
  widget.ts        the function
  state.json       ctx.state, written back after each successful scheduled run
  history.ndjson   append-only, trimmed to the retention window

widget.json, validated by widgetConfigSchema in src/shared/widget.ts:

Read the full file on GitHub · 201 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 201 lines · 71 tokens per session scan A 7e375381fa68

Subscribe to this mod's changes

write-widget is a skill published in the GitHub repository devapro/n-dashboard (11 stars, last pushed 1mo ago), licensed MIT. It adds 71 tokens to every session and 2,696 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

olares-chart

Olares app packaging and chart authoring via olares-cli chart — port a repo, docker-compose, or generic Helm chart; build/push the image; author, lint, package, and deploy an OlaresManifest; wire storage, middleware, entrances, env, and GPU; edit the chart after diagnosis. Runtime failure diagnosis is olares-doctor…

beclab/Olares · 85 tokens

olares-router

Olares models via olares-cli router — Router (the AI gateway) and the Model Console inside a locally installed model application. Configure cloud vendors and their models, manage local LLM / embedding / audio / OCR model applications, edit a local model's card, name models with aliases, groups and default categories…

beclab/Olares · 202 tokens

olares-files

Olares Files via olares-cli files — browse known paths; upload or download file bytes; edit, share, mount SMB/NFS, compress/extract archives, and manage Seafile sync across Drive/cache/external/cloud. Use for Olares Files and LarePass Files operations, not URL/yt-dlp/torrent download tasks (olares-knowledge).

beclab/Olares · 77 tokens

olares-settings

Olares Settings via olares-cli settings — mirror the Settings SPA: users, apps, VPN, network, backup, integrations, GPU/compute, search-index directories/rebuild, and me/whoami. Use for system or post-install app configuration; not for querying file contents with olares-search.

beclab/Olares · 65 tokens

olares-shared

Foundation for the olares-cli skill suite: choose the right domain skill, understand the Olares platform model each task depends on, and decide whether the active profile can proceed or needs login recovery. Use first for runtime skills, and directly for Olares ID, profile, login, 2FA/TOTP, refresh token, keychain…

beclab/Olares · 87 tokens

olares-cluster

Olares ControlHub K8s runtime view via olares-cli cluster — inspect pods, containers, workloads, logs, jobs, cronjobs, namespaces, nodes, and middleware; exec, scale, restart, or delete K8s objects. Use for raw runtime objects and logs, not app lifecycle (market), resource metrics (dashboard), or host install.

beclab/Olares · 77 tokens