secrets
できること
このスキルは、API キーや OAuth の接続などの認証情報を、アプリがどのように保存して使うべきかを説明します。利用者やワークスペースのログインやキーを必要とする機能を追加する開発者向けです。
使う場面
- ✓機能が API キーや外部サービスのログインを必要とするとき。
- ✓利用者がアカウントを接続できるように、OAuth を追加するとき。
- ✓キーをソースコードや通常の設定値に貼り付けたくなったとき。
スキルのリンク
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/secrets/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“API キーが必要な機能を追加してください。キーは安全に保存し、コードには入れないようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはまず、既存の接続がないかを確認します。その後、共有の OAuth の流れか共有の秘密情報の仕組みを使います。キーは、アプリのコードや、クライアントから見える状態には決して置きません。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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.
よくある質問
キーを通常の設定として保存してもよいですか?
いいえ。アクセス用とリフレッシュ用のトークンは、通常の設定や API キーの値として保存してはいけません。
環境変数が許される場合はありますか?
Webhook の検証用の秘密情報など、デプロイ単位の値に限られます。
提供者がすでに接続されている場合はどうしますか?
利用者に再びキーを求めず、既存の接続を使います。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 7.6k
- ランキング
- #13179
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
design-exploration
7.6kUIの複数のデザインの方向性を並べて検討し、1つを選んでもらい、選んだデザインを磨き上げるようエージェントを支援します。
visual-edit
7.6k実行中のローカルのアプリをビジュアルエディターで開き、本物の画面をまとめて確認し編集できるようエージェントを支援します。
turn-into-app
7.6kワークフロー、スプレッドシート、プロジェクトを、画面にデータが入り、操作の裏でエージェントが働く、洗練されたビジュアルアプリに変えます。
visual-plan
7.6kプレーンテキストの計画を、図、ファイルのマップ、コードの断片、未解決の質問を含む、対話できるビジュアルな計画に変えます。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。