widget-creator

widget-creator is a skill for Claude Code, Codex from mitchdenny/hex1b. It costs 46 tokens per session (7,131 once invoked), scanned A, original, MIT.

A step-by-step guide for creating widgets in Hex1b, a library for building terminal user interfaces. It covers the widget definition, state and rendering node, fluent helper methods, themes, and tests across the required files.

In plain words
What is it for?
Use it when adding a new Hex1b widget, including its configuration, state, rendering, public helper methods, colors or characters, reconciliation behavior, and unit tests.
Why use it?
It prevents a new widget from being only partly implemented or from breaking the library's established structure. The guide makes the pieces and order of work explicit.

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

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 widget-creator

README.md
[![agentmods](https://agentmods.dev/badge/skills/mitchdenny/hex1b/widget-creator.svg)](https://agentmods.dev/skills/mitchdenny/hex1b/widget-creator)
Your own site
<a href="https://agentmods.dev/skills/mitchdenny/hex1b/widget-creator"><img src="https://agentmods.dev/badge/skills/mitchdenny/hex1b/widget-creator.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,131 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.00046 $0.07131
Opus 5 $0.00023 $0.03565
Sonnet 5 $0.00009 $0.01426
Haiku 4.5 $0.00005 $0.00713

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

Security

Grade A, and why

widget-creator 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 4d 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.

.github/skills/widget-creator/SKILL.md · 958 lines

How it starts

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

Widget Creator Skill

This skill provides a comprehensive step-by-step guide for AI coding agents to create new widgets in the Hex1b TUI library. Widgets are the building blocks of Hex1b applications, following a declarative pattern inspired by React.

Overview

Creating a widget in Hex1b involves several coordinated files:

File Purpose
src/Hex1b/Widgets/{Name}Widget.cs Immutable widget record (describes what to render)
src/Hex1b/Nodes/{Name}Node.cs Mutable node class (manages state, renders)
src/Hex1b/{Name}Extensions.cs Fluent API extension methods
src/Hex1b/Theming/{Name}Theme.cs Theme elements (colors, characters)
tests/Hex1b.Tests/{Name}NodeTests.cs Unit tests

Step-by-Step Process

Step 1: Define the Widget Record

Widgets are immutable record types that describe the desired UI. They capture configuration and event handlers but contain no rendering logic.

Location: src/Hex1b/Widgets/{Name}Widget.cs

Key principles:

  • Use primary constructor parameters for required data
  • Use internal properties with init for optional configuration
  • Event handlers use Func<TEventArgs, Task>? pattern
  • Provide sync and async overloads for event handlers using this with { } pattern
  • Implement Reconcile() to create/update the corresponding node
  • Implement GetExpectedNodeType() to return the node type

Template:

using Hex1b.Events;
using Hex1b.Nodes;

namespace Hex1b.Widgets;

/// <summary>
/// Brief description of what the widget does.
/// </summary>
/// <param name="PrimaryProperty">Description of the main property.</param>
public sealed record MyWidget(string PrimaryProperty) : Hex1bWidget
{
    /// <summary>
    /// ActionId for the activate action. Use "WidgetName.ActionName" naming
    /// convention (PascalCase, omit "Widget" suffix from the widget name).
    /// Define one static readonly ActionId per rebindable action.
    /// </summary>
    public static readonly ActionId Activate = new($"{nameof(MyWidget)}.{nameof(Activate)}");

    /// <summary>
    /// Optional configuration property.
    /// </summary>
    internal bool SomeOption { get; init; }
    
    /// <summary>
    /// Event handler for some action.
    /// </summary>
    internal Func<MyEventArgs, Task>? ActionHandler { get; init; }

    /// <summary>
    /// Sets a synchronous action handler.
    /// </summary>
    public MyWidget OnAction(Action<MyEventArgs> handler)
        => this with { ActionHandler = args => { handler(args); return Task.CompletedTask; } };

    /// <summary>
    /// Sets an asynchronous action handler.
    /// </summary>
    public MyWidget OnAction(Func<MyEventArgs, Task> handler)
        => this with { ActionHandler = handler };

    internal override Hex1bNode Reconcile(Hex1bNode? existingNode, ReconcileContext context)
    {
        var node = existingNode as MyNode ?? new MyNode();
        
        // Mark dirty if properties changed
        if (node.PrimaryProperty != PrimaryProperty || node.SomeOption != SomeOption)
        {
            node.MarkDirty();
        }
        
        node.PrimaryProperty = PrimaryProperty;
        node.SomeOption = SomeOption;
        node.SourceWidget = this;
        
        // Convert typed event handler to internal handler if needed
        if (ActionHandler != null)
        {
            node.ActionCallback = async ctx => 
            {
                var args = new MyEventArgs(this, node, ctx);
                await ActionHandler(args);
            };
        }
        else
        {
            node.ActionCallback = null;
        }
        
        return node;
    }

    internal override Type GetExpectedNodeType() => typeof(MyNode);
}

Read the full file on GitHub · 958 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. 4d ago First seen · 958 lines · 46 tokens per session scan A 067b740e0368

Subscribe to this mod's changes

widget-creator is a skill published in the GitHub repository mitchdenny/hex1b (173 stars, last pushed 6d ago), licensed MIT. It adds 46 tokens to every session and 7,131 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

write-documentation

Write and format Rust documentation correctly. Apply proactively when writing code with rustdoc comments (//! or ///). Covers voice & tone, prose style (opening lines, explicit subjects, verb tense), structure (inverted pyramid), intra-doc links (crate:: paths, reference-style), constant conventions (binary/byte…

r3bl-org/r3bl-open-core · 0 tokens

organize-modules

Apply private modules with public re-exports (barrel export) pattern for clean API design. Includes conditional visibility for docs and tests. Use when creating modules, organizing mod.rs files, or before creating commits.

r3bl-org/r3bl-open-core · 47 tokens

check-bounds-safety

Apply type-safe bounds checking patterns using VPIndex/VPLength types instead of usize. Use when working with arrays, buffers, cursors, viewports, or any code that handles indices and lengths.

r3bl-org/r3bl-open-core · 46 tokens

check-code-quality

Run comprehensive Rust code quality checks including compilation, linting, documentation, and tests. Use after completing code changes and before creating commits.

r3bl-org/r3bl-open-core · 31 tokens

analyze-performance

Establish performance baselines and detect regressions using flamegraph analysis. Use when optimizing performance-critical code, investigating performance issues, or before creating commits with performance-sensitive changes.

r3bl-org/r3bl-open-core · 38 tokens

run-clippy

Run clippy linting, enforce comment punctuation rules, format code with cargo fmt, and verify module organization patterns. Use after code changes and before creating commits.

r3bl-org/r3bl-open-core · 36 tokens