launchdarkly
できること
このスキルは、Agent-Native アプリのサーバー側とブラウザ側のコードが、LaunchDarkly からフラグを読む方法を説明します。LaunchDarkly が未設定または応答しない場合、どの読み取りも既定値に戻ります。すでに LaunchDarkly でフラグを管理している開発者向けです。
使う場面
- ✓アクション、プラグイン、コンポーネントが LaunchDarkly に保存されたフラグを読む必要があるとき。
- ✓アプリ用の LaunchDarkly のキーを設定するとき。
- ✓LaunchDarkly と組み込みのフラグ機能のどちらを使うか選ぶ必要があるとき。
スキルのリンク
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/launchdarkly/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“この新しいエクスポート機能の LaunchDarkly フラグを読んでもらえますか。応答がない場合に備えて、安全な既定値も設定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
アプリは、サーバーまたはブラウザの LaunchDarkly 用のヘルパーを通してフラグを読みます。LaunchDarkly が答えられないときは、既定値を使います。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
LaunchDarkly
Rule
LaunchDarkly flags are read through @agent-native/core/launchdarkly on the
server and @agent-native/core/client/launchdarkly in the browser. Every read
fails closed to a caller-supplied default — LaunchDarkly being unconfigured,
unreachable, or slow is never an availability dependency for the caller.
LaunchDarkly vs. the built-in feature-flags skill
This repo already has its own rollout system (defineFeatureFlag,
isFeatureFlagEnabled, useFeatureFlag — see the feature-flags skill),
managed from the Analytics fleet control plane with no external dependency.
Use that system for a flag whose definition and targeting rules should live in
this codebase and be manageable from Analytics.
Use LaunchDarkly instead when the flag's definition and targeting genuinely need to live in the LaunchDarkly dashboard — for example, a flag shared with non-Agent-Native systems, or targeting rules (percentage experiments, multi-variate values, scheduled changes) beyond what the built-in system offers. Don't wire the same rollout through both systems.
Setup
Set LAUNCHDARKLY_SDK_KEY to a server-side SDK key from the agent-native
LaunchDarkly project's active environment. Unset, every read falls back to its
default value and LaunchDarkly is never contacted — there is no broken state
to debug, only an inactive one.
No client-side ID or LaunchDarkly JS SDK is used. Browser code reads evaluated
flags through the get-launchdarkly-flags action instead, so the SDK key never
reaches a bundle and no LaunchDarkly network connection opens from the browser.
Server usage
import { isLaunchDarklyFlagEnabled } from "@agent-native/core/launchdarkly";
run: async (args, ctx) => {
const enabled = await isLaunchDarklyFlagEnabled("new-checkout-flow", {
userEmail: ctx.userEmail,
orgId: ctx.orgId,
});
if (!enabled) throw new Error("New checkout flow is not enabled.");
// guarded operation
};
For a non-boolean flag (string/number/JSON variation), use
getLaunchDarklyVariation(key, actor, defaultValue) — the return type matches
defaultValue's type. getAllLaunchDarklyFlags(actor) returns every flag
LaunchDarkly currently evaluates for that context; prefer the single-flag
functions when only a few keys matter.
actor is { userEmail?, orgId?, anonymousId? }. A signed-in caller evaluates
by userEmail. A caller with neither userEmail nor anonymousId falls back
to one shared "anonymous" context — every such caller gets the same
variation from a percentage rollout, since LaunchDarkly buckets by context key.
Pass a stable anonymousId (a device or session id) when an unauthenticated
caller needs its own bucket.
Client usage
import { useLaunchDarklyFlag } from "@agent-native/core/client/launchdarkly";
function CheckoutButton() {
const enabled = useLaunchDarklyFlag("new-checkout-flow");
if (!enabled) return null;
return <Button>Checkout</Button>;
}
useLaunchDarklyFlag(key, defaultValue = false) calls the mounted
get-launchdarkly-flags action for the current session and requires a real
session — like useFeatureFlag, it never fires for a signed-out visitor and
resolves to defaultValue instead. useLaunchDarklyFlags(keys, defaultValue)
evaluates several keys in one request.
get-launchdarkly-flags action
Auto-mounted for every app (like get-feature-flags) — no plugin or
registration needed. Gateable per app via
frameworkTools.launchDarkly (see framework-tools.ts) if an app wants to
remove it from the agent's tool surface; the HTTP route stays mounted either
way so useLaunchDarklyFlag keeps working.
run("get-launchdarkly-flags", { keys: ["new-checkout-flow"], defaultValue: false })
// => { flags: { "new-checkout-flow": true } }
Never do this
- Never import
@agent-native/core/launchdarkly(the server module) from client/browser code — it pulls in the LaunchDarkly Node SDK. Use@agent-native/core/client/launchdarklyinstead. - Never treat a LaunchDarkly read as required for an operation to complete —
every function here already fails closed; don't wrap calls in retries or
turn a
false/default result into a thrown error unless the flag itself is an authorization gate the caller must respect. - Never put
LAUNCHDARKLY_SDK_KEYinagent-native.config.tsor any client-visible config — it is server-only.
Related skills
- feature-flags — the framework's own rollout system; read this first to
よくある質問
LaunchDarkly が設定されていない場合はどうなりますか?
すべての読み取りが既定値を返し、LaunchDarkly には問い合わせられません。
これと組み込みのフラグのどちらを使うべきですか?
このコードベースで管理するフラグには組み込みの仕組みを、ルールを LaunchDarkly のダッシュボードで管理する必要がある場合は LaunchDarkly を使うよう、スキルは述べています。
どのキーが必要ですか?
プロジェクトの有効な環境のサーバー用 SDK キーを1つ設定するよう、スキルは指示しています。
詳細
作者による元の説明
Server-side and client-side LaunchDarkly flag evaluation (project key `agent-native`). Use when reading a LaunchDarkly flag from an action, plugin, or component, or when wiring `LAUNCHDARKLY_SDK_KEY`. Distinct from the framework's own `feature-flags` system.
repo: BuilderIO/agent-native
人気
- GitHubのスター
- 7.6k
- ランキング
- #13166
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
design-exploration
7.6kUIの複数のデザインの方向性を並べて検討し、1つを選んでもらい、選んだデザインを磨き上げるようエージェントを支援します。
visual-edit
7.6k実行中のローカルのアプリをビジュアルエディターで開き、本物の画面をまとめて確認し編集できるようエージェントを支援します。
turn-into-app
7.6kワークフロー、スプレッドシート、プロジェクトを、画面にデータが入り、操作の裏でエージェントが働く、洗練されたビジュアルアプリに変えます。
visual-plan
7.6kプレーンテキストの計画を、図、ファイルのマップ、コードの断片、未解決の質問を含む、対話できるビジュアルな計画に変えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。