Adds feature flag support using LaunchDarkly or JSON-based configuration to toggle features in UI components and Server Actions. This skill should be used when implementing feature flags, feature toggles, progressive rollouts, A/B testing, or gating functionality behind configuration. Use for feature flags, feature toggles, LaunchDarkly integration, progressive rollout, canary releases, or conditional features.
Adds feature flag capabilities using LaunchDarkly or JSON-based configuration for controlled rollouts and A/B testing. Use when implementing feature toggles, progressive rollouts, or gating UI components and Server Actions behind configuration.
/plugin marketplace add hopeoverture/worldbuilding-app-skills/plugin install feature-flag-manager@worldbuilding-app-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/feature-flag-provider.tsxImplement comprehensive feature flag management for controlled feature rollouts and A/B testing in worldbuilding applications.
To add feature flag capabilities:
To integrate LaunchDarkly:
npm install launchdarkly-react-client-sdkUse scripts/setup_launchdarkly.py to scaffold LaunchDarkly configuration.
To implement local JSON-based flags:
config/feature-flags.json with flag definitionsUse scripts/setup_json_flags.py to generate JSON flag structure.
Consult references/feature-flag-patterns.md for implementation patterns and best practices.
To set up LaunchDarkly in Next.js:
// app/providers.tsx
import { LDProvider } from 'launchdarkly-react-client-sdk';
export function Providers({ children }: { children: React.ReactNode }) {
return (
<LDProvider
clientSideID={process.env.NEXT_PUBLIC_LD_CLIENT_ID}
user={{
key: 'user-id',
email: 'user@example.com',
}}
>
{children}
</LDProvider>
);
}
To create custom JSON provider:
// lib/feature-flags/provider.tsx
import { createContext, useContext } from 'react';
import flags from '@/config/feature-flags.json';
const FeatureFlagContext = createContext(flags);
export function FeatureFlagProvider({ children }: { children: React.ReactNode }) {
return (
<FeatureFlagContext.Provider value={flags}>
{children}
</FeatureFlagContext.Provider>
);
}
export function useFeatureFlags() {
return useContext(FeatureFlagContext);
}
Reference assets/feature-flag-provider.tsx for complete provider implementation.
To gate UI components behind flags:
import { useFeatureFlag } from '@/lib/feature-flags';
export function NewFeatureComponent() {
const isEnabled = useFeatureFlag('new-timeline-view');
if (!isEnabled) {
return null;
}
return <div>New Timeline View</div>;
}
To show different variants based on flags:
export function EntityList() {
const useNewLayout = useFeatureFlag('entity-list-redesign');
return useNewLayout ? <NewEntityList /> : <LegacyEntityList />;
}
To gate Server Actions:
// app/actions/entity-actions.ts
'use server';
import { getFeatureFlag } from '@/lib/feature-flags/server';
export async function createEntity(data: EntityData) {
const allowBulkCreate = await getFeatureFlag('bulk-entity-creation');
if (allowBulkCreate && data.items?.length > 1) {
return bulkCreateEntities(data.items);
}
return createSingleEntity(data);
}
Reference assets/server-actions-with-flags.ts for server-side flag patterns.
Define flags with metadata:
{
"flags": {
"new-timeline-view": {
"enabled": true,
"description": "Enable new timeline visualization",
"rolloutPercentage": 100,
"allowedUsers": [],
"environments": {
"development": true,
"staging": true,
"production": false
}
}
}
}
Support different flag types:
Consult references/flag-types.md for detailed flag type specifications.
To implement gradual feature rollouts:
Use scripts/rollout_manager.py to automate rollout percentage updates.
To target specific user segments:
const flags = evaluateFlags(userId, flagConfig);
const flags = evaluateFlags({
userId: 'user-123',
email: 'user@example.com',
role: 'admin',
tier: 'premium',
});
const flags = evaluateFlags(user, {
rules: [
{ property: 'role', operator: 'equals', value: 'admin' },
{ property: 'tier', operator: 'in', values: ['premium', 'enterprise'] },
],
});
To configure flags per environment:
{
"flags": {
"debug-mode": {
"development": true,
"staging": true,
"production": false
},
"experimental-features": {
"development": true,
"staging": false,
"production": false
}
}
}
Load environment-specific configuration at build time or runtime.
To implement A/B tests:
export function EntityDetailPage() {
const variant = useFeatureFlagVariant('entity-detail-layout', {
control: 'grid',
variantA: 'list',
variantB: 'cards',
});
return variant === 'list' ? (
<EntityListView />
) : variant === 'cards' ? (
<EntityCardView />
) : (
<EntityGridView />
);
}
Track variant exposure for analytics:
useEffect(() => {
trackExposure('entity-detail-layout', variant);
}, [variant]);
To add a new feature flag:
To clean up completed feature flags:
Use scripts/find_flag_usage.py to locate all usages of a flag before removal.
To override flags in development:
// .env.local
NEXT_PUBLIC_FEATURE_FLAGS_OVERRIDE='{"new-timeline-view":true}'
To test flag variations:
// test/setup.ts
import { mockFeatureFlags } from '@/lib/feature-flags/testing';
beforeEach(() => {
mockFeatureFlags({
'new-timeline-view': true,
'bulk-entity-creation': false,
});
});
Reference assets/testing-utils.ts for testing utilities.
To track feature flag impact:
Integrate with analytics platform:
import { analytics } from '@/lib/analytics';
export function useFeatureFlagWithTracking(flagName: string) {
const isEnabled = useFeatureFlag(flagName);
useEffect(() => {
analytics.track('feature_flag_exposure', {
flag: flagName,
enabled: isEnabled,
});
}, [flagName, isEnabled]);
return isEnabled;
}
To leverage LaunchDarkly capabilities:
Consult LaunchDarkly documentation for advanced features.
Common issues:
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.