feature-flags
What it does
This skill explains how to declare feature flags in an Agent-Native app and turn them on for chosen users, organizations or percentages. It covers removing old flags too. It is for developers shipping features gradually.
When to use it
- ✓When you want to ship a new feature to a few users first and widen it later.
- ✓When you need to turn a feature on for specific organizations without a new deploy.
- ✓When a compile-time switch should become a runtime flag that can be changed safely.
Skill link
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/feature-flags/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
“Can you add a flag so the new report builder is only on for our pilot customers, and I can switch it on later?”
5 new skills a week. 1 minute to read.
How it works
The agent declares the flag in shared code, checks it on the server before guarded actions, and manages the rollout state from the Analytics control plane.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Feature Flags
A feature flag is a boolean declared in app code, evaluated locally by Core, and managed from the Analytics fleet control plane. Code owns whether a flag exists. Runtime settings own only its rollout state.
Flags let an app deploy dormant code and turn it on in the real environment without another deployment. They are not experiments: do not add variants, hypotheses, conversion metrics, exposure tracking, or lifecycle states.
When to use one
Use a flag for a reversible rollout of a user-facing capability whose dormant code is safe to deploy. Flags are useful for production dogfooding, exact-user or organization pilots, and deterministic percentage rollouts.
Do not use a flag for authentication, authorization, secrets, audit enablement, SSR cache behavior, or another security boundary. Client hiding is presentation only; every guarded server action must evaluate the same registered flag.
Agent workflow
1. Declare
Keep definitions in a shared TypeScript module so server and client code use the same stable key. Flags are boolean and default-off.
import { defineFeatureFlag } from "@agent-native/core/feature-flags/registry";
export const FULL_APP_BUILDING = defineFeatureFlag({
key: "full-app-building",
displayName: "Full app building",
description: "Create and edit Fusion-backed applications.",
});
Never import defineFeatureFlag from @agent-native/core/feature-flags.
That barrel is server evaluation (isFeatureFlagEnabled) plus store code;
Vite will follow it into the browser and crash the page. Plugin and A2A auth
helpers live on @agent-native/core/server (or
@agent-native/core/feature-flags/server).
Keys are immutable, never reused, and contain only letters, numbers, dots, underscores, or hyphens. Prefer a concise app-owned name. Do not create flag definitions or rollout rows from Analytics.
2. Register
Register app definitions from a Nitro plugin before actions are discovered. Do not add app-specific flags to a Core registry.
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
Definitions live in one process-wide registry (a globalThis symbol in
feature-flags/registry.ts, like the labs registry). In local dev the plugin
can load core from source while actions load the built package; a
module-local map gave each copy its own registry, so get-feature-flags saw
no definitions and every flag read as off. Keep the shared registry when
touching that module.
3. Guard server and client
The server action is the enforcement boundary:
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
run: async (args, ctx) => {
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
throw new Error("Full app building is not enabled for this account.");
}
// guarded operation
}
Use the client hook only to hide or reveal hydrated UI:
import { useFeatureFlag } from "@agent-native/core/client/feature-flags";
const enabled = useFeatureFlag(FULL_APP_BUILDING.key);
return enabled ? <FullAppOption /> : null;
The client hook intentionally returns false while loading or for an unknown
flag. Never replace that fail-closed behavior with app-local bucketing or a
compile-time fallback. When the flag-off UI must not flash before the answer
arrives (a whole page swaps on the flag), use useFeatureFlagState(key): it
returns
{ status: "loading" | "ready" | "unavailable", enabled }, so the surface can
hold a layout-matching skeleton while status is "loading". Never evaluate personalized flags in the public SSR
shell; it is shared and cached for every visitor.
4. Verify and roll out
- Verify the off path before changing rollout state.
- Confirm the registered flag appears in Analytics → Feature flags for the app and is Off by default.
- Use Enable for me for initial production dogfood.
- Expand to exact emails, organization IDs, or a percentage only from Analytics.
- Confirm the client presentation and authoritative server action agree.
Management contract
Core mounts three actions in registered apps:
| Action | Purpose |
|---|---|
get-feature-flags |
Return the current caller's evaluated boolean values. |
list-feature-flags |
Return definitions and rollout metadata to an authorized operator. |
| `set-fea |
FAQ
Can a flag protect security features?
No. The skill says flags must not guard authentication, authorization, secrets or audit settings.
Are flags the same as experiments?
No. The skill says flags are on or off switches, not experiments with variants or metrics.
Does hiding a button in the UI turn off the feature?
No. The skill says client hiding is only presentation, and the server must check the same flag.
Details
Original description by the author
Declare, evaluate, manage, and remove framework feature flags. Use when shipping a capability gradually, targeting users or organizations, or replacing a compile-time rollout switch with a production-safe runtime flag.
repo: BuilderIO/agent-native
Popularity
- GitHub stars
- 7.6k
- Ranking position
- #13159
- 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
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.