feature-switch
БесплатноБез исполняемых скриптовНе проверенFeature switch system guide for gating new user-facing features behind feature flags
от okou-ai★ 1 162 звезды на GitHubОб этом скилле
Feature Switch Skill
This skill documents the feature switch system and provides step-by-step instructions for adding new feature switches. All new user-facing features must be gated behind a feature switch for gradual rollout.
When to Use
A feature switch is required when adding:
- New UI pages, sections, or sidebar navigation items
- New API endpoints exposed to users or agents
- New integrations (connectors, Slack, Telegram, etc.)
- New agent token capabilities
A feature switch is not required for:
- Internal refactors or code cleanup
- Test infrastructure changes
- Build/CI configuration
- Bug fixes to existing features
- Documentation updates
How to Add a Feature Switch
Step 1: Add a key to the enum
File: turbo/packages/core/src/feature-switch-key.ts
Add a new entry to FeatureSwitchKey. Its value is the slug displayed in Lab
and must use only ASCII letters, digits, and underscores:
export enum FeatureSwitchKey {
// ... existing keys
MyFeature = "myFeature",
}
Step 2: Register the switch
File: turbo/packages/core/src/feature-switch.ts
Add an entry to the FEATURE_SWITCHES record:
[FeatureSwitchKey.MyFeature]: {
maintainer: "[email protected]",
description: "Enable the new feature.",
enabled: false,
enabledOrgIdHashes: STAFF_ORG_ID_HASHES, // optional: staff-only access
},
Configuration options:
| Field | Type | Description |
|---|---|---|
maintainer |
string |
Email of the responsible person |
description |
string |
One or two short sentences shown in Lab |
enabled |
boolean |
true = on for everyone, false = off by default |
enabledUserHashes |
string[] |
FNV-1a hashes of allowed user IDs |
enabledEmailHashes |
string[] |
FNV-1a hashes of allowed emails |
enabledOrgIdHashes |
string[] |
FNV-1a hashes of allowed org IDs |
Common default states:
enabled: false— fully hidden unless enabled by a per-user API overrideenabled: false+enabledOrgIdHashes: STAFF_ORG_ID_HASHES— staff-only (most common for new features)enabled: true— on for everyone (use when feature is ready for GA)
Step 3: Gate the feature in application code
Choose the pattern that matches where your feature is consumed.
Server-side (API routes)
import { isFeatureEnabled, FeatureSwitchKey } from "@okouai/core";
// In route handler:
if (!isFeatureEnabled(FeatureSwitchKey.MyFeature, { userId, orgId })) {
return createErrorResponse("FORBIDDEN", "Feature not available");
}
Client-side (Platform UI)
import { FeatureSwitchKey } from "@okouai/core";
import { featureSwitch$ } from "../../signals/external/feature-switch.ts";
// In component:
const features = useLastResolved(featureSwitch$);
const showMyFeature = features?.[FeatureSwitchKey.MyFeature] ?? false;
// Conditional rendering:
{showMyFeature && <MyFeatureComponent />}
Sidebar navigation gating
Sidebar entries are not gated declaratively. The nav item records in
turbo/apps/platform/src/views/okou-page/sidebar.tsx (MANAGE_NAV,
FOOTER_NAV) carry no feature-switch field. Read featureSwitch$ in the
component that renders the entry and omit the item when the switch is off —
turbo/apps/platform/src/views/okou-page/sidebar-account.tsx gates the Lab
entry this way:
const features = useLastResolved(featureSwitch$);
const labEnabled = features?.[FeatureSwitchKey.Lab] ?? false;
// In the render:
{labEnabled && <DropdownMenuItem>{/* ... */}</DropdownMenuItem>}
Connector gating
Connector definitions live in okou-ai/okou-connectors, but the platform owns
the rollout association. Add an entry to FEATURE_SWITCH_BY_AUTH_METHOD in
turbo/apps/api/src/signals/services/connector-auth-method-feature-switches.ts,
keyed by `${connectorSlug}\0${authMethodId}`:
const FEATURE_SWITCH_BY_AUTH_METHOD = Object.freeze<
Record<string, FeatureSwitchKey | undefined>
>({
// ... existing entries
"my-connector\0oauth": FeatureSwitchKey.MyConnector,
});
Deploy the association before publishing a method that should be gated, and remove it once the switch graduates.
Agent token capability gating
In turbo/apps/api/src/signals/auth/tokens.ts, add to CONDITIONAL_CAPABILITIES:
const CONDITIONAL_CAPABILITIES = [
// ... existing entries
["my-feature:write", FeatureSwitchKey.MyFeature],
] as const satisfies readonly (readonly [Capability, FeatureSwitchKey])[];
Key Files
| File | Role | | --------------------------------------------
Установить feature-switch в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл feature-switch?
Feature switch system guide for gating new user-facing features behind feature flags
Как установить скилл feature-switch?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл feature-switch запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic