feature-flags

Implement feature toggles, gradual rollouts, and A/B testing in ASP.NET Core Razor Pages applications.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill feature-flags-agibuild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: feature-flags
Source: https://github.com/AGIBuild/dotnet.CI.template/tree/main/.cursor/skills/feature-flags
Command: npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill feature-flags-agibuild

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Microsoft.FeatureManagement.

What problem does it solve? Deploying incomplete features or rolling back problematic releases is risky without a controlled mechanism. This Skill provides Microsoft.FeatureManagement patterns for ASP.NET Core Razor Pages so teams can toggle features, roll out gradually, and run A/B tests without redeploying code. ## Core Features & Use Cases - Configuration-Based Flags: Define feature toggles in appsettings.json with environment-specific overrides and typed constants for compile-time safety. - Gradual Rollouts & Targeting: Use targeting, percentage, and time-window filters to enable features for specific users, groups, or time periods. - Razor Pages Integration: Apply FeatureGate attributes, conditional view rendering, and middleware to control pages and UI at runtime. - Use Case: Roll out a new payment flow to 25% of production users while keeping the legacy checkout for everyone else, then increase the percentage as confidence grows. ## Quick Start Add feature flags to my ASP.NET Core Razor Pages app using Microsoft.FeatureManagement with a percentage-based rollout for the new checkout page.

Frequently Asked Questions about feature-flags

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

FAQPage Schema
How do I add feature flags to an ASP.NET Core Razor Pages app?▼

Register feature management in Program.cs with builder.Services.AddFeatureManagement(), then define flags under the FeatureManagement section in appsettings.json. Inject IFeatureManager into your PageModel and call IsEnabledAsync to check flag state.

How to implement gradual rollout with percentage-based feature flags?▼

Use the Microsoft.Targeting filter with a DefaultRolloutPercentage in the flag configuration, and register TargetingFilter with AddFeatureManagement. Provide an ITargetingContextAccessor so the filter can evaluate the current user's identity and groups.

Does Microsoft.FeatureManagement support time-based feature activation?▼

Yes, the Microsoft.TimeWindow filter enables a feature only between configured Start and End UTC timestamps in appsettings.json. You can also write a custom IFeatureFilter for recurring schedules such as specific days of the week.

How do I restrict an entire Razor Page behind a feature flag?▼

Apply the FeatureGate attribute to the PageModel class with the feature name. Optionally set RequirementType and NoFeatureRedirect to control whether all features must be enabled and where users are redirected when the flag is off.

What are common feature flag anti-patterns to avoid?▼

Avoid hard-coded environment checks, checking flags inside tight loops, scattering string literals instead of constants, and injecting IFeatureManager into domain services. Check flags once, cache the result, and pass behavior through strategy interfaces instead.