launchdarkly
Skill này làm gì
Skill này mô tả cách code máy chủ và trình duyệt trong ứng dụng Agent-Native đọc flag từ LaunchDarkly. Mỗi lần đọc đều quay về giá trị mặc định nếu LaunchDarkly chưa được cấu hình hoặc không truy cập được. Skill dành cho lập trình viên đã dùng LaunchDarkly cho các flag của họ.
Khi nào nên dùng
- ✓Khi một action, plugin hoặc component cần đọc một flag được lưu trong LaunchDarkly.
- ✓Khi bạn thiết lập khóa LaunchDarkly cho một ứng dụng.
- ✓Khi bạn phải chọn giữa LaunchDarkly và hệ thống flag tích hợp sẵn.
Liên kết skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/launchdarkly/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể đọc flag LaunchDarkly của chúng tôi cho tính năng xuất dữ liệu mới trong ứng dụng này, với giá trị mặc định an toàn nếu không truy cập được không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Ứng dụng đọc flag qua trợ giúp LaunchDarkly trên máy chủ hoặc trong trình duyệt, và dùng giá trị mặc định bất cứ khi nào LaunchDarkly không trả lời được.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Điều gì xảy ra nếu LaunchDarkly chưa được cấu hình?
Mọi lần đọc đều trả về giá trị mặc định, và LaunchDarkly không bao giờ được liên hệ.
Nên dùng cái này hay flag tích hợp sẵn?
Skill khuyên dùng hệ thống tích hợp cho các flag được quản lý trong codebase này, và LaunchDarkly khi các quy tắc phải nằm trong bảng điều khiển của nó.
Cần khóa nào?
Skill nói cần thiết lập một khóa SDK phía máy chủ từ môi trường đang hoạt động của dự án.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 7.6k
- Vị trí xếp hạng
- #13166
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
design-exploration
7.6kGiúp agent của bạn khám phá nhiều hướng thiết kế giao diện song song, để bạn chọn một hướng rồi tinh chỉnh thiết kế đã chọn.
visual-edit
7.6kGiúp agent của bạn mở một ứng dụng cục bộ đang chạy trong trình chỉnh sửa trực quan, để bạn xem và sửa các màn hình thật cùng nhau.
turn-into-app
7.6kBiến quy trình, bảng tính hoặc dự án thành ứng dụng trực quan có màn hình đầy đủ dữ liệu, với agent làm việc phía sau các điều khiển.
visual-plan
7.6kBiến một kế hoạch viết bằng văn bản thuần thành kế hoạch trực quan tương tác, có sơ đồ, bản đồ file, đoạn code và các câu hỏi còn mở.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.