agentleFS
mo-cmykmo-cmyk/mazarbul/.claude/skills/tui-component-browser/SKILL.md

tui-component-browser

Skill2 starsChanged 34 days agoApache-2.0View on GitHub

Before writing a new TUI feature, browse the Charm component libraries for existing components. USE WHEN starting a new Bubble Tea screen, picking between custom and existing components, or unsure which component fits. Uses WebFetch to grab the source of relevant components from charmbracelet/bubbles and charmbracelet/huh.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before writing a custom Bubble Tea component, check the Charm libraries.

    line 9
  2. Distinctive:

    Match the need to a component: Use the table below as a starting point.

    line 19
  3. Distinctive:

    Read the component source: If a candidate exists, fetch its source to confirm the API fits:

    line 21
  4. Distinctive:

    Decide: Use the existing component unless it provably doesn't fit.

    line 25
  5. Distinctive:

    If you're rolling your own:

    line 55
  6. Very specific:

    Follow the same Init/Update/View pattern as bubbles.

    line 58
  7. Distinctive:

    Add a snapshot test.

    line 59
  8. Very specific:

    Help text consistency: Use bubbles/help.Model with key.NewBinding(key.WithHelp(...)) so every screen's help row reads the same way.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TUI Component Browser

Before writing a custom Bubble Tea component, check the Charm libraries. Reinventing burns time and ships inconsistent UX.

Workflow

  1. Identify the need. What does the user need to do? (Pick, type, scroll, watch progress, see a list, edit a long string, confirm.)
  2. Browse the catalog. Fetch the index of each library:
    • WebFetch https://github.com/charmbracelet/bubbles -> see the README's component list.
    • WebFetch https://github.com/charmbracelet/huh -> see the README's form primitives.
  3. Match the need to a component. Use the table below as a starting point.
  4. Read the component source. If a candidate exists, fetch its source to confirm the API fits:
    • WebFetch https://github.com/charmbracelet/bubbles/blob/master/<component>/<component>.go
    • WebFetch https://github.com/charmbracelet/huh/blob/main/<primitive>.go
  5. Decide. Use the existing component unless it provably doesn't fit. "It would feel slightly different" is not a reason to roll your own.

Need -> component map

NeedLibraryComponentNotes
Pick from a list (single)huhhuh.NewSelect[T]Form primitive, embed in form or use standalone.
Pick from a list (multi)huhhuh.NewMultiSelect[T]Same as above.
Free text inputhuhhuh.NewInputValidation, masking, placeholder support.
Confirm yes/nohuhhuh.NewConfirmDefault focus on the safe option.
Note / instructionhuhhuh.NewNoteMarkdown-style content step.
Loading spinnerbubblesspinner.New(spinner.Moon)Moon for thinking, Dot for short waits.
Measurable progressbubblesprogress.New()Animate via progress.IncrPercent.
Scrollable viewbubblesviewport.New(w, h)Set content via viewport.SetContent.
Selectable listbubbleslist.New(items, delegate, w, h)Built-in filter and pagination.
Tabular databubblestable.New(...)Sortable columns, keyboard navigation.
Pagination controlbubblespaginator.New()Dots-style page indicator.
Single-line text inputbubblestextinput.New()Lower-level than huh.NewInput.
Multi-line text inputbubblestextarea.New()For longer-form editing.
File pickerhuhhuh.NewFilePickerBrowse + pick a path.
Key bindingsbubbleskey.NewBindingCentralizes help text and binding.
Help panelbubbleshelp.New()Renders key bindings as a help row.

When to roll your own

Custom components are justified when:

  • The interaction model doesn't exist in either library (rare).
  • The visual treatment requires a layout primitive not in lipgloss.
  • The component is genuinely Mazarbul-specific (e.g. the Watchword block, the entity provenance trail).

If you're rolling your own:

  • Live under internal/tui/<screen>/components/ if scoped to one screen.
  • Live under internal/tui/components/ if shared across screens.
  • Follow the same Init/Update/View pattern as bubbles.
  • Add a snapshot test.

Reading the source

Charm code is small and readable. When in doubt, read the component's view.go and update.go. The conventions you'll pick up apply across the whole stack.

Gotchas

  • Different Update signatures. Some components return tea.Cmd, some return (Model, tea.Cmd). Read before integrating.
  • Theme integration. Some components accept a styles struct (e.g. list.DefaultStyles()). Override via internal/tui/style.Theme accessors, not raw hex.
  • Key binding conflicts. Embedded components may bind keys that the host model also wants. Use key.Binding.SetEnabled(false) to suppress when the host has focus.
  • Help text consistency. Use bubbles/help.Model with key.NewBinding(key.WithHelp(...)) so every screen's help row reads the same way.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.