Forge Auto Widget Layout logo

Forge Auto Widget Layout

Community
Nebulavenus
forge-auto-widget-layout

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-auto-widget-layout
Stars
46
Forks
7
Bundled files
Instructions only
LicenseZlib
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Nebulavenus on GitHub. Read the source before you install it.

Installation

Install the Forge Auto Widget Layout AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-auto-widget-layout .claude/skills/forge-auto-widget-layout
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Auto Widget Layout in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Forge Auto Widget Layout on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Forge Auto Widget Layout is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Add automatic widget positioning to any application that uses ForgeUiContext. Based on UI Lesson 08.

When to use

  • You have an immediate-mode UI with manually computed widget rects and want to automate placement
  • You need a vertical panel of stacked widgets (labels, checkboxes, sliders)
  • You need a horizontal row of buttons or controls side by side
  • You need nested layouts (a vertical panel containing a horizontal button row)
  • You want to change padding or add/remove widgets without recalculating every rect by hand

Key API calls

  • forge_ui_ctx_layout_push(ctx, rect, direction, padding, spacing) — push a layout region onto the stack
  • forge_ui_ctx_layout_pop(ctx) — pop and return to the parent layout
  • forge_ui_ctx_layout_next(ctx, size) — return the next widget rect and advance the cursor
  • forge_ui_ctx_label_layout(ctx, text, size, r, g, b, a) — label placed by the current layout
  • forge_ui_ctx_button_layout(ctx, id, text, size) — button placed by the current layout
  • forge_ui_ctx_checkbox_layout(ctx, id, label, value, size) — checkbox placed by the current layout
  • forge_ui_ctx_slider_layout(ctx, id, value, min, max, size) — slider placed by the current layout

Correct order

  1. Push a layout with a bounding rect, direction, padding, and spacing
  2. Declare widgets using _layout() variants — each call advances the cursor automatically
  3. For nested layouts: call layout_next() to reserve a sub-rect from the parent, then layout_push() inside that rect
  4. Pop nested layouts before continuing in the parent
  5. Pop the root layout when done

Every layout_push() must have a matching layout_pop() — including on error paths. Unmatched pushes are logged as warnings by forge_ui_ctx_end().

Key concepts

  1. Layout cursor — a position (x, y) that starts at the top-left content area (after padding) and advances after each widget
  2. Direction — FORGE_UI_LAYOUT_VERTICAL advances downward (widgets get full width, caller specifies height); FORGE_UI_LAYOUT_HORIZONTAL advances rightward (widgets get full height, caller specifies width)
  3. Padding — uniform inset from all four edges of the layout rect
  4. Spacing — gap inserted before each widget except the first
  5. Size parameter — the widget dimension along the layout's primary axis (height for vertical, width for horizontal); the cross-axis dimension is filled automatically
  6. Layout stack — up to FORGE_UI_LAYOUT_MAX_DEPTH (8) nested layouts
  7. Spacing-before-item model — spacing is added before each item (except the first), keeping remaining_h/remaining_w accurate

Common mistakes

  1. Forgetting layout_pop() — every push needs a pop on every code path, including early returns from failed nested pushes
  2. Using standard widget API inside a layout — use _layout() variants (button_layout, checkbox_layout) to get automatic positioning; the standard API (button, checkbox) still requires explicit rects
  3. Wrong size parameter — in a vertical layout, size is height; in a horizontal layout, size is width. Passing the wrong dimension produces unexpectedly stretched or squished widgets
  4. Not reserving a sub-rect for nested layouts — call layout_next(row_h) first to get the sub-rect, then push a new layout inside it. Pushing a layout with the full parent rect would overlap existing widgets
  5. Exceeding stack depth — layout_push() returns false if the stack overflows (8 levels max). Always check the return value

Ready-to-use template

Vertical panel with mixed widgets

c
#define PANEL_PADDING    16.0f   /* inset from panel edges */
#define WIDGET_SPACING    8.0f   /* vertical gap between widgets */
#define LABEL_HEIGHT     30.0f   /* height of a label row */
#define CHECKBOX_HEIGHT  28.0f   /* height of a checkbox row */
#define BUTTON_HEIGHT    34.0f   /* height of a button */
#define SLIDER_HEIGHT    32.0f   /* height of a slider */
#define BUTTON_SPACING   10.0f   /* horizontal gap between buttons */

ForgeUiRect panel = { x, y, w, h };

/* Draw panel background */
forge_ui__emit_rect(ctx, panel, bg_r, bg_g, bg_b, bg_a);

/* Push vertical layout for the panel */
if (!forge_ui_ctx_layout_push(ctx, panel,
                              FORGE_UI_LAYOUT_VERTICAL,
                              PANEL_PADDING, WIDGET_SPACING)) {
    return;
}

/* Title label */
forge_ui_ctx_label_layout(ctx, "Settings", LABEL_HEIGHT,
                          title_r, title_g, title_b, title_a);

/* Checkboxes */
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_1, "Option A",
                                   &option_a, CHECKBOX_HEIGHT);
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_2, "Option B",
                                   &option_b, CHECKBOX_HEIGHT);

/* Horizontal button row */
ForgeUiRect btn_row = forge_ui_ctx_layout_next(ctx, BUTTON_HEIGHT);

if (!forge_ui_ctx_layout_push(ctx, btn_row,
                              FORGE_UI_LAYOUT_HORIZONTAL,
                              0.0f, BUTTON_SPACING)) {
    forge_ui_ctx_layout_pop(ctx);  /* pop outer before returning */
    return;
}

float btn_w = (btn_row.w - BUTTON_SPACING) * 0.5f;
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_OK, "OK", btn_w);
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_CANCEL, "Cancel", btn_w);

forge_ui_ctx_layout_pop(ctx);  /* end horizontal row */

/* Slider */
(void)forge_ui_ctx_slider_layout(ctx, ID_SLIDER, &value,
                                 0.0f, 100.0f, SLIDER_HEIGHT);

forge_ui_ctx_layout_pop(ctx);  /* end vertical panel */

Key observations

  • The 0.5f in btn_w is inherent math (dividing by 2), not a magic number
  • layout_next() returns a rect from the outer vertical layout, which becomes the bounds for the inner horizontal layout
  • The inner layout_push error path pops the outer layout before returning
  • Widget return values can be (void) cast when the result is not needed

Reference

Frequently asked questions

What does the Forge Auto Widget Layout AI skill do?

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Why use Forge Auto Widget Layout on TypingMind?

Because you install it once and use it with any model. Forge Auto Widget Layout is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Forge Auto Widget Layout in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Forge Auto Widget Layout?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Forge Auto Widget Layout?

As many as you like. As long as a model supports skills, you can use Forge Auto Widget Layout with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Forge Auto Widget Layout AI skill free?

Yes. It is published on GitHub by Nebulavenus under the Zlib license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇