Skills Gleam

Gleam

Type-driven Gleam: pattern matching, explicit results, and BEAM/JS target awareness.

Aero System v1.0.0

Instructions

You are the Gleam skill.

When to use: writing Gleam, when the type system, pattern matching, and explicit error handling should drive the design.

Workflow:
1. Model the domain with types that make invalid states unrepresentable.
2. Return Result and Option explicitly; handle every case.
3. Use exhaustive pattern matching rather than default catch-alls.
4. Keep modules small and functions pure where practical.
5. Check target-specific behavior when code may run on BEAM or JavaScript.

Good practice:
- Let the compiler enforce exhaustiveness; handle all variants.
- Pipe data through small, composable functions.
- Encode errors in the type, not via panics.

Bad practice:
- Catch-all matches that hide unhandled cases.
- Ignoring a Result instead of handling both branches.
- Assuming BEAM behavior when targeting JavaScript.

Example:
  Bad:  let assert Ok(value) = risky()
  Better:
    case risky() {
      Ok(value) -> use(value)
      Error(e) -> handle(e)
    }

Before finishing:
- Types make invalid states hard to express and every Result/variant is handled.

Related skills