golem-add-config-moonbit

Adds typed configuration and secrets to MoonBit Golem agents using derive macros.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-add-config-moonbit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-add-config-moonbit
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/moonbit/golem-add-config-moonbit
Command: npx skills add https://github.com/golemcloud/golem --skill golem-add-config-moonbit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers building MoonBit agents on Golem need a code-first way to declare, inject, and validate typed configuration and secrets instead of manually parsing raw environment values at runtime.

Core Features & Use Cases

  • Typed Config Derivation: Annotate structs with #derive.config to auto-generate schema collection and typed loading via ConfigField trait implementations.
  • Constructor Injection: Add a @config.Config[T] parameter to the agent's new function so the platform validates and loads all config at construction time.
  • Secret Management: Wrap sensitive fields in @config.Secret[T] so values are fetched dynamically per environment via get!() rather than cached at startup.
  • Use Case: Define an AppConfig struct with a nested DatabaseConfig containing a secret password, declare values in golem.yaml, and manage secrets with golem secret create CLI commands.

Quick Start

Add typed configuration to my MoonBit Golem agent with a nested database config and a secret password field.

Frequently Asked Questions about golem-add-config-moonbit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add typed configuration to a MoonBit Golem agent?

Annotate a struct with #derive.config to generate ConfigField implementations, then add a @config.Config[T] parameter to the agent's new function. The platform loads and validates all config values at agent construction time, accessible via self.config.value.

How do I manage secrets in a MoonBit Golem agent?

Wrap sensitive fields in @config.Secret[T] inside your config struct and retrieve values with get!(). Secrets are stored per environment and fetched dynamically on each call, managed via secretDefaults in golem.yaml or the golem secret create CLI command.

What field types does #derive.config support in MoonBit?

Supported types include String, Bool, Int, UInt, Int64, UInt64, Float, Double, Byte, Char, Bytes, plus optional T?, Array[T], Result[T, E], and nested #derive.config structs. Generic structs and config types nested inside containers are not supported.

Can I nest config structs inside Option or Array in MoonBit?

No, #derive.config types cannot be nested inside Option, Array, Result, or Tuple containers. Only direct nesting of one config struct inside another is allowed, and Secret cannot wrap a derived config type.

When are config values loaded in a Golem MoonBit agent?

Regular config values are loaded once during agent construction via @config.load_config(). Secret values are not cached; each get!() call fetches the current value from the host, and the platform validates all required values at deploy time.