Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

feature-flag-manager功能标志管理器

Agent Skill

feature-flag-manager 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

267

周安装

11

GitHub Stars

3

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:feature-flag-manager(功能标志管理器)
来源仓库:https://github.com/hopeoverture/worldbuilding-app-skills
仓库路径:skills/feature-flag-manager
安装命令:
npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill feature-flag-manager
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill feature-flag-manager

简介

用于根据关键词或线索快速查找、检索和筛选相关信息。

  • 适用于需要从大量数据中定位候选结果的研究或开发场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装。
  • 支持 Codex、Claude、Cursor、Gemini CLI,安装方式为 github。
  • feature-flag-manager 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Feature Flag Manager

Implement comprehensive feature flag management for controlled feature rollouts and A/B testing in worldbuilding applications.

Overview

To add feature flag capabilities:

  1. Choose between LaunchDarkly (cloud service) or JSON-based (local) implementation
  2. Set up feature flag provider with configuration
  3. Create feature flag components and hooks
  4. Gate UI components and Server Actions behind flags
  5. Implement user targeting and progressive rollouts

Implementation Options

LaunchDarkly Integration

To integrate LaunchDarkly:

  1. Install LaunchDarkly SDK: npm install launchdarkly-react-client-sdk
  2. Configure provider in app root with client-side ID
  3. Create hooks for flag evaluation
  4. Wrap components with feature flag checks
  5. Configure flags in LaunchDarkly dashboard

Use scripts/setup_launchdarkly.py to scaffold LaunchDarkly configuration.

JSON-Based Feature Flags

To implement local JSON-based flags:

  1. Create config/feature-flags.json with flag definitions
  2. Build feature flag provider context
  3. Create hooks to read flags from context
  4. Implement environment-specific overrides
  5. Support runtime flag updates

Use scripts/setup_json_flags.py to generate JSON flag structure.

Consult references/feature-flag-patterns.md for implementation patterns and best practices.

Feature Flag Provider Setup

LaunchDarkly Provider

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>
  );
}

JSON Provider

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.

Using Feature Flags

Component Gating

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>;
}

Conditional Rendering

To show different variants based on flags:

export function EntityList() {
  const useNewLayout = useFeatureFlag('entity-list-redesign');

  return useNewLayout ? <NewEntityList /> : <LegacyEntityList />;
}

Server Action Gating

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.

Flag Configuration

Flag Structure

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
      }
    }
  }
}

Flag Types

Support different flag types:

  • Boolean: Simple on/off toggle
  • Percentage: Gradual rollout (0-100%)
  • User Targeting: Specific users or groups
  • Multivariate: Multiple variations (A/B/C testing)

Consult references/flag-types.md for detailed flag type specifications.

Progressive Rollout

To implement gradual feature rollouts:

  1. Initial Release: Enable for 5% of users
  2. Monitor Metrics: Track performance and errors
  3. Increase Rollout: Gradually increase to 25%, 50%, 100%
  4. Full Release: Enable for all users
  5. Remove Flag: Clean up flag code after stable release

Use scripts/rollout_manager.py to automate rollout percentage updates.

User Targeting

To target specific user segments:

By User ID

const flags = evaluateFlags(userId, flagConfig);

By User Properties

const flags = evaluateFlags({
  userId: 'user-123',
  email: 'user@example.com',
  role: 'admin',
  tier: 'premium',
});

By Custom Rules

const flags = evaluateFlags(user, {
  rules: [
    { property: 'role', operator: 'equals', value: 'admin' },
    { property: 'tier', operator: 'in', values: ['premium', 'enterprise'] },
  ],
});

Environment-Specific Flags

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.

A/B Testing

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]);

Flag Lifecycle Management

Creating New Flags

To add a new feature flag:

  1. Define flag in configuration with metadata
  2. Set initial state (usually disabled)
  3. Implement flag checks in code
  4. Deploy with flag disabled
  5. Enable flag via dashboard or config update

Removing Old Flags

To clean up completed feature flags:

  1. Ensure flag is at 100% rollout
  2. Verify no incidents for 2+ weeks
  3. Remove flag checks from code
  4. Make flagged code permanent
  5. Remove flag from configuration
  6. Deploy cleanup changes

Use scripts/find_flag_usage.py to locate all usages of a flag before removal.

Testing with Feature Flags

Local Development

To override flags in development:

// .env.local
NEXT_PUBLIC_FEATURE_FLAGS_OVERRIDE='{"new-timeline-view":true}'

Testing Specific Variants

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.

Monitoring and Analytics

To track feature flag impact:

  1. Exposure Tracking: Log when flags are evaluated
  2. Performance Metrics: Monitor performance per variant
  3. Error Rates: Track errors by flag state
  4. User Engagement: Measure feature usage
  5. Conversion Metrics: Track business metrics per variant

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;
}

LaunchDarkly-Specific Features

To leverage LaunchDarkly capabilities:

  • Targeting Rules: Create complex targeting rules in dashboard
  • Flag Triggers: Automate flag changes based on metrics
  • Scheduled Rollouts: Plan feature releases in advance
  • Flag Dependencies: Define flag prerequisites
  • Audit Logs: Track all flag changes
  • Team Workflows: Require approvals for production changes

Consult LaunchDarkly documentation for advanced features.

Best Practices

  1. Short-Lived Flags: Remove flags after rollout completes
  2. Clear Naming: Use descriptive, consistent flag names
  3. Documentation: Document flag purpose and timeline
  4. Default Values: Provide safe defaults for missing flags
  5. Testing: Test both enabled and disabled states
  6. Monitoring: Track flag performance and errors
  7. Cleanup: Regularly audit and remove unused flags

Troubleshooting

Common issues:

  • Flag Not Updating: Check cache settings and invalidation
  • Inconsistent State: Verify flag evaluation consistency
  • Performance Impact: Minimize flag evaluation overhead
  • Testing Challenges: Use proper mocking in tests
  • Configuration Conflicts: Ensure environment-specific overrides work correctly

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.97%
按下载量换算32

Claude

26.13%
按下载量换算23

Cursor

17.71%
按下载量换算15

Gemini CLI

9.55%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills