secrets
What it does
This skill explains how an app should store and use credentials such as API keys and OAuth connections. It is for developers adding a feature that needs a user's or workspace's login or key.
When to use it
- ✓When a feature needs an API key or an external service login.
- ✓When you add OAuth so a user can connect an account.
- ✓When you are tempted to paste a key into source code or a plain settings value.
Skill link
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/secrets/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add a feature that needs an API key, and make sure the key is stored securely and not in the code.”
5 new skills a week. 1 minute to read.
How it works
The agent first checks for an existing connection, then uses the shared OAuth flow or the shared secrets system. Keys are never placed in app code or client-visible state.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Secrets
Rule
Credentials belong to the user, organization, workspace, or deployment that owns them. Reuse the strongest shared connection or credential flow available; never copy a value into app code or client-visible state.
Choose the credential source
- Check the workspace connection catalog first. If the provider is already connected, request the app grant and resolve its vault-backed credential reference through the workspace-connection API.
- For OAuth, use the shared authorization and token flow. Do not store access or refresh tokens as ordinary settings or API-key values.
- If the app truly needs its own API key, register it with the shared secrets surface. Do not build a parallel key form or storage table.
- Use deployment configuration only for a secret owned by the deployed app, such as a webhook verification secret. LLM inference keys are an app-owned exception: self-hosted apps may use provider keys from deployment env as a shared fallback, while scoped user or organization keys take precedence. Hosted-workspace deployments backed by a shared database must not share those env keys across apps or tenants. This exception does not authorize using env credentials to access user-owned provider data.
Register an app-local API key
Register the key once so Settings can manage it and the app can describe why it
is needed. Supported scopes are user, org, and workspace; choose the
narrowest scope that matches who owns the credential and how the app resolves
it. Put the registration in a server module imported by a loaded server plugin.
import { registerRequiredSecret } from "@agent-native/core/secrets";
registerRequiredSecret({
key: "EXAMPLE_SERVICE_API_KEY",
label: "Example service API key",
description: "Connects this app to the example service.",
docsUrl: "https://example.com/api-keys",
scope: "user",
kind: "api-key",
required: true,
});
Use kind: "oauth" for an OAuth-backed connection and set oauthProvider and
oauthConnectUrl for the shared Connect flow. Set required only when the app
cannot perform its primary workflow without that connection. A validator may
check a key before save; never log or include the value in a validation error.
Resolve credentials on the server
Resolve credentials only inside server-side actions or server helpers, using the request's user and organization context. Keep a missing key separate from a failed credential-store lookup: ask the user to connect the provider only when the credential is absent; make a store failure retryable.
For an app-local key, use resolveSecretDetailed() from
@agent-native/core/server in the request context. Check lookupFailed before
checking value; do not turn a failed lookup into a setup prompt.
Never read a user's or workspace's API key from process.env, or add a raw
environment fallback to a scoped lookup. Do not put credentials in action
arguments or results, agent messages or hidden context, application state,
browser storage, client bundles, logs, or error text. Send them only in the
provider request that needs them, and redact provider responses before
returning an error.
Related skills
security— protect access to app data and external requests.actions— expose server-side operations to both the agent and UI.
FAQ
Can keys be saved as normal settings?
No. Access and refresh tokens must not be saved as ordinary settings or API key values.
When is an environment variable allowed?
Only for deployment-level values, such as a webhook verification secret.
What if the provider is already connected?
The app uses the existing connection instead of asking the user for the key again.
Details
Original description by the author
Connect external services and keep app credentials scoped. Use before adding an API key, OAuth connection, provider setup, or server-side request that needs a user's or workspace's credential.
repo: BuilderIO/agent-native
Popularity
- GitHub stars
- 7.6k
- Ranking position
- #13179
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
design-exploration
7.6kHelps your agent explore several UI design directions side by side, let you pick one, and then refine the chosen design.
visual-edit
7.6kHelps your agent open a running local app in a visual editor so you can review and edit its real screens together.
turn-into-app
7.6kTurns a workflow, spreadsheet or project into a polished visual app, with populated screens and an agent working behind the controls.
visual-plan
7.6kTurns a plain text plan into an interactive visual plan with diagrams, file maps, code snippets and open questions.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.