/gleam-dev:gleam-idiomsfrom gleam-dev
This skill should be used when writing, reviewing, or refactoring Gleam code, or when editing any `.gleam` file: deciding whether a function should return Result, naming a module or conversion function, modeling data with custom types instead of bools/optional fields, organizing modules and package namespaces, or designing an SDK/API client (sans-io) or a builder. Also use when asked "is this idiomatic Gleam?", "review my Gleam code", or "how should I name this module?". Covers the official Gleam conventions, patterns, and anti-patterns guide; not Gleam syntax or language basics.
Ships in gleam-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Distilled from the official guide (https://gleam.run/documentation/conventions-patterns-and-anti-patterns) so idiomatic Gleam norms are on hand without re-deriving them from scratch.
Scope is that guide: naming, module and namespace layout, error modeling, and the
listed patterns and anti-patterns. Syntax-level idiom (use expressions, |>
pipelines, labelled arguments) is out of scope and not covered here.
When writing or reviewing Gleam, scan the quick-reference tables below and apply the rule directly when the one-line gloss is enough. When a decision needs the code example or the rationale (modeling errors, sans-io/builder shape, namespace layout, why to avoid a catch-all), load the matching reference file before acting:
references/conventions.md: the 10 style/structure conventions.references/patterns.md: 6 design patterns worth reaching for.references/anti-patterns.md: 10 things to avoid, each with the fix.Do not load all three by reflex; open the one that covers the decision at hand.
| Convention | Rule |
|---|---|
| Qualified imports | Import modules; call module.fn, not bare fn. |
| Annotate functions | Type-annotate every arg and return, public and private. |
| Result for failure | Fallible functions return Result; Nil error when no info needed. |
| Singular module names | user, not users, in every path segment. |
| Acronyms as words | Json/Http, not JSON/HTTP. |
x_to_y conversions | Drop the type prefix when the module is named after the type. |
try_ prefix | Name the Result-handling variant try_map, etc. |
| Use core libraries | Depend on official gleam_* packages; don't reimplement. |
| Config in gleam.toml | Dev-tool config under tools.$TOOL keys, not stray files. |
| Source directories | src/ (deps + src only), test/ and dev/ (anywhere). |
| Pattern | Use it to |
|---|---|
| Descriptive errors | Give error variants domain names + fields (incl. cause). |
| Comment liberally | Explain what and why. |
| Make invalid states impossible | Model rules as variants so bad data can't be built. |
| Replace bools with custom types | Named states document intent and leave room to grow. |
| Sans-io | Split clients into request-builder + response-parser; no I/O. |
| Builder | new(required) then optional modifier fns returning copies. |
| Avoid | Instead |
|---|---|
| Abbreviations | Full names (count, not cnt). |
| Fragmented modules | Larger modules organized by domain. |
| Panicking in libraries | Return Result; no panic/let assert. |
| Global namespace pollution | Nest modules under a package_name/ dir. |
| Namespace trespassing | Don't add modules to another package's dir. |
| Grouping by design pattern | Group by business domain, not models//helpers/. |
| Check-then-assert | Pattern-match or use Result combinators. |
Dynamic with FFI | Define a specific type at the FFI boundary. |
Catch-all _ in case | Match all variants for exhaustiveness checking. |
| Category theory overuse | Concrete, direct solutions. |
This guide captures general Gleam community norms. When the project defines its
own Gleam conventions (typically in CLAUDE.md/AGENTS.md), follow those
wherever they overlap with or contradict this guide.
Full original guide: https://gleam.run/documentation/conventions-patterns-and-anti-patterns. The reference files paraphrase it with the code examples inline; consult the URL for the authoritative wording.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub eduardohki/code-agent-plugins --plugin gleam-dev