Skip to content
Back to skills

Gleam Knowledge Patch

ASecurity

Gleam

  • 25 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 27, 2026
developmentjavascripttypescriptjavanodeexpressdebuggingrefactoringgitapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill gleam-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gleam Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gleam Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-gleam-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-gleam-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gleam-knowledge-patch
description: Gleam
version: "1.19.2"
license: MIT
metadata:
  author: Nevaberry
---


# Gleam knowledge patch

Load this skill when writing or upgrading Gleam code, configuring packages and
builds, working with Erlang or JavaScript interop, or using editor refactorings.
Use the quick reference for common changes and the topic files for full guidance
and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Language and diagnostics](references/language-and-diagnostics.md) | Deprecations, records, constants, patterns, assertions, warnings, error recovery |
| [Packages, build, and configuration](references/packages-build-and-config.md) | Dependencies, Hex, publishing, documentation, runtimes, exports, configuration |
| [Standard-library migrations and behavior](references/stdlib-migrations-and-behavior.md) | Removed APIs, decoding, collections, bit arrays, URI and string behavior |
| [Targets and FFI](references/targets-and-ffi.md) | External declarations, JavaScript representations, Erlang interop, bit-array behavior |
| [Editor and refactoring](references/editor-and-refactoring.md) | Navigation, renaming, generation, pattern matching, extraction, formatting |
| [Conventions and patterns](references/conventions-and-patterns.md) | Names, library design, source boundaries, development settings |

## Breaking changes and deprecations

### Pipeline calls and discard aliases

When `value |> add_by(2)` relies on the fallback meaning `add_by(2)(value)`,
write `value |> add_by(2)()` explicitly. The language server offers a quick fix.
Bind a value directly instead of using a discard alias: the formatter rewrites
`let _ as value = read()` to `let value = read()`.

Run `gleam fix` in the project to rewrite deprecated Gleam code during an upgrade.

### Configuration and Hex authentication

Use `[dev_dependencies]` and `[repository]`'s `tag_prefix` in `gleam.toml`.
The spellings `dev-dependencies` and `tag-prefix` still work and are deprecated.
Hex authentication uses OAuth2 exclusively; the first Hex use after upgrading
revokes locally stored legacy tokens. The local token-encryption password must
be at least eight characters long.

`gleam publish` rejects packages with a missing or default generated README and
packages containing modules with no public definitions. Supply your own README
for the package documentation homepage.

### Standard-library migration quick reference

| Existing code | Migration or removal |
| --- | --- |
| `dynamic.decodeN` | Use `gleam/dynamic/decode`; the legacy decoder API was removed. |
| `dynamic.from` | Use the constructor for the input type; `dynamic.from` was removed. |
| `dynamic.classify` matching `"Tuple"` | Erlang tuples and JavaScript arrays are classified as `"Array"`. |
| `list.range` | Use `int.range`; `list.range` was deprecated and then removed. |
| `result.then` | Use `result.try`; `result.then` and `result.unwrap_both` were removed. |
| `result.nil_error` | Use `result.replace_error(value, Nil)`. |
| `list.concat` | Use `list.flatten` to concatenate a list of lists. |
| Original `dict.update` | Use `dict.upsert`. |
| `gleam/iterator`, `gleam/queue`, `gleam/regex` | Use `gleam_yielder`, `gleam_deque`, `gleam_regexp`, respectively. |
| `gleam/string_builder`, `gleam/bytes_builder` | Use `gleam/string_tree`, `gleam/bytes_tree`. |

The standard-library reference gives the release-specific removals, including
integer digit conversions, function helpers, and other list helpers.

## Language quick reference

### Records, constants, and matching

A record update can change a generic type argument when updated and retained
fields fit the result type. Constant definitions support record updates and
prepending to another constant list with `..`.

After a `case` establishes a variant, dot access can use fields specific to that
variant. A known variant also permits destructuring with a plain `let` on a type
with multiple variants. Alternative patterns use `|` between complete case
patterns and must bind the same names with the same types.

Use `<>` to concatenate strings in a `case` guard. The right side of `<-` in
`use` can be an expression yielding a callback-taking function, including a
`case` that selects the function.

### Assertions and unfinished code

`assert` panics on `False`, carrying the source expression and values such as
operator operands or function arguments. Test frameworks can display these
alongside an optional `as` message.

```gleam
pub fn total_test() {
  let total = 2 + 2
  assert total == 4 as "Expected a total of four"
}
```

Use `echo 11 as "lucky number"` to label debug output beside its source location,
above the value. Empty blocks `{}` produce an incomplete-block warning while
surrounding code continues to be checked. `todo` can be a constant initializer
for type checking; replace it before running because constants are evaluated at
compile time.

Put `@deprecated("…")` directly above a constructor to warn on uses of that
variant while leaving other variants available without a warning.

## Packages and builds

### Inspect dependencies

```sh
gleam deps tree
gleam deps tree --package package_c
gleam deps tree --invert package_b
```

`--package` shows a dependency's subtree; `--invert` traces every path from a
dependency back to the project. Passing both flags fails: run the views
separately. `gleam deps outdated` compares resolved versions with repository
releases, can show newer majors, and reports a count even when all are current.
To adopt a major version outside the declared range, update `gleam.toml`'s
constraint.

For Git dependencies, use `git` and `ref`; `ref` accepts a tag, branch, or commit
SHA. Add `path` when the package lives below the repository root.
A dependency can appear in only one of `[dependencies]` and `[dev_dependencies]`;
development dependencies are excluded from the published package.

### Development and CI

Modules in `dev/` can import `src/`, use development dependencies, and are
excluded from production builds. For `my_app`, `gleam dev` calls `main` in
`dev/my_app_dev.gleam`. `gleam dev --no-print-progress` hides compilation and
launch progress while keeping the program's output.

Use `gleam build --warnings-as-errors` to fail a CI build on compiler warnings.
If a module fails, compilation skips modules that depend on it and continues
with modules that can still build. The language server marks the responsible
import in a skipped module.

### Runtime, debugging, and deployment

Under `[javascript]`, `runtime` is `"node"` by default, or `"deno"` or `"bun"`.
Override it with `gleam run --target javascript --runtime bun`.
Set `source_maps = true` and serve the generated maps alongside JavaScript for
Gleam-source breakpoints and original exception locations.
Set `typescript_declarations = true` to emit declarations; it defaults to off.

`gleam export erlang-shipment` includes Windows and POSIX entrypoints regardless
of build host; its POSIX launcher lets the VM receive signals such as `SIGTERM`.
`gleam export escript` validates `main` and bundles compiled BEAM modules into
one project-named executable. The destination machine needs Erlang installed.

## Interop and target behavior

An external function may also have a Gleam body: the declared target calls the
external implementation and the other target uses the body. `@external` on an
external type names the type used in Erlang specs or TypeScript declarations,
carrying through type parameters.

JavaScript externals returning Gleam `Nil` return `undefined`. Supported custom
type constructors, variant tests, and accessors come from compiled `.mjs`
modules. A type-level field accessor requires a shared label at the same
position in every variant. Use the FFI reference for the exact generated APIs
for lists, results, bit arrays, and dictionaries.

JavaScript bit arrays support partial bytes, runtime pattern sizes, UTF-16 and
UTF-32 segments, `unit(n)`, and 16-bit floats. Use `:bits` for any bit length and
`:bytes` for byte-aligned data. A `:float` segment defaults to 64 bits.
JavaScript patterns reading integer segments wider than 52 bits truncate to
the first 52 bits and produce a warning. Use `bytes` to retain the original
data when its size is a whole number of bytes.

On BEAM, `Float` overflow raises an error. On JavaScript it produces `Infinity`
or `-Infinity`; dividing two infinite values produces `NaN`.
Rebuild projects affected by invalid Erlang output for user-defined types with
Gleam 1.19.2 or later before running Dialyzer.

## Editor quick reference

Find References and Rename work across project modules for types and values.
Record field navigation and renaming also work across modules, from declarations,
labelled arguments or patterns, update labels, and field accesses. When the
editor reports a file move or rename, imports and affected qualifiers update.

Generate Function infers annotations and inserts a `todo` body; it also works
for missing qualified calls in imported modules. Generate Missing Type inserts
the needed type parameters. Annotate All Top Level Definitions fills missing
annotations on the current module's constants and function signatures.

Pattern Match on Value wraps a function call in a `case` based on its return
type. Pattern tooling also handles bindings, lists, and discarded case patterns.
Add Missing Patterns uses a catch-all for internal types, whose structure is
hidden in exhaustiveness errors and whose fields are omitted from completion.

Fill Labels uses an in-scope variable with a matching name and type, or `todo`
when none matches. In constant constructor calls, it inserts `todo` values.
Generate Dynamic Decoder works from the type declaration header, supports
multi-variant types and `Nil`, and tries to supply a zero value for
`decode.failure`. Generate JSON Encoder uses explicit field patterns so adding
a record field causes a compile error in the generated encoder.

Extract Variable can bind the start of a pipeline. Extract Function supports
selected expressions, anonymous function bodies, consecutive pipeline stages,
and assignment right-hand sides. Remove Echo strips every `echo` in the module
while keeping the underlying expressions.

## Library and standard-library behavior

Use singular module path segments and spell acronyms as words, such as `Json`.
Return a `Result` for fallible library operations; an OTP library can deliberately
panic when its supervision tree is designed to handle the failure.
For a Sans-I/O HTTP client, provide a `Request(String)` builder and a parser from
`Response(String)` to a domain `Result`; the caller sends requests and controls
retries and rate limiting.

The callback for `list.index_map` receives the element first, then the index.
`list.sort` preserves the input order of equal elements, and `list.sample`
selects each input entry at most once. `string.split` with an empty separator
splits into graphemes. `uri.percent_decode` preserves literal `+`; query parsing
and encoding have separate behavior detailed in the standard-library reference.

Files in this skill

  • SKILL.md4.4 KB
  • references/bit-arrays.md1 KB
  • references/build-tool.md1.9 KB
  • references/debug-and-testing.md1.3 KB
  • references/javascript-ffi.md1.9 KB
  • references/type-system.md1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.