Agent skill
huh
Interactive form library (Go) and patterns
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/huh
SKILL.md
Skill: huh
What I do
I provide huh form library expertise: building interactive terminal forms with field types (Input, Text, Select, MultiSelect, Confirm), groups, validation, theming, and accessible form patterns in Go.
When to use me
- Building interactive terminal forms for user input
- Choosing the right field type for each input
- Adding validation to form fields
- Grouping fields into multi-step forms
- Theming forms to match application style
Core principles
- Declarative form building - Define fields and groups, huh handles navigation
- Validation at field level - Validate each field independently with closures
- Groups for flow - Group related fields; each group is one "page"
- Accessible by default - huh handles focus, keyboard nav, screen readers
- Built on Bubble Tea - Forms are Bubble Tea models; compose with other components
Patterns & examples
Basic form with validation:
var name string
var email string
form := huh.NewForm(
huh.NewGroup(
huh.NewInput().
Title("Name").
Value(&name).
Validate(func(s string) error {
if len(s) < 2 {
return fmt.Errorf("name must be at least 2 characters")
}
return nil
}),
huh.NewInput().
Title("Email").
Value(&email).
Validate(func(s string) error {
if !strings.Contains(s, "@") {
return fmt.Errorf("invalid email address")
}
return nil
}),
),
)
err := form.Run()
if err != nil { log.Fatal(err) }
fmt.Printf("Hello, %s (%s)\n", name, email)
Select and MultiSelect:
var role string
var permissions []string
form := huh.NewForm(
huh.NewGroup(
huh.NewSelect[string]().
Title("Role").
Options(
huh.NewOption("Administrator", "admin"),
huh.NewOption("Editor", "editor"),
huh.NewOption("Viewer", "viewer"),
).
Value(&role),
huh.NewMultiSelect[string]().
Title("Permissions").
Options(
huh.NewOption("Read", "read"),
huh.NewOption("Write", "write"),
huh.NewOption("Delete", "delete"),
).
Value(&permissions),
),
)
Multi-step form with groups:
// ✅ Correct: each group is a step/page
form := huh.NewForm(
// Step 1: Personal info
huh.NewGroup(
huh.NewInput().Title("First Name").Value(&firstName),
huh.NewInput().Title("Last Name").Value(&lastName),
).Title("Personal Information"),
// Step 2: Preferences
huh.NewGroup(
huh.NewSelect[string]().Title("Theme").
Options(huh.NewOption("Dark", "dark"), huh.NewOption("Light", "light")).
Value(&theme),
huh.NewConfirm().Title("Enable notifications?").Value(¬ify),
).Title("Preferences"),
)
// ❌ Wrong: all fields in one giant group (overwhelming)
Confirm with description:
var proceed bool
huh.NewConfirm().
Title("Deploy to production?").
Description("This will affect 1,234 users").
Affirmative("Yes, deploy").
Negative("Cancel").
Value(&proceed)
Custom theme:
theme := huh.ThemeCharm() // or ThemeDracula(), ThemeCatppuccin()
form := huh.NewForm(groups...).WithTheme(theme)
Anti-patterns to avoid
- ❌ All fields in one group (break into logical steps for complex forms)
- ❌ Validation only after submit (validate per-field for immediate feedback)
- ❌ Ignoring
Run()error (user may cancel with Ctrl+C) - ❌ Complex logic in validators (keep validators simple; pre-process data)
- ❌ Hardcoded styles (use themes for consistent appearance)
KB Reference
~/vaults/baphled/3. Resources/Knowledge Base/AI Development System/Skills/UI-Frameworks/Huh.md
Related skills
huh-testing- Testing huh form componentsbubble-tea-expert- Bubble Tea framework that huh builds onux-design- User experience principles for form designgolang- Core Go patterns used with huh
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?