sdxc-flags-engine

Evaluates typed feature flags with targeting rules, percentage splits, and pluggable stores.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-flags-engine-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-flags-engine
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-flags-engine
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-flags-engine-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rolling out features safely requires deciding who sees what, consistently, on every request. This Skill documents how to define flags as JSON with variants, targeting rules, and percentage weights, then evaluate them deterministically so the same user lands in the same arm everywhere, while distinguishing a switched-off flag from a broken flag system. ## Core Features & Use Cases - Typed flag definitions: Define flags as JSON (FlagSet, FlagDefinition, TargetingRule, Condition, Split, segments) validated by Standard Schemas, so editors reject exactly what the engine would refuse. - Deterministic evaluation: parseFlagSet, evaluate, evaluateAll, and createEngine resolve flags as pure synchronous functions over a loaded snapshot, returning reasons like TARGETING_MATCH, TYPE_MISMATCH, or TARGETING_KEY_MISSING. - Pluggable stores: Keep definitions in Cloudflare KV (WorkerKVFlagStore), memory (InMemoryFlagStore), or any custom backend behind a single read method, verified with the shipped conformance suite. - Use Case: Roll out a new checkout flow to 10% of users on Cloudflare Workers: store the flag set in KV, call engine.load() inside waitUntil, and evaluate per request with stable subject hashing. ## Quick Start Ask the AI to create a flags engine with an in-memory store defining a boolean flag, load it, and evaluate it with a default value to see the resolution reason.

Frequently Asked Questions about sdxc-flags-engine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I evaluate feature flags with percentage rollouts in TypeScript?▼

Define the flag with variants and split weights in a FlagSet, then call createEngine with a store and use evaluate or evaluateAll. The engine hashes the subject field (defaulting to targetingKey) so the same user lands in the same arm on every request and isolate.

How do I store feature flag definitions in Cloudflare KV?▼

Use WorkerKVFlagStore from the @sdxc/flags-engine/store/worker-kv entry point, which keeps the entire flag set as one JSON value under a single KV key. Call engine.load() to snapshot it, scheduling reloads via waitUntil or a cron trigger.

Can I write a custom feature flag store for my own database?▼

Yes, a custom store implements the FlagStore interface with a single read method returning a Result. Point the shipped conformance Vitest suite at your implementation to verify it behaves as a valid store.

Why does my flag evaluation return TYPE_MISMATCH or TARGETING_KEY_MISSING?▼

TYPE_MISMATCH occurs when a variant's type differs from the defaultValue's type, since the engine never coerces. TARGETING_KEY_MISSING means the split's subject field was empty, so the rollout resolved to the caller's default.

Does the flags engine work outside Cloudflare Workers?▼

Yes, the core engine runs on any JavaScript runtime as pure synchronous functions. Only the WorkerKVFlagStore entry point assumes Cloudflare Workers; other environments can use InMemoryFlagStore or a custom store.