sdxc-flags

Implements OpenFeature v0.9.0 feature flag evaluation with typed catalogs and middleware.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Feature flag keys, types, and defaults get restated at every call site, evaluations throw on failure, and vendor SDK types leak into application code. This Skill documents the @sdxc/flags package, which provides a non-throwing OpenFeature v0.9.0 evaluation API with typed flag catalogs and request-scoped context propagation. ## Core Features & Use Cases - Non-throwing evaluation: client.boolean/string/number/object and their *Details forms return the provided default with reason and errorCode instead of throwing. - Typed flag catalogs: defineFlags and flag.* handles declare keys, types, and defaults once so misspelled keys are not expressible. - Middleware integration: Router and dispatcher middleware publish the client as ctx.flags, initializing the provider once per isolate. - Use Case: A request handler branches on a new-checkout flag; the subject is read from the request once, a test pins the variant with InMemoryProvider, and a custom provider is validated with the Vitest conformance suite. ## Quick Start Add @sdxc/flags as a workspace dependency, create an instance with createFlags and an InMemoryProvider, then evaluate a boolean flag with a targeting key.

Frequently Asked Questions about sdxc-flags

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

FAQPage Schema
How do I evaluate a feature flag in a request handler with OpenFeature?▼

Create one instance with createFlags at module scope, register the router middleware, and read the client from ctx.flags in the handler. Call client.boolean with the flag key, a default, and a context carrying the targetingKey from the request.

How do I pin a feature flag value in a Vitest test?▼

Use InMemoryProvider from @sdxc/flags/provider/memory with the flag's variants and defaultVariant, then pass it to createFlags. Evaluations return the pinned variant with the same reason and metadata production would send.

Does @sdxc/flags throw when a flag cannot be resolved?▼

No, nothing on the evaluation path throws. An evaluation that cannot resolve returns the default it was handed, and the detailed form carries reason ERROR with an errorCode such as FLAG_NOT_FOUND.

How do I write a custom OpenFeature provider for @sdxc/flags?▼

Implement the Provider interface from @sdxc/flags/provider using the resolved and failed helpers, then run the conformance() Vitest suite against it. Each ConformanceOptions entry gates a sub-suite so the provider is tested only for what it claims to implement.

Why does my provider stay NOT_READY after initialize?▼

Provider status is read from emitted events, never inferred from lifecycle calls. A provider that implements initialize without emitting PROVIDER_READY remains NOT_READY until it announces readiness.

When should I use defineFlags instead of raw flag keys?▼

Use defineFlags when keys, types, and defaults are restated at call sites and a misspelled key should not be expressible. Evaluate with client.get(features.myFlag) so the key, type, and default are written down once.