Aller au contenu
Skillpedia
Déploiement et cloud (DevOps)7.6k · #13159

feature-flags

Ce qu’il fait

Cette compétence explique comment déclarer des indicateurs de fonctionnalité dans une application Agent-Native et les activer pour des utilisateurs, des organisations ou des pourcentages choisis. Elle couvre aussi la suppression des anciens indicateurs. Elle s'adresse aux développeurs qui livrent leurs fonctionnalités progressivement.

Quand l’utiliser

  • ✓Quand vous voulez livrer une nouvelle fonctionnalité à quelques utilisateurs d'abord, puis l'élargir.
  • ✓Quand vous devez activer une fonctionnalité pour des organisations précises sans nouveau déploiement.
  • ✓Quand un interrupteur de compilation doit devenir un indicateur d'exécution modifiable en toute sécurité.

Lien du skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/feature-flags/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/feature-flags/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Peux-tu ajouter un indicateur pour que le nouveau constructeur de rapports ne soit actif que pour nos clients pilotes, et que je puisse l'activer plus tard ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent déclare l'indicateur dans le code partagé, le vérifie côté serveur avant les actions protégées, et gère l'état du déploiement depuis le plan de contrôle d'Analytics.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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

  1. Verify the off path before changing rollout state.
  2. Confirm the registered flag appears in Analytics → Feature flags for the app and is Off by default.
  3. Use Enable for me for initial production dogfood.
  4. Expand to exact emails, organization IDs, or a percentage only from Analytics.
  5. 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
Questions fréquentes

Un indicateur peut-il protéger des fonctions de sécurité ?

Non. La compétence indique que les indicateurs ne doivent pas protéger l'authentification, les autorisations, les secrets ni les réglages d'audit.

Les indicateurs sont-ils la même chose que les expériences ?

Non. La compétence indique que les indicateurs sont des interrupteurs ouvert ou fermé, pas des expériences avec variantes et mesures.

Masquer un bouton dans l'interface désactive-t-il la fonctionnalité ?

Non. La compétence indique que le masquage côté client n'est qu'une présentation, et que le serveur doit vérifier le même indicateur.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
7.6k
Position au classement
#13159
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires