Agent Skillsmarcus/sidecar › feature-flags

feature-flags

GitHub

提供功能标志(Feature Flags)的注册、检查及配置管理指南。支持通过代码定义、配置文件和CLI覆盖进行开关控制,并明确优先级规则。用于安全灰度发布新功能或实验性功能。

.claude/skills/feature-flags/SKILL.md marcus/sidecar

触发场景

需要添加新的功能开关 根据条件动态启用或禁用功能 配置功能标志的默认值或运行时状态

安装

npx skills add marcus/sidecar --skill feature-flags -g -y
更多选项

非标准路径

npx skills add https://github.com/marcus/sidecar/tree/main/.claude/skills/feature-flags -g -y

不安装直接使用

npx skills use marcus/sidecar@feature-flags

指定 Agent (Claude Code)

npx skills add marcus/sidecar --skill feature-flags -a claude-code -g -y

安装 repo 全部 skill

npx skills add marcus/sidecar --all -g -y

预览 repo 内 skill

npx skills add marcus/sidecar --list

SKILL.md

Frontmatter
{
    "name": "feature-flags",
    "description": "Creating and using feature flags in sidecar for gating experimental functionality. Covers flag registration, checking flags in code, config file and CLI overrides, and priority resolution. Use when adding feature flags, toggling features, or gating new functionality behind flags.",
    "user-invocable": false
}

Feature Flags

Feature flags gate experimental functionality behind user-configurable settings, enabling safe rollout (default off), user opt-in, and easy rollback.

Checking Feature State

import "github.com/marcus/sidecar/internal/features"

if features.IsEnabled("tmux_interactive_input") {
    // Feature-gated code
}

Adding a New Feature Flag

  1. Define the feature in internal/features/features.go:
var MyNewFeature = Feature{
    Name:        "my_new_feature",
    Default:     false,
    Description: "Description of what this enables",
}
  1. Add to the allFeatures slice:
var allFeatures = []Feature{
    TmuxInteractiveInput,
    MyNewFeature, // Add here
}
  1. Use the feature check in your code:
if features.IsEnabled("my_new_feature") {
    // New functionality
}

User Configuration

Config file (~/.config/sidecar/config.json)

{
  "features": {
    "flags": {
      "tmux_interactive_input": true
    }
  }
}

CLI override (takes precedence over config)

sidecar --enable-feature=tmux_interactive_input
sidecar --disable-feature=tmux_interactive_input
sidecar --enable-feature=feature1,feature2   # Multiple features

Unknown feature names in CLI flags produce a warning but do not prevent startup.

Priority Order

Feature state resolves in this order (first match wins):

  1. CLI override (--enable-feature, --disable-feature)
  2. Config file (features.flags in config.json)
  3. Default value (defined in code)

Available Features

Feature Default Description
tmux_interactive_input true Write support for tmux panes
tmux_full_attach false Suspend Sidecar and tmux attach-session
tmux_inline_edit true Inline file editing via tmux in files plugin
notes_plugin false Notes plugin for capturing quick notes
tasks_plugin false Embedded Tasks plugin tab
conversations_plugin false Conversations multi-agent history tab (off = no adapters / session I/O)
workspace_terminal_panel false Workspace Ctrl+T / Alt+T split terminal panel

API Reference

features.IsEnabled(name string) bool           // Check if enabled
features.List() map[string]bool                 // All features with current state
features.ListAll() []Feature                    // All features with metadata
features.SetEnabled(name string, enabled bool) error  // Persist to config
features.SetOverride(name string, enabled bool) // Runtime override (not persisted)
features.IsKnownFeature(name string) bool       // Check if registered

Best Practices

  • Use snake_case for feature names (e.g., my_new_feature)
  • New experimental features should default to false
  • Provide clear descriptions for each feature
  • Document features in docs/guides/deprecated/feature-flags.md when adding them
  • Remove feature flags once features are stable

版本历史

  • b3ba2b5 当前 2026-08-20 01:12
  • 0ddc6b7 2026-07-25 07:17

同 Skill 集合

.claude/skills/create-adapter/SKILL.md
.claude/skills/create-modal/SKILL.md
.claude/skills/create-plugin/SKILL.md
.claude/skills/create-prompt/SKILL.md
.claude/skills/create-theme/SKILL.md
.claude/skills/drag-pane/SKILL.md
.claude/skills/inline-editor/SKILL.md
.claude/skills/keyboard-shortcuts/SKILL.md
.claude/skills/merge-strategy/SKILL.md
.claude/skills/profile-memory/SKILL.md
.claude/skills/project-switching/SKILL.md
.claude/skills/release-sidecar/SKILL.md
.claude/skills/shell-integration/SKILL.md
.claude/skills/sidecar-website/SKILL.md
.claude/skills/ui-features/SKILL.md
.claude/skills/worktree-switching/SKILL.md

元信息

文件数
0
版本
b3ba2b5
Hash
bf989554
收录时间
2026-07-25 07:17

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 06:16
浙ICP备14020137号-1 $访客地图$