skip to content

A ClawHub skill for OpenClaw needs an API key and a binary your host lacks; what happens at load, and how do you fix it?

level: middleimportance: should knowfreq 8%

answer

  1. decided at load, not at call
  2. metadata.openclaw.requires
  3. bins on PATH, env from three places
  4. openclaw skills check
  5. snapshot taken at session start

basics

~20 s

OpenClaw gates skills at load time: if a requires.bins binary is missing from PATH or a requires.env variable is unset, the skill is ineligible and never reaches the agent's prompt. Install the binary, supply the key, then start a new session.

solid answer

~40 s

Gating lives in the SKILL.md frontmatter under `metadata.openclaw`: `requires.bins` (each on `PATH`), `requires.anyBins` (at least one), `requires.env`, `requires.config` (truthy `openclaw.json` paths) and an `os` filter. An unmet requirement makes the skill ineligible, so it is left out of the prompt instead of failing mid-task; `openclaw skills check` lists it under missing requirements. Install the binary where the Gateway host's `PATH` finds it, and inside the sandbox image as well if the agent runs sandboxed. Satisfy `requires.env` through the Gateway's environment, `skills.entries.<name>.env`, or `skills.entries.<name>.apiKey` when the skill declares that variable as `primaryEnv`. Then run `/new` or restart the Gateway: the eligible list is snapshotted when a session starts, and installing a binary does not refresh an existing session's snapshot.

code

markdown · 10 lines
markdown
---
name: release-digest
description: Summarize merged pull requests into weekly release notes.
metadata: { "openclaw": { "requires": { "bins": ["gh"], "env": ["DIGEST_API_KEY"] }, "primaryEnv": "DIGEST_API_KEY" } }
---

# Release digest

When the owner asks for release notes, use the `exec` tool to run
`gh pr list --state merged --limit 50`, then group the results by label.

go deeper

for a junior

Remember that a skill can declare required binaries and environment variables, and that an unmet one keeps the skill from loading rather than causing an error later.

for a middle

Walk through metadata.openclaw requires.bins, anyBins, env and config, how openclaw skills check reports a miss, and the three ways to satisfy requires.env including primaryEnv with apiKey.

for a senior

Diagnose the quiet failure: an eligible-looking skill the agent never uses. Cover the session snapshot, host-only env injection versus sandboxed runs, and installing binaries inside the sandbox image.

for a principal

Decide where secrets for skills live: plaintext in skills.entries, SecretRefs, or sandbox env readable through Docker metadata, and how that choice scales across agents and hosts.

## Where the gate lives An OpenClaw skill declares what it needs in its `SKILL.md` frontmatter, under `metadata.openclaw`. The block is a JSON5 object; a multi-line YAML mapping is flattened and re-parsed as JSON5, so both the one-line and the block form work. OpenClaw evaluates it **when it loads skills**, not when the agent later tries to use one. | Key | Passes when | |---|---| | `requires.bins` | every listed binary is on `PATH` | | `requires.anyBins` | at least one listed binary is on `PATH` | | `requires.env` | each variable is set in the process or provided through config | | `requires.config` | each `openclaw.json` path is truthy | | `os` | the host (or a connected node) runs a listed platform: `darwin`, `linux`, `win32` | A skill with no `metadata.openclaw` block is always eligible unless it is disabled. Requirements decide **only whether the skill is offered**; they grant or restrict nothing else. ## What "ineligible" means in practice An ineligible skill is filtered out of the agent's skill list. The model is never told it exists, so the symptom is an agent that simply does not use the skill you just installed, with no error in the chat. To see why: - `openclaw skills list --eligible` shows only the skills that passed. - `openclaw skills check` groups skills by readiness and lists the failures under **Missing requirements**, naming the binary, variable or config path. - `openclaw skills info <name>` prints one skill's details, including its source and path. - `openclaw skills list --verbose` adds a Missing column to the normal table, which is handy when several skills fail at once. Because the check runs at load rather than at call time, a gate is a cheap way for a skill author to say "do not even offer me without these", and an honest one tells you up front which credentials and tools it will use. Read the declared requirements before installing: a skill that asks for a key it has no obvious reason to need deserves a closer look. ## Fixing the missing binary 1. Install the tool so the **Gateway host's** `PATH` finds it. `openclaw skills install` itself only places the folder; installer hints in the frontmatter are used by the macOS Skills UI and by dependency installs started from onboarding or Skills settings, not by the CLI install. 2. If the agent runs in a sandbox, the binary must **also exist inside the container**: `requires.bins` is checked on the host at load time, but the command runs in the sandbox. Add it with `agents.defaults.sandbox.docker.setupCommand` or a custom image. ## Supplying the API key Three things satisfy a `requires.env` entry: - the variable is already set in the Gateway's own environment; - `skills.entries.<name>.env` sets it in `openclaw.json` (injected only when the process does not already have it); - `skills.entries.<name>.apiKey` is set and the skill declares that same variable as `primaryEnv`; it accepts a plaintext string or a SecretRef such as `{ source: "env", provider: "default", id: "DIGEST_API_KEY" }`. The entry key is the skill's `name` (or its `metadata.openclaw.skillKey` when it defines one). These values are injected into the **host** process for the duration of each agent run and restored afterwards. They do **not** reach a sandbox: a sandboxed run that needs the key gets it separately, for example through `agents.defaults.sandbox.docker.env`, which anyone with Docker daemon access can read from container metadata. ## Making the fix visible OpenClaw snapshots eligible skills **when a session starts**. A fresh dependency check finds a binary installed into a directory already on `PATH`, but that does not refresh an existing session's snapshot. After fixing the requirement, run `/new` in chat or restart the Gateway, then confirm with `openclaw skills check`. ## Escape hatches and traps - `requires.anyBins` suits a skill that can work with one of several tools, for example either of two package managers; it passes as soon as one of them is on `PATH`. - `requires.config` ties a skill to a feature switch, such as `browser.enabled`; the skill disappears as soon as that `openclaw.json` path is false or missing, which keeps instructions for a disabled feature out of the prompt. - `metadata.openclaw.always: true` bypasses `requires.bins`, `requires.anyBins`, `requires.env` and `requires.config`, but never the `os` filter, and the skill still fails at run time if the tool is truly absent. - `skills.entries.<name>.enabled: false` disables a skill even when every requirement passes. - Passing the gate grants nothing: an eligible skill still uses only the tools, sandbox and approvals its agent already has.

  • The skill is eligible on the host, but in a sandboxed OpenClaw agent it reports the API key as missing. Why?
    Eligibility is evaluated on the host, where `skills.entries.<name>.env` or `apiKey` satisfies `requires.env`. Those values are injected into the host process only; inside a sandbox they have no effect. Give the container the variable separately, for example through `agents.defaults.sandbox.docker.env`, a mounted secret file or a custom image, and make sure the binary exists in the image too.
  • When would you set `always: true` in a skill's `metadata.openclaw`, and what does it not bypass?
    Use it for a skill that should be offered even when its declared checks fail, for example one whose instructions explain how to install the tool first. It skips the `requires.bins`, `anyBins`, `env` and `config` checks, but the `os` filter still applies, `skills.entries.<name>.enabled: false` still disables it, and agent allowlists still hide it.

  • A gated skill loads normally and only errors when the agent calls the missing binary.
  • openclaw skills install fetches the binaries listed in requires.bins for you.
  • The API key must be exported in the shell; openclaw.json cannot satisfy requires.env.
  • Keys set in skills.entries.<name>.env are visible inside the Docker sandbox too.
  • always: true makes a skill load on every operating system.
  • Installing the missing binary makes the skill appear in the current session immediately.